oficina / equipo Public

Merge origin/main (mac-placement-wait) into mac-slice-f

Main now holds mac-placement-wait, squash-merged as 207d3237. Slice F
took that branch in at task 0 (74140828), so the new parts are its
later commits: retired Apple rounds, the older-primary recheck, no
start for a cancelled task, and the copy reviews. Conflicts went to
main, then slice F was put back on top.

Code:
- chat/runners.go: checksNeeds takes main's retired-round filter.
  Slice F's engineeringPlace and placeEngineering stay, replacing
  main's macEngineering. restartMacEngineering keeps slice F's test
  (does placement still put the attempt on its runner?) and adds
  main's rule: a finished or cancelled task's attempt is refused but
  not replaced. Main's recheckMacEngineering is added as it is.
  waitingPlacements keeps slice F's longer list.
- chat/runner.go: the heartbeat runs main's older-primary recheck in
  the primary branch, then slice F's workerHello for workers. Connect's
  recheck merged cleanly.
- explore.go, review.go, work_pages.go, work_views.go, headless
  mac_test.go and merge_test.go: these only added mac-placement-wait
  code that slice F already had (an older copy of it). Slice F's
  version is kept: its Mac Engineering needs, names and the M9f switch.
- chat/mac_needs_test.go and thintest/mac_wait_contract_test.go:
  main's new cases (tk3 retired round, older primary, delivered
  attempt, cancelled task) are taken as they are. They pass against
  slice F's placement.

Copy (by key):
- work.decide.mac_runner_why, mac_runner_ask, mac_engineering_why and
  mac_engineering_ask: main's text and main's COPY APPROVED (Paul,
  2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq) marker and
  inventory rows. Slice F task 15's rewording of the two
  mac_engineering lines is dropped.
  mac_engineering_views_test now checks the why against that copy key,
  not for "switched off".
- work.needs.mac_engineering: slice F's text, "Needs you: this change
  needs a Mac, and making changes on a Mac is switched off". Paul
  approved it unedited on 2026-11-29 (review
  d62qn3bsdsvg6g2c42p2t3ptqm). It replaces main's older text.
- work.needs.mac_runner: also kept as slice F's text, "... and no Mac
  runner is added yet", not main's Luna text "has been added yet"
  (2026-11-28). The brief did not rule on this key. Paul's own
  review of 2026-11-29 approved this exact text, and it is later than
  Luna's.
- work.waits.mac_runner and mac_engineering: both sides had the same
  text, so main's Luna marker is kept.
- The slice F copy JSON entries for these keys now give the text that
  ships and where it came from. The two needs lines stay pending until
  the next commit marks them.

Numbers: main added no protocol or migration. The protocol stays 37
(ProtocolMacEngineering) and the migration stays 0120.

Bookkeeping: the chat (43032/14845) and thintest (41998) size records
were measured again after the merge. Making the reference scan pass
needed two fixes: the node_old lines were classified with the Mac
runner reason, and one stale probe.go allowance was dropped. Both
problems were already there at 03248d30 (12 failures).

Checks (CGO_ENABLED=0): go build, make vet, the darwin runner build,
make budget, make migration-check and the reference scan (0 failures)
all pass. go test passes for ./internal/equipo/... and ./internal/wire/,
and for thintest run with Mac|Placement|Worker|Prepare|Publication|
Engineering|Cancel|OlderPrimary|Between|Prune|Retry|Checks.

Mutations, each restored:
- A cancelled task's attempt allowed to start:
  TestContractCancelledMacEngineeringDoesNotStart fails.
- No older-primary recheck in the heartbeat:
  TestContractMacEngineeringQueuedOnAnOlderPrimary fails.
- Retired rounds counted: TestChecksNeedAMacForEveryAppleRound fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 5875f30ba7626cb376d7344e9f92d7ab50871ce7 parent 03248d3parent 207d323
12 files changed, +233 −45
  • .rastrillo/budgets.txt +3 −3
  • docs/superpowers/plans/2026-11-28-mac-fixes-copy.md +2 −0
  • docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json +15 −15
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +6 −6
  • internal/equipo/chat/mac_needs_test.go +6 −2
  • internal/equipo/chat/runner.go +10 −0
  • internal/equipo/chat/runners.go +37 −3
  • internal/equipo/copy.go +6 −6
  • internal/equipo/mac_engineering_views_test.go +3 −2
  • internal/plan3test/plan3_release_test.go +3 −1
  • internal/thintest/mac_wait_contract_test.go +72 −0
  • scripts/runner-reference-allowlist.json +70 −7
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index e0a548e0..8730d554 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -30,7 +30,7 @@ size internal/runner/provider 5780 - Fable follow-up gates, preview isolation, p
time internal/plan3test 300s Initial cap for combined browser and runner acceptance; measure at both usable stops.
-size internal/plan3test - 12038 Preview, paused work, Assistant, merge authority, check-db, Assistant files, places, Mac fixes, GitHub App and abilities inventory, direct-card contracts; measured 12038 test lines.
+size internal/plan3test - 12040 Preview, paused work, Assistant, merge authority, check-db, Assistant files, places, Mac fixes, GitHub App and abilities inventory, direct-card contracts, Mac card approvals; measured 12040.
time internal/runner/forge 20s Plan 3 CI repair measured 10.527s for the full package (controller CI 10.407s).
time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full package (controller CI 10.709s);
@@ -57,7 +57,7 @@ perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON
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.
perf GET /api/v1/assistant/abilities skip Assistant person API: bearer-only JSON for Base's Settings line, not a browser screen.
-size internal/equipo/chat 42988 14841 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, replaced primaries, unpublished commits; 42988/14841.
+size internal/equipo/chat 43032 14845 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, replaced primaries, unpublished commits; 43032/14845.
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.
@@ -72,7 +72,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 - 13400 Grant scenarios (#48); sign-in email at 1280 and 390; Assistant files; restart wait; live site waits; card answer; scenario 7; Mac M9, mixed versions; 13400.
-size internal/thintest - 41926 Protocol 31 contracts, 35 diffs, stuck tasks, merges, retries, unfinished work, previews, places, abilities, lookups, go-aheads, Mac Engineering, conns, D1, held reports, commits between primaries; 41926.
+size internal/thintest - 41998 Protocol 31 contracts, 35 diffs, stuck tasks, merges, retries, unfinished work, previews, places, abilities, lookups, go-aheads, Mac Engineering, conns, D1, held reports, commits between primaries; 41998.
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-fixes-copy.md b/docs/superpowers/plans/2026-11-28-mac-fixes-copy.md
index 0a84041f..7c3a381e 100644
--- a/docs/superpowers/plans/2026-11-28-mac-fixes-copy.md
+++ b/docs/superpowers/plans/2026-11-28-mac-fixes-copy.md
@@ -2,6 +2,8 @@
Paul ruled 2026-11-28: Luna (codex gpt-5.6-luna, read-only) reviews all 13 strings of the two Mac fixes; its edits are applied. Paul reviews only the four Needs you card lines he sees in Equipo (`work.decide.mac_runner_why`, `work.decide.mac_runner_ask`, `work.decide.mac_engineering_why`, `work.decide.mac_engineering_ask`): they take Luna's text but stay COPY REVIEW PENDING for him (/home/paulca/.cache/mac-fixes-paul-copy.json). The other nine are COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28): five installer strings on mac-install-safe, four task status and summary strings on mac-placement-wait. Luna changed 9, flagged 0, left 4 unchanged.
+Paul approved the four card lines unchanged on 2026-11-29 (copy review ugmpahjf6nxcpfkjflv35rjoeq, action approve, none edited); they are now COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged).
+
Luna ran in a new scratch directory under `$TMPDIR`, with:
```sh
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 af2a2e91..efd63b95 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
@@ -202,22 +202,22 @@
},
{
"key": "work.needs.mac_runner",
- "where": "From mac-placement-wait (this branch stacks on it), unchanged by slice F: Task line (Needs you), Mac work waiting because no Mac runner is added",
+ "where": "From mac-placement-wait: Task line (Needs you), Mac work waiting because no Mac runner is added",
"draft": "Needs you: this work needs a Mac, and no Mac runner is added yet",
"paul_sees": true,
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29; Paul approved unedited 2026-11-29 (review d62qn3bsdsvg6g2c42p2t3ptqm)"
+ "reviewed": "Slice F's text, kept over main's Luna text (\"no Mac runner has been added yet\", 2026-11-28) at the 207d3237 merge: Luna, delegated (Paul 2026-10-25), 2026-11-29; Paul approved unedited 2026-11-29 (review d62qn3bsdsvg6g2c42p2t3ptqm), the later and his own review"
},
{
"key": "work.decide.mac_runner_why",
- "where": "From mac-placement-wait (this branch stacks on it), unchanged by slice F: Task decision card, why (waiting for a Mac runner)",
- "draft": "This work needs a Mac, and no Mac runner is added to your team yet. It waits instead of running on Linux.",
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29"
+ "where": "From main (mac-placement-wait, squash-merged 207d3237): Task decision card, why (waiting for a Mac runner)",
+ "draft": "This work needs a Mac, and your team has no Mac runner yet. It waits instead of running on Linux.",
+ "reviewed": "Main's text and marker (207d3237): Luna's draft, Paul approved unchanged 2026-11-29 (copy-review ugmpahjf6nxcpfkjflv35rjoeq); slice F task 15's rewording dropped at the merge"
},
{
"key": "work.decide.mac_runner_ask",
- "where": "From mac-placement-wait (this branch stacks on it), unchanged by slice F: Task decision card, ask (waiting for a Mac runner)",
- "draft": "Add a Mac runner and it starts by itself.",
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29"
+ "where": "From main (mac-placement-wait, squash-merged 207d3237): Task decision card, ask (waiting for a Mac runner)",
+ "draft": "Add a Mac runner and the work starts by itself.",
+ "reviewed": "Main's text and marker (207d3237): Luna's draft, Paul approved unchanged 2026-11-29 (copy-review ugmpahjf6nxcpfkjflv35rjoeq); slice F task 15's rewording dropped at the merge"
},
{
"key": "work.waits.mac_runner",
@@ -230,19 +230,19 @@
"where": "Task line (Needs you), Mac Engineering waiting because making changes on a Mac is switched off on the instance (EQUIPO_MAC_ENGINEERING off, waiting_mac_engineering). Rewritten by slice F task 15: the mac-placement-wait draft said Mac runners can't make changes, which slice F makes untrue",
"draft": "Needs you: this change needs a Mac, and making changes on a Mac is switched off",
"paul_sees": true,
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29; Paul approved unedited 2026-11-29 (review d62qn3bsdsvg6g2c42p2t3ptqm)"
+ "reviewed": "Slice F's text, kept over main's older Luna text (\"Mac runners can’t make changes yet\", 2026-11-28) at the 207d3237 merge: Luna, delegated (Paul 2026-10-25), 2026-11-29; Paul approved unedited 2026-11-29 (review d62qn3bsdsvg6g2c42p2t3ptqm)"
},
{
"key": "work.decide.mac_engineering_why",
- "where": "Task decision card, why, same switched-off case (waiting_mac_engineering). Rewritten by slice F task 15 for the switch-off case",
- "draft": "This change needs a Mac. Making changes on a Mac is switched off for now, so it waits instead of being made on Linux.",
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29"
+ "where": "From main (mac-placement-wait, squash-merged 207d3237): Task decision card, why, same switched-off case (waiting_mac_engineering)",
+ "draft": "This change needs a Mac. Your Mac runner can run checks but can’t make changes yet, so it waits instead of running on Linux.",
+ "reviewed": "Main's text and marker (207d3237): Luna's draft, Paul approved unchanged 2026-11-29 (copy-review ugmpahjf6nxcpfkjflv35rjoeq); slice F task 15's rewording dropped at the merge"
},
{
"key": "work.decide.mac_engineering_ask",
- "where": "From mac-placement-wait (this branch stacks on it), unchanged by slice F: Task decision card, ask, same switched-off case",
- "draft": "Leave it waiting, or cancel it.",
- "reviewed": "Luna, delegated (Paul 2026-10-25), 2026-11-29"
+ "where": "From main (mac-placement-wait, squash-merged 207d3237): Task decision card, ask, same switched-off case",
+ "draft": "Leave it waiting or cancel it.",
+ "reviewed": "Main's text and marker (207d3237): Luna's draft, Paul approved unchanged 2026-11-29 (copy-review ugmpahjf6nxcpfkjflv35rjoeq); slice F task 15's rewording dropped at the merge"
},
{
"key": "work.waits.mac_engineering",
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 8cd718c9..9391084b 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -7023,12 +7023,12 @@ records remain unchanged.
| `places.deploy_none` | No deploy key yet: the first publish makes one. | Places slice 1, Places page (Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26) |
| `work.needs.mac_runner` | Needs you: this work needs a Mac, and no Mac runner is added yet | Copy specialist | COPY REVIEW PENDING |
| `work.needs.mac_engineering` | Needs you: this change needs a Mac, and making changes on a Mac is switched off | Copy specialist | COPY REVIEW PENDING |
-| `work.decide.mac_runner_why` | This work needs a Mac, and no Mac runner is added to your team yet. It waits instead of running on Linux. | Copy specialist | COPY REVIEW PENDING |
-| `work.decide.mac_runner_ask` | Add a Mac runner and it starts by itself. | Copy specialist | COPY REVIEW PENDING |
-| `work.decide.mac_engineering_why` | This change needs a Mac. Making changes on a Mac is switched off for now, so it waits instead of being made on Linux. | Copy specialist | COPY REVIEW PENDING |
-| `work.decide.mac_engineering_ask` | Leave it waiting, or cancel it. | Copy specialist | COPY REVIEW PENDING |
-| `work.waits.mac_runner` | It needs a Mac runner | Copy specialist | COPY REVIEW PENDING |
-| `work.waits.mac_engineering` | It needs a Mac that can make changes | Copy specialist | COPY REVIEW PENDING |
+| `work.decide.mac_runner_why` | This work needs a Mac, and your team has no Mac runner yet. It waits instead of running on Linux. | Mac work waits for a Mac, Needs you card (Luna draft) | Runtime; COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged) |
+| `work.decide.mac_runner_ask` | Add a Mac runner and the work starts by itself. | Mac work waits for a Mac, Needs you card (Luna draft) | Runtime; COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged) |
+| `work.decide.mac_engineering_why` | This change needs a Mac. Your Mac runner can run checks but can’t make changes yet, so it waits instead of running on Linux. | Mac work waits for a Mac, Needs you card (Luna draft) | Runtime; COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged) |
+| `work.decide.mac_engineering_ask` | Leave it waiting or cancel it. | Mac work waits for a Mac, Needs you card (Luna draft) | Runtime; COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged) |
+| `work.waits.mac_runner` | It needs a Mac runner | Mac fixes 2026-11-28 (Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28) |
+| `work.waits.mac_engineering` | It needs a Mac that can make changes | Mac fixes 2026-11-28 (Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28) |
| `work.needs.mac_connection` | Needs you: %s needs Claude to make this change | Copy specialist | COPY REVIEW PENDING |
| `work.needs.mac_update` | Needs you: %s needs an update to make changes | Copy specialist | COPY REVIEW PENDING |
| `work.decide.mac_connection_why.no_connection` | This change needs a Mac. %s is ready, but it has no Claude connection yet. | Copy specialist | COPY REVIEW PENDING |
diff --git a/internal/equipo/chat/mac_needs_test.go b/internal/equipo/chat/mac_needs_test.go
index 261a123f..4f8afa92 100644
--- a/internal/equipo/chat/mac_needs_test.go
+++ b/internal/equipo/chat/mac_needs_test.go
@@ -45,7 +45,7 @@ func TestChecksNeedAMacForEveryAppleRound(t *testing.T) {
if err := d.G.Create(&projectRecord{ID: "p1", Repo: "oficina/sample"}).Error; err != nil {
t.Fatal(err)
}
- for _, k := range []taskRecord{{ID: "tk1", ProjectID: "p1", Creator: person, Stage: wire.StageInProgress, Revision: 1, CreatedAt: now, UpdatedAt: now}, {ID: "tk2", ProjectID: "p1", Creator: person, Stage: wire.StageInProgress, Revision: 1, CreatedAt: now, UpdatedAt: now}} {
+ for _, k := range []taskRecord{{ID: "tk1", ProjectID: "p1", Creator: person, Stage: wire.StageInProgress, Revision: 1, CreatedAt: now, UpdatedAt: now}, {ID: "tk2", ProjectID: "p1", Creator: person, Stage: wire.StageInProgress, Revision: 1, CreatedAt: now, UpdatedAt: now}, {ID: "tk3", ProjectID: "p1", Creator: person, Stage: wire.StageInProgress, Revision: 1, CreatedAt: now, UpdatedAt: now}} {
if err := d.G.Create(&k).Error; err != nil {
t.Fatal(err)
}
@@ -55,6 +55,10 @@ func TestChecksNeedAMacForEveryAppleRound(t *testing.T) {
{ID: "c1", TaskID: "tk1", Idx: 2, Specialist: wire.SpecialistCopy, Person: person, State: wire.StepDone, Round: 1, CandidateSHA: sha("b")},
{ID: "e2", TaskID: "tk1", Idx: 3, Specialist: wire.SpecialistEngineering, Person: person, State: wire.StepDone, Round: 2, CandidateSHA: sha("c")},
{ID: "e3", TaskID: "tk2", Idx: 1, Specialist: wire.SpecialistEngineering, Person: person, State: wire.StepDone, Round: 1, CandidateSHA: sha("d")},
+ // Moved to another project: the Swift change was retired with
+ // the old project's steps, and the new branch touched README only.
+ {ID: "e4", TaskID: "tk3", Idx: 1, Specialist: wire.SpecialistEngineering, Person: person, State: wire.StepDone, Round: 1, CandidateSHA: sha("e"), Apple: true, Retired: true},
+ {ID: "e5", TaskID: "tk3", Idx: 2, Specialist: wire.SpecialistEngineering, Person: person, State: wire.StepDone, Round: 1, CandidateSHA: sha("f")},
} {
if err := d.G.Create(&st).Error; err != nil {
t.Fatal(err)
@@ -63,7 +67,7 @@ func TestChecksNeedAMacForEveryAppleRound(t *testing.T) {
for _, c := range []struct {
task, candidate string
mac bool
- }{{"tk1", sha("a"), true}, {"tk1", sha("b"), true}, {"tk1", sha("c"), true}, {"tk2", sha("d"), false}} {
+ }{{"tk1", sha("a"), true}, {"tk1", sha("b"), true}, {"tk1", sha("c"), true}, {"tk2", sha("d"), false}, {"tk3", sha("f"), false}} {
var needs []string
err := s.tx(context.Background(), func(t *txn) error {
k, err := t.loadTask(c.task)
diff --git a/internal/equipo/chat/runner.go b/internal/equipo/chat/runner.go
index 6590c776..11f3df4e 100644
--- a/internal/equipo/chat/runner.go
+++ b/internal/equipo/chat/runner.go
@@ -155,6 +155,9 @@ func (s *Store) Connect(ctx context.Context, p RunnerPrincipal, process string,
if err := t.placeWaiting(p.Person); err != nil {
return err
}
+ if err := t.recheckMacEngineering(p.RunnerID); err != nil {
+ return err
+ }
return t.recheckMac(p.Person, p.RunnerID)
})
return lease, err
@@ -249,6 +252,13 @@ func (s *Store) Heartbeat(ctx context.Context, l Lease, hello wire.Hello) error
return err
}
}
+ // An older primary asks for no start authorization: its queued
+ // Engineering is looked at again with each catalog it sends.
+ if hello.Protocol < wire.Protocol2 {
+ if err := t.recheckMacEngineering(l.Runner.RunnerID); err != nil {
+ return err
+ }
+ }
} else if err := t.workerHello(l, hello, false); err != nil {
return err
}
diff --git a/internal/equipo/chat/runners.go b/internal/equipo/chat/runners.go
index 76ba0e9c..be1f9b4e 100644
--- a/internal/equipo/chat/runners.go
+++ b/internal/equipo/chat/runners.go
@@ -399,10 +399,11 @@ const reasonRunnerOffline = "runner_offline"
// iOS simulator when the repository has a shared scheme. The change is
// every Engineering round of the task, not only the one whose commit is
// the candidate: a later round, or a delegated Copy commit, makes a new
-// candidate that still holds an earlier round's Apple files.
+// candidate that still holds an earlier round's Apple files. Retired
+// rounds (a task moved to another project) are not the candidate's.
func (t *txn) checksNeeds(k taskRecord, s stepRecord) ([]string, error) {
var apple int64
- if err := t.db.Model(&stepRecord{}).Where("task_id = ? AND specialist = ? AND apple = ?", k.ID, wire.SpecialistEngineering, true).Count(&apple).Error; err != nil {
+ if err := t.db.Model(&stepRecord{}).Where("task_id = ? AND specialist = ? AND apple = ? AND coalesce(retired, 0) = 0", k.ID, wire.SpecialistEngineering, true).Count(&apple).Error; err != nil {
return nil, err
}
info, err := t.repoInfo(k, s.Person)
@@ -800,7 +801,9 @@ func macFor(r runnerInfo, tags []string) bool {
// restartMacEngineering: whether the unstarted Engineering attempt s is
// not where placement would put it now (Mac work its runner cannot take,
// or a worker that can no longer take it); if so the attempt is ended and
-// the next one placed (it waits, or goes where it now fits).
+// the next one placed (it waits, or goes where it now fits). A finished
+// or cancelled task's attempt is not replaced (its cancellation is on
+// the way), but it does not start either.
func (t *txn) restartMacEngineering(s *stepRecord) (bool, error) {
k, err := t.loadTask(s.TaskID)
if err != nil {
@@ -814,12 +817,43 @@ func (t *txn) restartMacEngineering(s *stepRecord) (bool, error) {
if err != nil || d.runner == s.RunnerID {
return false, err
}
+ if wire.FinalStage(k.Stage) || k.CancelRequested {
+ return true, nil
+ }
if err := t.replace(&k, s); err != nil {
return false, err
}
return true, t.saveStep(s, &k)
}
+// recheckMacEngineering places again the runner's queued Engineering
+// attempts that are Mac work it cannot take and that it has not been
+// given yet (the dispatch not acknowledged): one queued before Mac work
+// waited for a Mac, or before the catalog said the gate needs Xcode. A
+// protocol 2 runner's start authorization checks the ones it was given;
+// an older runner asks for none, and one it holds is left with it, as
+// before, rather than lose track of an attempt it may run.
+func (t *txn) recheckMacEngineering(runner string) error {
+ var rows []stepRecord
+ if err := t.db.Where("runner_id = ? AND specialist = ? AND state = ? AND started_at IS NULL AND coalesce(withdrawn, 0) = 0", runner, wire.SpecialistEngineering, wire.StepQueued).Find(&rows).Error; err != nil {
+ return err
+ }
+ for i := range rows {
+ s := rows[i]
+ var undelivered int64
+ if err := t.db.Model(&commandRecord{}).Where("runner_id = ? AND kind = ? AND acked_at IS NULL AND body LIKE ?", s.RunnerID, wire.FrameDispatch, `%"step_id":"`+s.ID+`","attempt":`+itoa64(s.Attempt)+`,%`).Count(&undelivered).Error; err != nil {
+ return err
+ }
+ if undelivered == 0 {
+ continue
+ }
+ if _, err := t.restartMacEngineering(&s); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// replace ends the current attempt's placement and places the next one:
// after a refusal, a withdrawal before it started, or a withdrawn
// attempt's termination. The caller saves s.
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 65a61b6e..de1df3c8 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1766,12 +1766,12 @@ var pageCopy = map[string]string{
"work.decide.sandbox_ask": "Wait, or run them outside the sandbox?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"work.needs.mac_runner": "Needs you: this work needs a Mac, and no Mac runner is added yet", // COPY REVIEW PENDING
"work.needs.mac_engineering": "Needs you: this change needs a Mac, and making changes on a Mac is switched off", // COPY REVIEW PENDING
- "work.decide.mac_runner_why": "This work needs a Mac, and no Mac runner is added to your team yet. It waits instead of running on Linux.", // COPY REVIEW PENDING
- "work.decide.mac_runner_ask": "Add a Mac runner and it starts by itself.", // COPY REVIEW PENDING
- "work.decide.mac_engineering_why": "This change needs a Mac. Making changes on a Mac is switched off for now, so it waits instead of being made on Linux.", // COPY REVIEW PENDING
- "work.decide.mac_engineering_ask": "Leave it waiting, or cancel it.", // COPY REVIEW PENDING
- "work.waits.mac_runner": "It needs a Mac runner", // COPY REVIEW PENDING
- "work.waits.mac_engineering": "It needs a Mac that can make changes", // COPY REVIEW PENDING
+ "work.decide.mac_runner_why": "This work needs a Mac, and your team has no Mac runner yet. It waits instead of running on Linux.", // COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)
+ "work.decide.mac_runner_ask": "Add a Mac runner and the work starts by itself.", // COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)
+ "work.decide.mac_engineering_why": "This change needs a Mac. Your Mac runner can run checks but can’t make changes yet, so it waits instead of running on Linux.", // COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)
+ "work.decide.mac_engineering_ask": "Leave it waiting or cancel it.", // COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)
+ "work.waits.mac_runner": "It needs a Mac runner", // COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28)
+ "work.waits.mac_engineering": "It needs a Mac that can make changes", // COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28)
"work.decide.unsandboxed": "Run outside the sandbox", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"work.decide.unsandboxed_warning": "This runs the checks on %s outside the sandbox. They can read anything that account can. The Mac is then marked tainted.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"work.decide.unsandboxed_confirm": "Run them outside the sandbox", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
diff --git a/internal/equipo/mac_engineering_views_test.go b/internal/equipo/mac_engineering_views_test.go
index 8a82b740..c5e20b5f 100644
--- a/internal/equipo/mac_engineering_views_test.go
+++ b/internal/equipo/mac_engineering_views_test.go
@@ -93,13 +93,14 @@ func TestMacEngineeringViews(t *testing.T) {
if d := decisionOf(task, v); d.Unsandboxed != nil {
t.Fatalf("offered without the instance's word: %+v", d)
}
- // The switched-off case says it is switched off, not that Macs cannot.
+ // The switched-off case's line says it is switched off, not that Macs
+ // cannot. Its card's why is main's approved text (207d3237).
task = wire.Task{ID: "t1", Creator: me, Stage: wire.StageInProgress, NeedsYou: wire.NeedsMacEngineering, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, State: wire.StepQueued, Placement: wire.PlacementMacEngineering, Attempt: 1}}}
v = taskLineOf(task, me)
if v.StageLine != copyText("work.needs.mac_engineering") || !strings.Contains(v.StageLine, "switched off") {
t.Fatalf("switch off: %q", v.StageLine)
}
- if d := decisionOf(task, v); !strings.Contains(d.Why, "switched off") {
+ if d := decisionOf(task, v); d.Why != copyText("work.decide.mac_engineering_why") {
t.Fatalf("switch off why %q", d.Why)
}
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go
index 4f7a184f..0ec208ae 100644
--- a/internal/plan3test/plan3_release_test.go
+++ b/internal/plan3test/plan3_release_test.go
@@ -229,10 +229,12 @@ func plan3CopyInventory(t *testing.T) {
approvedPlaces := slices.Contains([]string{"chat.card.place_question", "chat.card.place_option", "chat.card.place_chose", "chat.card.place_chose_not_now", "chat.card.publish_place_question", "chat.card.publish_setup_note", "chat.card.publish_mint_note", "chat.card.publish_stale"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-26, copy-review iic5rwpyavu7rnhiuvx7cnedzm, unchanged)")
// Luna's review of the Mac fixes' installer and task lines (Paul, 2026-11-28: Luna reviews all but the four Needs you card lines, which stay his).
acceptedMacFixes := slices.Contains([]string{"runner.mac.other_instance", "runner.install.other_instance", "runner.enrol.identity", "runner.mac.restored", "runner.mac.not_restored", "work.needs.mac_runner", "work.needs.mac_engineering", "work.waits.mac_runner", "work.waits.mac_engineering"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-28)"
+ // Paul's own review of the four Mac Needs you card lines (2026-11-29).
+ approvedMacCards := slices.Contains([]string{"work.decide.mac_runner_why", "work.decide.mac_runner_ask", "work.decide.mac_engineering_why", "work.decide.mac_engineering_ask"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-29, copy-review ugmpahjf6nxcpfkjflv35rjoeq, unchanged)")
acceptedCopy := strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Copy, record-bound) sha256:"+copydesk.Hash(rows[key])
// Paul's own review of the Assistant abilities strings (2026-11-28).
approvedAbilities := slices.Contains([]string{"assistant.ability.web.name", "assistant.ability.apps_read.name", "assistant.ability.apps_write.name", "assistant.ability.build.name", "assistant.ability.go_live.name", "assistant.ability.services.name", "assistant.ability.services_add.name", "assistant.job.detail.ability_off", "assistant.job.detail.ability_back", "assistant.job.detail.go_live_off", "chat.card.ability_off", "oficina.connect.ability_off", "services.inventory.question", "services.inventory.confirm", "assistant.activity.lookup", "assistant.lookup.fallback_sources"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)")
- if !approvedAbilities && !acceptedMacFixes && !acceptedGitHubApp && !acceptedGitHubSweep && !approvedPlaces && !acceptedPlaces && !acceptedAskFiles && !acceptedDBCheck && !acceptedPreview && !approvedNoAccess && !approvedMergeCredential && !approvedStuckTasks && !acceptedPaused && !acceptedNewTeamCard && !acceptedGitHubEgress && !acceptedForgeSeam && !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons {
+ if !approvedMacCards && !approvedAbilities && !acceptedMacFixes && !acceptedGitHubApp && !acceptedGitHubSweep && !approvedPlaces && !acceptedPlaces && !acceptedAskFiles && !acceptedDBCheck && !acceptedPreview && !approvedNoAccess && !approvedMergeCredential && !approvedStuckTasks && !acceptedPaused && !acceptedNewTeamCard && !acceptedGitHubEgress && !acceptedForgeSeam && !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons {
t.Fatal("entry has no copy review status or applicable acceptance", key)
}
}
diff --git a/internal/thintest/mac_wait_contract_test.go b/internal/thintest/mac_wait_contract_test.go
index 776fcba3..06e7bdf9 100644
--- a/internal/thintest/mac_wait_contract_test.go
+++ b/internal/thintest/mac_wait_contract_test.go
@@ -242,3 +242,75 @@ func TestContractExplorationWaitsForAMac(t *testing.T) {
t.Fatalf("not cancelled: %+v %v", k, err)
}
}
+
+// An older primary asks for no start authorization: Engineering queued
+// for it before Mac work waited for a Mac (or before the catalog said the
+// gate needs Xcode) is placed again when it says hello, and its old
+// dispatch is not served again (Astra round 2, mac-placement-wait).
+func TestContractMacEngineeringQueuedOnAnOlderPrimary(t *testing.T) {
+ r := newToolRig(t)
+ p := &peer{t: t, r: r, fr: r.runner}
+ task := taskID(t, r.call("c-oq", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Mac app", "brief": "b"}))
+ r.call("s-oq", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"})
+ if n := r.heldKinds(wire.FrameDispatch); n != 1 {
+ t.Fatalf("%d engineering dispatches", n)
+ }
+ h := toolHello(0)
+ h.Catalog[0].NeedsMacOS = true
+ p.heartbeat(h)
+ k, err := r.client.Task(r.ctx, task)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, s := range k.Steps {
+ if s.Specialist == wire.SpecialistEngineering && (s.State != wire.StepQueued || s.Placement != wire.PlacementMac || s.Attempt != 2) {
+ t.Fatalf("queued Mac engineering left on the older primary: %+v", s)
+ }
+ }
+ if k.NeedsYou != wire.NeedsMacRunner {
+ t.Fatalf("needs you %q", k.NeedsYou)
+ }
+}
+
+// A delivered dispatch is left to the older primary that holds it: only
+// one it has not received is placed again, so no attempt it may already
+// run is lost track of (Astra round 3, mac-placement-wait).
+func TestContractMacEngineeringDeliveredToAnOlderPrimary(t *testing.T) {
+ r := newToolRig(t)
+ p := &peer{t: t, r: r, fr: r.runner}
+ task := taskID(t, r.call("c-od", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Mac app", "brief": "b"}))
+ r.call("s-od", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"})
+ _, body := r.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ h := toolHello(0)
+ h.Catalog[0].NeedsMacOS = true
+ p.heartbeat(h)
+ k, err := r.client.Task(r.ctx, task)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, s := range k.Steps {
+ if s.Specialist == wire.SpecialistEngineering && (s.ID != d.StepID || s.Attempt != d.Attempt || s.Placement != "") {
+ t.Fatalf("a delivered attempt was replaced: %+v", s)
+ }
+ }
+}
+
+// A cancelled task's Mac Engineering is not let start on the Linux
+// primary while its cancellation is on the way.
+func TestContractCancelledMacEngineeringDoesNotStart(t *testing.T) {
+ r := newRunnersRig(t)
+ task := taskID(t, r.call("c-cx", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Mac app", "brief": "b"}))
+ r.call("s-cx", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"})
+ _, body := r.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ h := primaryHello(0)
+ h.Catalog[0].NeedsMacOS = true
+ r.primary.heartbeat(h)
+ if _, err := r.client.CancelTask(r.ctx, task); err != nil {
+ t.Fatal(err)
+ }
+ if r.primary.lease(d.StepID, d.Attempt) {
+ t.Fatal("a cancelled task's Mac engineering started on the Linux primary")
+ }
+}
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index f6765736..874c16f8 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -9008,13 +9008,6 @@
"count": 1,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
},
- {
- "path": "internal/runner/mac/probe.go",
- "line_sha256": "205ed031190f9ddb1308fe06f42ad896ba4dbf61c4868dbcfa0da6755ed0664b",
- "match": "node",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
{
"path": "internal/runner/mac/probe.go",
"line_sha256": "7e3f1544a8d1acdd60f8df3bab40c35bf4be3e7261ec930988b737803aa7d7c5",
@@ -22209,5 +22202,75 @@
"match": "node",
"count": 2,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json",
+ "line_sha256": "2a23e32ef724c8a5bbfd9c41c86c261f24efe8b637403ebe2d8d42a4905e026a",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json",
+ "line_sha256": "f315612156aee7e61bebc5f177993df5b0830a1b988999651675386c5c076f19",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json",
+ "line_sha256": "dfb4fa08baf2cc62dff1835ab604f6e3d2be9cf09d2cf0157ec2db3911c4baa6",
+ "match": "node",
+ "count": 2,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json",
+ "line_sha256": "6e1f8f0d573d3734d70beac5aa0b99fdda7f5acbcf2f23afbf413bc45dccb765",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md",
+ "line_sha256": "b366cd12b87f19566f5821afa54631dfd34d5ba69205405e84ccd4244b44c280",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md",
+ "line_sha256": "b366cd12b87f19566f5821afa54631dfd34d5ba69205405e84ccd4244b44c280",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/equipo/copy.go",
+ "line_sha256": "46e01b5409246486db48e3a6639d170f66c164337e92921e2de1eb52b7fafeaa",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/equipo/copy.go",
+ "line_sha256": "46e01b5409246486db48e3a6639d170f66c164337e92921e2de1eb52b7fafeaa",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/runner/mac/probe.go",
+ "line_sha256": "4fd775649813327bf0918e4472d1ee31b57ffa9be55295e052562c0c0c550d8b",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/wire/probe_detail.go",
+ "line_sha256": "11d0f66279fc01ba799f3e9aeb34de5c7ea3e2c1fe351154094b427fbb83c50c",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
}
]