Mac slice F task 15 fix 1: Add Claude link, Made on, taint, sync flake
Astra round 1 and the controller: - The Add Claude link on a Mac connection wait uses the runner the step waits for (wire.Step.WaitingFor, from SandboxRunner); placement leaves RunnerID empty, so the link never showed. - Made on and the no-Xcode line come from what the dispatch recorded (chat_steps.on_worker, migration 0120 amended), not from today's main runner: a replaced primary's changes are not named. - A tainted Mac that also holds Claude shows runner.tainted_held (pending) in place of the taint and hold notes, never advising the hidden choice. - TestContractWorkerSyncHolds read the store before the non-durable sync was applied; syncNow waits for a lease round trip. 50 of 50. - The copy gate is unchanged on this branch (controller ruling).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 files changed,
+164
−41
.rastrillo/budgets.txt+5 −5docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json+5 −0docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+1 −0internal/equipo/chat/macsandbox.go+9 −6internal/equipo/chat/tasks.go+7 −1internal/equipo/connections_machines_test.go+1 −1internal/equipo/copy.go+17 −16internal/equipo/mac_engineering_views_test.go+39 −2internal/equipo/migrations/0120_mac_engineering.sql+3 −0internal/equipo/migrations/schema.sql+1 −0internal/equipo/migrations_mac_engineering_test.go+1 −1internal/equipo/templates/runners.html+1 −2internal/equipo/work_views.go+4 −3internal/thintest/mac_views_contract_test.go+52 −0internal/thintest/worker_connections_fix1_contract_test.go+14 −4internal/wire/tasks.go+4 −0
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 5687ecf8..99639cef 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,8 +14,8 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 24233 - Preview, retry, merges, kept work, check-db, notifications, places, GitHub routes, Mac waits, probe and proof codes, Mac credential copy, Mac connections, Engineering reasons, F probes, D1; 24233. |
| -size internal/wire 8690 - Protocols 31 to 35 (facts, diffs, evidence, CI units, files, places), Mac waits, 37 Mac Engineering, probe and proof codes, credential_unproven, model hold, runner user; 8690. |
| +size internal/equipo 24235 - Preview, retry, merges, kept work, check-db, notifications, places, GitHub routes, Mac waits, probe and proof codes, Mac credential copy, Mac connections, Engineering reasons, F probes, D1; 24235. |
| +size internal/wire 8694 - Protocols 31 to 35 (facts, diffs, evidence, CI units, files, places), Mac waits, 37 Mac Engineering, probe and proof codes, credential_unproven, model hold, runner user; 8694. |
| size internal/equipotest - 12683 GitHub connect value search, lifecycle and sweep-log contracts; Task 21 migration fixtures and Rastrillo asset contract; measured 0/12683 source/test lines. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). |
| @@ -38,7 +38,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full |
| perf GET /releases/* skip Verified runner release file downloads, not browser GET screens. |
| perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen. |
| time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; |
| -size internal/runner/thin 34129 31123 Protocols 31 to 35, merge credential, publication guards, kept work, scans, Mac pin, paths, bases, endpoint, Mac turns, Mac credentials, worker conns, Engineering, asks, F probes, D1; 34129/31123. |
| +size internal/runner/thin 34129 31129 Protocols 31 to 35, merge credential, publication guards, kept work, scans, Mac pin, paths, bases, endpoint, Mac turns, Mac credentials, worker conns, Engineering, asks, F probes, D1; 34129/31129. |
| time internal/thintest 240s Thin contract and page tests, the Assistant's and the models' included, share one harness. Measured 202s on a shared 16 CPU box (2026-11-13); CI runs two lanes. |
| time internal/runner/mac 45s Real processes killed and proven gone: groups, sessions, the runner-user sweep, turns, restarts; probes end to end. Measured 29.3s locally. |
| time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). |
| @@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device |
| perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen. |
| -size internal/equipo/chat 39391 12122 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places, waiting cards, Mac waits, Engineering, conns, asks, D1; 39391/12122. |
| +size internal/equipo/chat 39400 12122 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places, waiting cards, Mac waits, Engineering, conns, asks, D1; 39400/12122. |
| perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}. |
| perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}. |
| perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections. |
| @@ -71,7 +71,7 @@ perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one im |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally). |
| size internal/headless - 11999 Grant scenarios (#48); sign-in email at 1280 and 390; Assistant files end to end; the restart wait; the live site waits for a place; a card answer settles at the bottom; measured 11999 test lines. |
| -size internal/thintest - 40276 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places, Mac waits, Mac Engineering, conns, asks, D1; 40276. |
| +size internal/thintest - 40338 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places, Mac waits, Mac Engineering, conns, asks, D1; 40338. |
| perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}. |
| perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage. |
diff --git a/docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json b/docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json| index d16e5759..32e58467 100644 |
| --- a/docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json |
| +++ b/docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json |
| @@ -290,6 +290,11 @@ |
| "where": "Machines page, a Mac's card: a note while the instance holds that Mac as having a Claude credential (connecting, connected, or files and Keychain items not yet proven gone): its checks run only in its sandbox (D1)", |
| "draft": "This Mac holds a Claude connection, or something one left, so its checks run only in its sandbox." |
| }, |
| + { |
| + "key": "runner.tainted_held", |
| + "where": "Machines page, a Mac's card: in place of the accepted runner.tainted note and of runner.mac.holds_claude, when the Mac is tainted and the instance also holds it as having a Claude credential: its checks cannot run outside the sandbox either (D1), so it must not tell the creator to choose that", |
| + "draft": "A check has run outside the sandbox on this Mac, so Equipo no longer trusts its sandbox. It also holds a Claude connection, or something one left, so its checks can’t run outside the sandbox either: they wait. To start clean, install the runner again as a new Mac user." |
| + }, |
| { |
| "key": "docs/mac-runner.md#make-changes-on-the-mac", |
| "where": "docs/mac-runner.md, the section \"Make changes on the Mac\" (owner turns the switch on; the runner user fixes its home folder if the Machines page asks; the person adds Claude to the Mac and signs in)", |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index 8e1474f1..b0999de2 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -7054,6 +7054,7 @@ records remain unchanged. |
| | `runner.engineering.home_open` | No: other people on this Mac can reach the runner's folders | Copy specialist | COPY REVIEW PENDING | |
| | `runner.engineering.tainted` | No: it once ran checks outside the sandbox | Copy specialist | COPY REVIEW PENDING | |
| | `runner.mac.holds_claude` | This Mac holds a Claude connection, or something one left, so its checks run only in its sandbox. | Copy specialist | COPY REVIEW PENDING | |
| +| `runner.tainted_held` | A check has run outside the sandbox on this Mac, so Equipo no longer trusts its sandbox. It also holds a Claude connection, or something one left, so its checks can’t run outside the sandbox either: they wait. To start clean, install the runner again as a new Mac user. | Copy specialist | COPY REVIEW PENDING | |
| ## Task 21 |
diff --git a/internal/equipo/chat/macsandbox.go b/internal/equipo/chat/macsandbox.go| index 948ee8d9..6730dc27 100644 |
| --- a/internal/equipo/chat/macsandbox.go |
| +++ b/internal/equipo/chat/macsandbox.go |
| @@ -137,12 +137,15 @@ func (t *txn) stepRunnerLabel(s stepRecord) string { |
| // and the worker Engineering ran on. |
| func (t *txn) stepWaitView(sv *wire.Step, s stepRecord) { |
| sv.RunnerLabel = t.stepRunnerLabel(s) |
| - if s.Specialist == wire.SpecialistEngineering && s.RunnerID != "" && s.StartedAt != nil { |
| - // Made on a worker: named, with what it got of Xcode (never the |
| - // main runner: house rule 2026-11-07.8). |
| - if primary, err := t.s.authority.PrimaryRunner(t.db, s.Person); err == nil && primary != s.RunnerID { |
| - sv.MadeOn, sv.XcodeAccess = sv.RunnerLabel, s.XcodeAccess |
| - } |
| + if s.RunnerID == "" { |
| + // Placed nowhere: the runner it waits for, by id (RunnerLabel |
| + // names it). |
| + sv.WaitingFor = s.SandboxRunner |
| + } |
| + if s.Specialist == wire.SpecialistEngineering && s.RunnerID != "" && s.StartedAt != nil && s.OnWorker { |
| + // Made on a worker, as its dispatch recorded: named, with what it |
| + // got of Xcode (never the main runner: house rule 2026-11-07.8). |
| + sv.MadeOn, sv.XcodeAccess = sv.RunnerLabel, s.XcodeAccess |
| } |
| if s.Placement == wire.PlacementSandbox && s.SandboxRunner != "" && s.Specialist == wire.SpecialistChecks { |
| // Whether its creator may run it outside the sandbox (D1); unknown |
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go| index 19af5496..26dab493 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -236,6 +236,10 @@ type stepRecord struct { |
| XcodeAccess string |
| OutcomePhase string |
| SessionID string |
| + // OnWorker: the current attempt was dispatched to a worker, not the |
| + // person's main runner, as decided at its dispatch (migration 0120). |
| + // Never recomputed against a later main runner. |
| + OnWorker bool |
| // ChangeFacts is the review's measured change (wire.ChangeFacts JSON), |
| // kept only when it passed acceptance. DecidedBy is who decided a |
| // merge step ("policy", or "person:<address>"); MergeSource and |
| @@ -812,7 +816,7 @@ func (t *txn) writeStep(s *stepRecord) error { |
| } |
| s.Revision++ |
| s.UpdatedAt = t.now() |
| - if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model", "xcode_access", "outcome_phase", "session_id", "publication_runner").Updates(s).Error; err != nil { |
| + if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model", "xcode_access", "outcome_phase", "session_id", "publication_runner", "on_worker").Updates(s).Error; err != nil { |
| return err |
| } |
| if s.Retired { |
| @@ -1254,6 +1258,8 @@ func (t *txn) dispatchStep(k *taskRecord, s *stepRecord) error { |
| // Only this attempt's grant counts (below, on a worker). |
| s.XcodeAccess = "" |
| } |
| + // Where this attempt runs, kept for its view ("Made on"). |
| + s.OnWorker = s.RunnerID != primary |
| if s.RunnerID != primary { |
| // Placed on a worker: what it needs, and the candidate relayed |
| // from the primary as a pack in an inbound transfer. |
diff --git a/internal/equipo/connections_machines_test.go b/internal/equipo/connections_machines_test.go| index b56fb632..86381848 100644 |
| --- a/internal/equipo/connections_machines_test.go |
| +++ b/internal/equipo/connections_machines_test.go |
| @@ -145,7 +145,7 @@ func TestTakesClaude(t *testing.T) { |
| // TestMacConnectionNeedsLinksToAdd: Needs you for a Mac waiting for a |
| // Claude connection links straight to adding Claude to that Mac. |
| func TestMacConnectionNeedsLinksToAdd(t *testing.T) { |
| - task := wire.Task{ID: "t1", NeedsYou: wire.NeedsMacConnection, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, RunnerID: "w-studio", RunnerLabel: "Tito Studio", Placement: wire.PlacementMacConnection, EngineeringStatus: &wire.EngineeringStatus{State: wire.EngineeringNoConnection}}}} |
| + task := wire.Task{ID: "t1", NeedsYou: wire.NeedsMacConnection, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, WaitingFor: "w-studio", RunnerLabel: "Tito Studio", Placement: wire.PlacementMacConnection, EngineeringStatus: &wire.EngineeringStatus{State: wire.EngineeringNoConnection}}}} |
| d := decisionOf(task, taskLine{}) |
| if d.AddClaude != "/conversation/settings/connections#machine-w-studio" || d.AddClaudeLabel != "Add Claude to Tito Studio" { |
| t.Fatalf("decision %+v", d) |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index a8d0404e..0dbbdd85 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -2545,22 +2545,23 @@ var pageCopy = map[string]string{ |
| "work.ask.mac_offline": "%s is offline. Ask again when it is back.", // COPY REVIEW PENDING |
| // Mac Engineering (slice F, plan task 15): D1 and the views. |
| - "work.step.made_on": "Made on %s", // COPY REVIEW PENDING |
| - "work.step.no_xcode": "Built and tested by the Mac's checks, not while making the change", // COPY REVIEW PENDING |
| - "work.step.waiting_base": "Getting the project ready to send to %s", // COPY REVIEW PENDING |
| - "runner.engineering": "Makes changes", // COPY REVIEW PENDING |
| - "runner.engineering.ready": "Yes", // COPY REVIEW PENDING |
| - "runner.engineering.no_connection": "Not yet: it has no Claude connection", // COPY REVIEW PENDING |
| - "runner.engineering.signed_out": "Not now: Claude is signed out on this Mac", // COPY REVIEW PENDING |
| - "runner.engineering.limited": "Not now: Claude has reached its usage limit", // COPY REVIEW PENDING |
| - "runner.engineering.probes_pending": "Not yet: its self-checks for Claude are still running", // COPY REVIEW PENDING |
| - "runner.engineering.probes_failed": "No: some of its self-checks for Claude failed", // COPY REVIEW PENDING |
| - "runner.engineering.cli_unpinned": "Not yet: it doesn't have the approved version of Claude Code", // COPY REVIEW PENDING |
| - "runner.engineering.home_open": "No: other people on this Mac can reach the runner's folders", // COPY REVIEW PENDING |
| - "runner.engineering.tainted": "No: it once ran checks outside the sandbox", // COPY REVIEW PENDING |
| - "runner.mac.holds_claude": "This Mac holds a Claude connection, or something one left, so its checks run only in its sandbox.", // COPY REVIEW PENDING |
| - "work.decide.sandbox_held": "%s holds a Claude connection, so its checks can’t run outside the sandbox.", // COPY REVIEW PENDING |
| - "work.decide.unsandboxed_withdrawn": "I won’t run the checks for [%s](%s) outside the sandbox after all: Claude is being added to %s, and a Mac with Claude runs checks only in its sandbox. They wait for its sandbox instead.", // COPY REVIEW PENDING |
| + "work.step.made_on": "Made on %s", // COPY REVIEW PENDING |
| + "work.step.no_xcode": "Built and tested by the Mac's checks, not while making the change", // COPY REVIEW PENDING |
| + "work.step.waiting_base": "Getting the project ready to send to %s", // COPY REVIEW PENDING |
| + "runner.engineering": "Makes changes", // COPY REVIEW PENDING |
| + "runner.engineering.ready": "Yes", // COPY REVIEW PENDING |
| + "runner.engineering.no_connection": "Not yet: it has no Claude connection", // COPY REVIEW PENDING |
| + "runner.engineering.signed_out": "Not now: Claude is signed out on this Mac", // COPY REVIEW PENDING |
| + "runner.engineering.limited": "Not now: Claude has reached its usage limit", // COPY REVIEW PENDING |
| + "runner.engineering.probes_pending": "Not yet: its self-checks for Claude are still running", // COPY REVIEW PENDING |
| + "runner.engineering.probes_failed": "No: some of its self-checks for Claude failed", // COPY REVIEW PENDING |
| + "runner.engineering.cli_unpinned": "Not yet: it doesn't have the approved version of Claude Code", // COPY REVIEW PENDING |
| + "runner.engineering.home_open": "No: other people on this Mac can reach the runner's folders", // COPY REVIEW PENDING |
| + "runner.engineering.tainted": "No: it once ran checks outside the sandbox", // COPY REVIEW PENDING |
| + "runner.tainted_held": "A check has run outside the sandbox on this Mac, so Equipo no longer trusts its sandbox. It also holds a Claude connection, or something one left, so its checks can’t run outside the sandbox either: they wait. To start clean, install the runner again as a new Mac user.", // COPY REVIEW PENDING |
| + "runner.mac.holds_claude": "This Mac holds a Claude connection, or something one left, so its checks run only in its sandbox.", // COPY REVIEW PENDING |
| + "work.decide.sandbox_held": "%s holds a Claude connection, so its checks can’t run outside the sandbox.", // COPY REVIEW PENDING |
| + "work.decide.unsandboxed_withdrawn": "I won’t run the checks for [%s](%s) outside the sandbox after all: Claude is being added to %s, and a Mac with Claude runs checks only in its sandbox. They wait for its sandbox instead.", // COPY REVIEW PENDING |
| } |
| // pasteLabels are the paste box's words, for the shared renderer, and |
diff --git a/internal/equipo/mac_engineering_views_test.go b/internal/equipo/mac_engineering_views_test.go| index 148f9557..17e9bc1f 100644 |
| --- a/internal/equipo/mac_engineering_views_test.go |
| +++ b/internal/equipo/mac_engineering_views_test.go |
| @@ -123,8 +123,7 @@ func TestMacEngineeringViews(t *testing.T) { |
| `data-probe="F7" data-verdict="denied"><span>` + escape(copyText("runner.probe.F7")), |
| escape(fmt.Sprintf(copyText("runner.mac.home_open"), "paulequipo")), |
| escape(fmt.Sprintf(copyText("runner.mac.keychain_item"), "Claude Code-credentials-1a2b3c4d", "paulequipo")), |
| - escape(copyText("runner.mac.holds_claude")), |
| - escape(copyText("runner.tainted")), |
| + escape(copyText("runner.tainted_held")), |
| `<dt>` + escape(copyText("runner.engineering")) + `</dt><dd data-engineering="home_open">` + escape(copyText("runner.engineering.home_open")) + `</dd>`, |
| } { |
| if !strings.Contains(page, want) { |
| @@ -193,3 +192,41 @@ func slicesHas(list []string, s string) bool { |
| } |
| return false |
| } |
| + |
| +// TestMachinesTaintWithHold: a tainted Mac that also holds Claude (or |
| +// something one left) says so in one line from copy.go, and never tells |
| +// the creator to choose a run outside the sandbox, which D1 hides there. |
| +// Tainted alone keeps the accepted line; held alone, the hold's line. |
| +func TestMachinesTaintWithHold(t *testing.T) { |
| + const me = "owner@example.com" |
| + if copyText("runner.tainted_held") == "" { |
| + t.Fatal("no copy for runner.tainted_held") |
| + } |
| + at := time.Now() |
| + page := func(tainted, held bool) string { |
| + t.Helper() |
| + r := Runner{ID: "w-studio", Person: me, Label: "Tito Studio", Role: setup.RoleWorker} |
| + if tainted { |
| + r.TaintedAt = &at |
| + } |
| + if held { |
| + r.CredentialHeldAt = &at |
| + } |
| + return machinesHTML(t, machinesPage([]machineRecord{{Runner: r}}, me, at, false, "")) |
| + } |
| + both := page(true, true) |
| + if !strings.Contains(both, escape(copyText("runner.tainted_held"))) || strings.Contains(both, escape(copyText("runner.tainted"))) || strings.Contains(both, escape(copyText("runner.mac.holds_claude"))) { |
| + t.Fatalf("tainted and held:\n%s", both) |
| + } |
| + for _, offer := range []string{"chooses to run them outside the sandbox", escape(copyText("work.decide.unsandboxed"))} { |
| + if strings.Contains(both, offer) { |
| + t.Fatalf("tainted and held recommends %q", offer) |
| + } |
| + } |
| + if p := page(true, false); !strings.Contains(p, escape(copyText("runner.tainted"))) || strings.Contains(p, "data-holds-claude") { |
| + t.Fatal("tainted alone") |
| + } |
| + if p := page(false, true); !strings.Contains(p, escape(copyText("runner.mac.holds_claude"))) || strings.Contains(p, "data-tainted") { |
| + t.Fatal("held alone") |
| + } |
| +} |
diff --git a/internal/equipo/migrations/0120_mac_engineering.sql b/internal/equipo/migrations/0120_mac_engineering.sql| index eebfe5b4..1e816901 100644 |
| --- a/internal/equipo/migrations/0120_mac_engineering.sql |
| +++ b/internal/equipo/migrations/0120_mac_engineering.sql |
| @@ -8,6 +8,9 @@ ALTER TABLE chat_steps ADD COLUMN outcome_phase text; |
| ALTER TABLE chat_steps ADD COLUMN session_id text; |
| -- The primary a worker's publication was given to: only it may answer it. |
| ALTER TABLE chat_steps ADD COLUMN publication_runner text; |
| +-- The current attempt was dispatched to a worker, not the main runner |
| +-- (recorded at dispatch; an existing row reads as not). |
| +ALTER TABLE chat_steps ADD COLUMN on_worker numeric; |
| ALTER TABLE chat_questions ADD COLUMN eng_attempt integer; |
| ALTER TABLE chat_questions ADD COLUMN eng_account text; |
| ALTER TABLE chat_questions ADD COLUMN eng_session text; |
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql| index 0cc99a16..30ec6ee5 100644 |
| --- a/internal/equipo/migrations/schema.sql |
| +++ b/internal/equipo/migrations/schema.sql |
| @@ -848,6 +848,7 @@ ALTER TABLE chat_steps ADD COLUMN xcode_access text; |
| ALTER TABLE chat_steps ADD COLUMN outcome_phase text; |
| ALTER TABLE chat_steps ADD COLUMN session_id text; |
| ALTER TABLE chat_steps ADD COLUMN publication_runner text; |
| +ALTER TABLE chat_steps ADD COLUMN on_worker numeric; |
| ALTER TABLE chat_questions ADD COLUMN eng_attempt integer; |
| ALTER TABLE chat_questions ADD COLUMN eng_account text; |
| ALTER TABLE chat_questions ADD COLUMN eng_session text; |
diff --git a/internal/equipo/migrations_mac_engineering_test.go b/internal/equipo/migrations_mac_engineering_test.go| index 70bbfd27..8bc03535 100644 |
| --- a/internal/equipo/migrations_mac_engineering_test.go |
| +++ b/internal/equipo/migrations_mac_engineering_test.go |
| @@ -128,7 +128,7 @@ func TestMacEngineeringMigrationKeepsOpenTransfersAndQuestions(t *testing.T) { |
| } |
| added := map[string][]string{ |
| "runner_transfers": {"kind", "old_base_sha"}, |
| - "chat_steps": {"xcode_access", "outcome_phase", "session_id", "publication_runner"}, |
| + "chat_steps": {"xcode_access", "outcome_phase", "session_id", "publication_runner", "on_worker"}, |
| "chat_questions": {"eng_attempt", "eng_account", "eng_session", "runner_id", "base_sha", "candidate_sha"}, |
| "chat_tasks": {"mac_needs"}, |
| } |
diff --git a/internal/equipo/templates/runners.html b/internal/equipo/templates/runners.html| index d6e1579e..f18396d5 100644 |
| --- a/internal/equipo/templates/runners.html |
| +++ b/internal/equipo/templates/runners.html |
| @@ -20,8 +20,7 @@ |
| {{if .Others}}<dt>{{copy "runner.person"}}</dt><dd>{{$m.Person}}</dd>{{end}} |
| <dt>{{copy "runner.fingerprint"}}</dt><dd equipo-mach-key>{{$m.Fingerprint}}</dd> |
| </dl> |
| -{{if $m.Tainted}}<p equipo-mach-note data-tainted>{{copy "runner.tainted"}}</p>{{end}} |
| -{{if $m.HoldsClaude}}<p equipo-mach-note data-holds-claude>{{copy "runner.mac.holds_claude"}}</p>{{end}} |
| +{{if and $m.Tainted $m.HoldsClaude}}<p equipo-mach-note data-tainted data-holds-claude>{{copy "runner.tainted_held"}}</p>{{else if $m.Tainted}}<p equipo-mach-note data-tainted>{{copy "runner.tainted"}}</p>{{else if $m.HoldsClaude}}<p equipo-mach-note data-holds-claude>{{copy "runner.mac.holds_claude"}}</p>{{end}} |
| {{with $m.Report}}{{range .Guards}}<p equipo-mach-note data-guard>{{.}}</p>{{end}}{{end}} |
| {{with $m.Report}}{{with .Unproven}}<p equipo-mach-note data-unproven>{{.}}</p>{{end}}{{end}} |
| {{with $m.Report}}{{if .Probes}}<h4 equipo-mach-sub>{{copy "runner.probes"}}</h4> |
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go| index a6a11216..decef8fc 100644 |
| --- a/internal/equipo/work_views.go |
| +++ b/internal/equipo/work_views.go |
| @@ -829,9 +829,10 @@ func decisionOf(t wire.Task, v taskLine) *decisionView { |
| state = s.EngineeringStatus.State |
| } |
| key = "work.decide.mac_connection_why." + state |
| - if (state == wire.EngineeringNoConnection || state == wire.EngineeringSignedOut) && s.RunnerID != "" { |
| - // What it needs is Claude on that Mac: straight there. |
| - d.AddClaude, d.AddClaudeLabel = "/conversation/settings/connections#machine-"+s.RunnerID, fmt.Sprintf(copyText("chat.connections.add_to"), s.RunnerLabel) |
| + if (state == wire.EngineeringNoConnection || state == wire.EngineeringSignedOut) && s.WaitingFor != "" { |
| + // What it needs is Claude on that Mac (the one it waits |
| + // for, placed nowhere yet): straight there. |
| + d.AddClaude, d.AddClaudeLabel = "/conversation/settings/connections#machine-"+s.WaitingFor, fmt.Sprintf(copyText("chat.connections.add_to"), s.RunnerLabel) |
| } |
| } |
| d.Why, d.Ask, d.Cancel = fmt.Sprintf(copyText(key), s.RunnerLabel), fmt.Sprintf(copyText("work.decide.mac_wait_ask"), s.RunnerLabel), v.Cancel |
diff --git a/internal/thintest/mac_views_contract_test.go b/internal/thintest/mac_views_contract_test.go| index a68be022..7a4856f5 100644 |
| --- a/internal/thintest/mac_views_contract_test.go |
| +++ b/internal/thintest/mac_views_contract_test.go |
| @@ -84,3 +84,55 @@ func TestContractMainRunnerNotNamed(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestContractAddClaudeOnConnectionWait: a Mac Engineering attempt that |
| +// placement put waiting for a Mac's Claude connection links its creator |
| +// straight to adding Claude to that Mac, by the Mac's id, while the Mac |
| +// has no connection or is signed out; not while what it lacks is |
| +// something else (its home folder open). |
| +func TestContractAddClaudeOnConnectionWait(t *testing.T) { |
| + r := newMacRig(t) |
| + w := r.newMacEngineer("Tito Studio", wire.EngineeringNoConnection) |
| + wid := w.fr.Welcome.RunnerID |
| + task := r.macTask("iOS needs Claude") |
| + if s := r.newestEngineering(task); s.Placement != wire.PlacementMacConnection || s.RunnerID != "" || s.WaitingFor != wid { |
| + t.Fatalf("waiting %+v", s) |
| + } |
| + link := `href="/conversation/settings/connections#machine-` + wid + `" data-add-claude>Add Claude to Tito Studio</a>` |
| + for _, state := range []string{wire.EngineeringNoConnection, wire.EngineeringSignedOut} { |
| + r.macState(w, state, false) |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+task, 200); !strings.Contains(page, link) { |
| + t.Fatalf("%s: no link to add Claude to the Mac:\n%s", state, page) |
| + } |
| + } |
| + r.macState(w, wire.EngineeringHomeOpen, false) |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+task, 200); strings.Contains(page, "data-add-claude") { |
| + t.Fatal("home open: offered to add Claude") |
| + } |
| +} |
| + |
| +// TestContractMadeOnAfterPrimaryReplaced: whether an attempt was made on |
| +// a worker is what its dispatch recorded, not a comparison with today's |
| +// main runner. A change the old Linux primary made says neither "Made on" |
| +// nor the no-Xcode line once another machine is the main runner. |
| +func TestContractMadeOnAfterPrimaryReplaced(t *testing.T) { |
| + r := newRunnersRig(t) |
| + task, _ := r.candidate("Linux change", false) |
| + old := r.primary.fr.Welcome.RunnerID |
| + r.remove(old, true) |
| + h := primaryHello(0) |
| + h.Label = "docs-t2" |
| + p, err := DialRunnerHello(r.ctx, r.inst.URL, r.inst.EnrolRunner(t).Token, h) |
| + if err != nil || p.Welcome.Role != wire.RolePrimary || p.Welcome.RunnerID == old { |
| + t.Fatalf("replacement %+v %v", p, err) |
| + } |
| + t.Cleanup(p.Close) |
| + for _, s := range r.task(task).Steps { |
| + if s.Specialist == wire.SpecialistEngineering && (s.MadeOn != "" || s.StartedAt == nil) { |
| + t.Fatalf("the old primary's change named as made on a worker: %+v", s) |
| + } |
| + } |
| + if page := html.UnescapeString(r.get(r.inst.Cookie(), "/tasks/"+task, 200)); strings.Contains(page, "Made on") || strings.Contains(page, "not while making the change") { |
| + t.Fatalf("task page:\n%s", page) |
| + } |
| +} |
diff --git a/internal/thintest/worker_connections_fix1_contract_test.go b/internal/thintest/worker_connections_fix1_contract_test.go| index daf5e95b..ed100113 100644 |
| --- a/internal/thintest/worker_connections_fix1_contract_test.go |
| +++ b/internal/thintest/worker_connections_fix1_contract_test.go |
| @@ -46,6 +46,16 @@ func handshakeHello() wire.Hello { |
| return h |
| } |
| +// syncNow sends a sync and waits until the instance has applied it. A |
| +// sync is not durable, so nothing acks it; the instance applies one |
| +// connection's frames in order, so the answer to a lease sent after it |
| +// means the sync is in the store. |
| +func (p *peer) syncNow(s wire.Sync) { |
| + p.t.Helper() |
| + p.send(wire.FrameSync, s) |
| + p.lease("", 0) |
| +} |
| + |
| // workerSync is a worker's sync after the welcome, saying conns. |
| func workerSync(conns ...wire.HeldConnection) wire.Sync { |
| return wire.Sync{Sessions: []wire.SessionState{}, Runs: []wire.Run{}, Steps: []wire.StepRun{}, Asks: []wire.AskRun{}, Connections: append([]wire.HeldConnection{}, conns...)} |
| @@ -88,7 +98,7 @@ func TestContractWorkerReconnectKeepsHold(t *testing.T) { |
| w = r.redialMac(w, handshakeHello()) |
| w.lease("", 0) |
| stillThere("the hello before the welcome") |
| - w.send(wire.FrameSync, workerSync(claude1)) |
| + w.syncNow(workerSync(claude1)) |
| stillThere("the sync") |
| w.heartbeat(inventoryHello(key, holds, claude1)) |
| stillThere("the full hello") |
| @@ -138,7 +148,7 @@ func TestContractWorkerReconnectKeepsHold(t *testing.T) { |
| if !r.heldNow(wid) { |
| t.Fatal("the hello before the welcome released the hold") |
| } |
| - w.send(wire.FrameSync, workerSync()) |
| + w.syncNow(workerSync()) |
| if !r.heldNow(wid) { |
| t.Fatal("an empty sync released the hold") |
| } |
| @@ -165,11 +175,11 @@ func TestContractWorkerSyncHolds(t *testing.T) { |
| if r.heldNow(wid) { |
| t.Fatal("held with nothing there") |
| } |
| - w.send(wire.FrameSync, workerSync(wire.HeldConnection{LocalID: "claude-2", Person: Owner, Provider: wire.ProviderClaude, Kind: wire.KindToken, State: wire.ConnHealthy})) |
| + w.syncNow(workerSync(wire.HeldConnection{LocalID: "claude-2", Person: Owner, Provider: wire.ProviderClaude, Kind: wire.KindToken, State: wire.ConnHealthy})) |
| if c, ok := r.connRow(wid, "claude-2"); !ok || c.State != wire.ConnHealthy || !r.heldNow(wid) { |
| t.Fatalf("after the sync: %+v %v held=%v", c, ok, r.heldNow(wid)) |
| } |
| - w.send(wire.FrameSync, workerSync()) |
| + w.syncNow(workerSync()) |
| if c, _ := r.connRow(wid, "claude-2"); c.State != wire.ConnHealthy || !r.heldNow(wid) { |
| t.Fatalf("an empty sync: row %s, held=%v", c.State, r.heldNow(wid)) |
| } |
diff --git a/internal/wire/tasks.go b/internal/wire/tasks.go| index 9843662f..662010c7 100644 |
| --- a/internal/wire/tasks.go |
| +++ b/internal/wire/tasks.go |
| @@ -326,6 +326,10 @@ type Step struct { |
| // as having a model credential (SandboxChoiceHeld); absent when |
| // neither is known. |
| SandboxChoice string `json:"sandbox_choice,omitempty"` |
| + // WaitingFor is the id of the runner a step placed nowhere waits for |
| + // (a Mac's sandbox, its Claude connection or update, its base): |
| + // RunnerLabel names it. Absent once the step is placed. |
| + WaitingFor string `json:"waiting_for,omitempty"` |
| // MadeOn names the worker an Engineering attempt ran on, when it is |
| // not the person's main runner; XcodeAccess is what that attempt got |
| // of Xcode's services (sandboxed, or "" for none: the Mac's checks |