oficina / equipo Public

placement: Mac work waits for a Mac runner instead of running on Linux

Task tkdn6i2ex2xj (Mac sidebar, 2026-11-28) ran entirely on docs-t1:
Engineering always went to the primary, and its checks, needing
macOS with no runner that fits, went to the primary too, which said
needs_macos; review judged it alone and it reached ready_to_merge.

- Checks that need macOS (Engineering's Apple files, or the base's
  gate needing Xcode) with no enrolled runner that fits now wait:
  placement waiting_mac, no dispatch, not ended by the 30-minute
  offline limit, placed by placeWaiting when a fitting runner says
  hello (enrols or reconnects). Offline-but-enrolled is unchanged
  (waiting_runner, then runner_offline). An older primary
  (protocol 1, no relay) still judges needs_macos as before.
- Engineering is Mac work when the primary's catalog of the base
  says the repository's gate needs Xcode (RepoInfo.NeedsMacOS). It
  never runs on a Linux primary: with no Mac enrolled it waits
  (waiting_mac); with one enrolled it still waits
  (waiting_mac_engineering), because a Mac worker refuses every
  specialist but Checks until slice F (thin/worker.go,
  placement_refused). Non-Mac work is unchanged.
- needsYou: mac_runner and mac_engineering, so the creator sees it
  under Needs you; the decision says why (Set up a Mac link for
  mac_runner, Cancel), the stage line and the waiting checks line say
  so, and the Coordinator's tool text names the cause.
- Legacy tasks already at needs_macos keep the Wait for a Mac recheck:
  the macrecheck contracts now reach that state through a fixture
  (legacyMacChecks) standing for an instance before this change.
- Eight new strings, COPY REVIEW PENDING (drafts for copy review).

Tests first (red against main): TestContractChecksWaitForAMacRunner,
TestContractMacEngineeringWaits, TestMacWaitNeedsYou; M3
(TestContractChecksWithoutAWorker) rewritten for the new rule.
Mutation checks (each broke one guard, ran the test, restored):
P1 checks to the primary again: ChecksWaitForAMacRunner FAIL
P2 waiting_mac not resumed on hello: ChecksWaitForAMacRunner FAIL
P3 waiting_mac ended by the offline limit: ChecksWaitForAMacRunner FAIL
P4 Mac Engineering on Linux: MacEngineeringWaits FAIL
P5 Mac enrolled, Engineering to the primary: MacEngineeringWaits FAIL
P6 no needs-you: ChecksWaitForAMacRunner FAIL
P7 not under Needs you: TestMacWaitNeedsYou FAIL
P8 no Set up a Mac link: TestMacWaitNeedsYou FAIL
P9 waiting checks read as running: TestMacWaitNeedsYou FAIL

Local: go test ./internal/thintest ./internal/equipo
./internal/equipo/chat ./internal/wire ./internal/equipo/triage ok;
staticcheck on the changed packages clean; budget size, fmt,
runner-dead-references ok.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e47300057b6a84ef3d5bbcfbcd389381510eee7a parent 55e192c
15 files changed, +368 −53
  • .rastrillo/budgets.txt +4 −4
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +8 −0
  • internal/equipo/chat/review.go +6 −0
  • internal/equipo/chat/runners.go +107 −20
  • internal/equipo/chat/tools.go +4 −0
  • internal/equipo/copy.go +8 −0
  • internal/equipo/mac_wait_view_test.go +46 −0
  • internal/equipo/work_pages.go +5 −0
  • internal/equipo/work_views.go +10 −2
  • internal/thintest/mac_wait_contract_test.go +122 −0
  • internal/thintest/macrecheck_contract_test.go +24 −9
  • internal/thintest/macrecheck_mergeauth_contract_test.go +2 −6
  • internal/thintest/placement_contract_test.go +6 −9
  • internal/wire/runners.go +10 −3
  • internal/wire/tasks.go +6 −0

CI cancelled — superseded by a newer push — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/mac-placement-wait: Type  Size Avail | ext4   96G   86G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   86G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 2.5s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.4s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.4s
ci-box: opencode: installed and verified in 2.1s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 9.7s
ci-box: clone deepened in 4.9s
ci-box: file times set from content: 3284 files, 213 directories
ci-box: ready in 18.2s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipotest	0.152s
=== compile ===
go build ./...

amadan: job cancelled — a newer push superseded it
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index f8c47b83..e1fbdd48 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 23925 - Preview grants, retry/timeline, no-access merges, kept work, check-db copy, notification actions, places page and its superseded card, GitHub owner routes; measured 23925 source lines.
-size internal/wire 8171 - Protocol 31 facts, 32 unfinished work, task evidence, CI units, notification inputs, 33 Assistant files, 34 places, 35 diffs; measured 8171 source lines.
+size internal/equipo 23946 - Preview grants, retry/timeline, no-access merges, kept work, check-db copy, notification actions, places page and its superseded card, GitHub owner routes; Mac wait views and copy; measured 23946 source lines.
+size internal/wire 8184 - Protocol 31 facts, 32 unfinished work, task evidence, CI units, notification inputs, 33 Assistant files, 34 places, 35 diffs; Mac wait placements; measured 8184 source lines.
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).
@@ -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 37977 11915 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places and where their cards land, waiting cards; measured 37977/11915.
+size internal/equipo/chat 38074 11915 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places and where their cards land, waiting cards; Mac work waits for a Mac runner; measured 38074/11915.
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 - 11873 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 11873 test lines.
-size internal/thintest - 36971 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places and where their cards land; measured 36971 test lines.
+size internal/thintest - 37101 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places and where their cards land; Mac wait contracts; measured 37101 test lines.
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/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 05cf4945..b908a7a7 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -6997,6 +6997,14 @@ records remain unchanged.
| `places.deploy_held` | Its deploy key is %s. | Places slice 1, Places page (Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26) |
| `places.deploy_lost` | A deploy key named %s may still be live on CARLOS without Equipo holding it. You can revoke it in the CARLOS console. | Places slice 1, Places page (Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26) |
| `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 Mac runners can’t make changes yet | 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. Your Mac runner can run checks but can’t make changes yet, 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 |
## Task 21
diff --git a/internal/equipo/chat/review.go b/internal/equipo/chat/review.go
index 0295c045..88d7b834 100644
--- a/internal/equipo/chat/review.go
+++ b/internal/equipo/chat/review.go
@@ -180,6 +180,12 @@ func (p progress) needsYou(k taskRecord) string {
if p.last.Specialist == wire.SpecialistChecks && p.last.State == wire.StepQueued && p.last.Placement == wire.PlacementSandbox {
return wire.NeedsMacSandbox
}
+ if p.last.State == wire.StepQueued && p.last.Placement == wire.PlacementMac {
+ return wire.NeedsMacRunner
+ }
+ if p.last.State == wire.StepQueued && p.last.Placement == wire.PlacementMacEngineering {
+ return wire.NeedsMacEngineering
+ }
if p.last.Specialist == wire.SpecialistEngineering && p.last.State == wire.StepDone && p.last.Publication == wire.PublicationFailed {
return wire.NeedsRetry
}
diff --git a/internal/equipo/chat/runners.go b/internal/equipo/chat/runners.go
index ac2c8289..f22210aa 100644
--- a/internal/equipo/chat/runners.go
+++ b/internal/equipo/chat/runners.go
@@ -382,28 +382,62 @@ func (t *txn) checksNeeds(k taskRecord, s stepRecord) ([]string, error) {
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return nil, err
}
- var p projectRecord
- if err := t.db.Where("id = ?", k.ProjectID).First(&p).Error; err != nil {
+ info, err := t.repoInfo(k, s.Person)
+ if err != nil {
return nil, err
}
- h, err := t.hello(s.Person)
+ return macNeeds(eng.Apple || info.NeedsMacOS, info), nil
+}
+
+// engineeringNeeds are the tags Engineering of the task needs: macOS and
+// Xcode (and the simulator) when the repository's gate needs Xcode, as
+// the primary's index of its default branch says (the base, not anything
+// the change wrote). Anything else needs nothing.
+func (t *txn) engineeringNeeds(k taskRecord, person string) ([]string, error) {
+ info, err := t.repoInfo(k, person)
if err != nil {
return nil, err
}
+ return macNeeds(info.NeedsMacOS, info), nil
+}
+
+// repoInfo is the primary's catalog entry for the task's repository
+// (zero when it has none).
+func (t *txn) repoInfo(k taskRecord, person string) (wire.RepoInfo, error) {
+ var p projectRecord
+ if err := t.db.Where("id = ?", k.ProjectID).First(&p).Error; err != nil {
+ return wire.RepoInfo{}, err
+ }
+ h, err := t.hello(person)
+ if err != nil {
+ return wire.RepoInfo{}, err
+ }
var info wire.RepoInfo
for _, r := range h.Catalog {
if r.Repo == p.Repo {
info = r
}
}
- if !eng.Apple && !info.NeedsMacOS {
- return []string{}, nil
+ return info, nil
+}
+
+func macNeeds(mac bool, info wire.RepoInfo) []string {
+ if !mac {
+ return []string{}
}
needs := []string{wire.TagMacOS, wire.TagXcode}
if info.Simulator {
needs = append(needs, wire.TagIOSSimulator)
}
- return needs, nil
+ return needs
+}
+
+// waitForMac leaves Mac work waiting (placed false): for a Mac runner to
+// be added (waiting_mac), or, placement, for the reason it names.
+func (t *txn) waitForMac(s *stepRecord, needs []string, placement string) (bool, error) {
+ now := t.now()
+ s.Needs, s.RunnerID, s.Placement, s.WaitingSince = encodeList(needs), "", placement, &now
+ return false, nil
}
func decodeList(raw string) []string {
@@ -423,14 +457,19 @@ func encodeList(v []string) string {
}
// place chooses the runner for a step's current attempt (Mac runners spec
-// §1.4). Only checks are placed by their needs in this release:
-// Engineering, Review and merges run on the primary (Engineering pinned
-// there for the task), as before. Among the person's runners whose tags
-// cover the needs: the primary if it does, else the online worker running
-// fewest steps, ties by enrolment order. A fitting runner that is offline
-// leaves the step waiting (placed false). When no runner has ever had the
-// tags, or the primary cannot relay a pack (protocol 1), the step goes to
-// the primary without needs and ends honestly there (needs_macos). A Mac
+// §1.4). Checks are placed by their needs; Review and merges run on the
+// primary; Engineering runs on the primary (pinned there for the task)
+// unless it is Mac work. Mac work never runs on a Linux primary
+// (2026-11-28): checks that need macOS with no enrolled runner that fits
+// wait for a Mac runner (waiting_mac, the person's to add), and so does
+// Engineering for a repository whose gate needs Xcode; with a Mac
+// enrolled, that Engineering still waits (waiting_mac_engineering), since
+// a Mac worker takes only checks until slice F. Among the person's
+// runners whose tags cover the needs: the primary if it does, else the
+// online worker running fewest steps, ties by enrolment order. A fitting
+// runner that is offline leaves the step waiting (placed false). When the
+// primary cannot relay a pack (protocol 1), the step goes to the primary
+// without needs and ends honestly there (needs_macos), as before. A Mac
// whose sandbox is not proven gets checks only with the person's choice
// for this attempt on it (macsandbox.go); when it is the only one online
// that fits, the step waits for its sandbox (placed false).
@@ -442,6 +481,9 @@ func (t *txn) place(k *taskRecord, s *stepRecord) (placed bool, err error) {
s.Placement, s.WaitingSince, s.SandboxRunner = "", nil, ""
switch s.Specialist {
case wire.SpecialistEngineering:
+ if wait, err := t.macEngineering(k, s, primary); err != nil || wait {
+ return false, err
+ }
s.Needs = ""
s.RunnerID = primary
if k.EngineeringRunner != "" && k.EngineeringRunner != primary {
@@ -495,8 +537,15 @@ func (t *txn) place(k *taskRecord, s *stepRecord) (placed bool, err error) {
fit = append(fit, r)
}
}
- if len(fit) == 0 || !relay {
- // Nobody can: the primary judges it and says why (needs_macos).
+ if len(fit) == 0 && relay {
+ // No runner can, and none is enrolled that could: the checks wait
+ // for a Mac runner instead of the Linux primary judging them
+ // needs_macos.
+ return t.waitForMac(s, needs, wire.PlacementMac)
+ }
+ if !relay {
+ // An older primary cannot relay a pack: it judges and says why
+ // (needs_macos).
return true, nil
}
var chosen, unproven *runnerInfo
@@ -531,6 +580,41 @@ func (t *txn) place(k *taskRecord, s *stepRecord) (placed bool, err error) {
return true, nil
}
+// macEngineering decides whether Engineering of the task is Mac work that
+// must wait rather than run on the Linux primary, and leaves it waiting
+// if so: for a Mac runner when none enrolled fits, else because no runner
+// that fits takes Engineering (only the primary does). An older primary
+// (protocol 1), which has no workers, runs it as before.
+func (t *txn) macEngineering(k *taskRecord, s *stepRecord, primary string) (bool, error) {
+ needs, err := t.engineeringNeeds(*k, s.Person)
+ if err != nil || len(needs) == 0 {
+ return false, err
+ }
+ rs, err := t.runners(s.Person)
+ if err != nil {
+ return false, err
+ }
+ fit := false
+ for _, r := range rs {
+ if r.ID == primary && r.Protocol < wire.Protocol2 {
+ return false, nil
+ }
+ if r.fits(needs, nil) {
+ if r.ID == primary {
+ // A primary that is a Mac takes it.
+ return false, nil
+ }
+ fit = true
+ }
+ }
+ if !fit {
+ _, err := t.waitForMac(s, needs, wire.PlacementMac)
+ return true, err
+ }
+ _, err = t.waitForMac(s, needs, wire.PlacementMacEngineering)
+ return true, err
+}
+
// 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.
@@ -661,12 +745,15 @@ func (s *Store) Authorize(ctx context.Context, l Lease, stepID string, attempt i
return refused, err
}
+// waitingPlacements are the placements of a step waiting to be placed.
+var waitingPlacements = []string{wire.PlacementWaiting, wire.PlacementSandbox, wire.PlacementMac, wire.PlacementMacEngineering}
+
// placeWaiting places the person's steps waiting for a runner, when one
-// that fits may have come online, or for a Mac's sandbox, when it may be
-// proven now.
+// that fits may have come online or been added, or for a Mac's sandbox,
+// when it may be proven now.
func (t *txn) placeWaiting(person string) error {
var rows []stepRecord
- if err := t.db.Where("person = ? AND placement IN ? AND state = ?", person, []string{wire.PlacementWaiting, wire.PlacementSandbox}, wire.StepQueued).Order("created_at").Find(&rows).Error; err != nil {
+ if err := t.db.Where("person = ? AND placement IN ? AND state = ?", person, waitingPlacements, wire.StepQueued).Order("created_at").Find(&rows).Error; err != nil {
return err
}
for i := range rows {
@@ -705,7 +792,7 @@ func (t *txn) placeWaiting(person string) error {
func (s *Store) Place(ctx context.Context) error {
return s.tx(ctx, func(t *txn) error {
var persons []string
- if err := t.db.Model(&stepRecord{}).Where("state IN ? AND (placement IN ? OR runner_id IN (SELECT id FROM runners WHERE role = ?))", []string{wire.StepQueued, wire.StepRunning}, []string{wire.PlacementWaiting, wire.PlacementSandbox}, wire.RoleWorker).Distinct().Pluck("person", &persons).Error; err != nil {
+ if err := t.db.Model(&stepRecord{}).Where("state IN ? AND (placement IN ? OR runner_id IN (SELECT id FROM runners WHERE role = ?))", []string{wire.StepQueued, wire.StepRunning}, waitingPlacements, wire.RoleWorker).Distinct().Pluck("person", &persons).Error; err != nil {
return err
}
for _, p := range persons {
diff --git a/internal/equipo/chat/tools.go b/internal/equipo/chat/tools.go
index 46a863b4..96f9b392 100644
--- a/internal/equipo/chat/tools.go
+++ b/internal/equipo/chat/tools.go
@@ -171,6 +171,10 @@ func blockedLine(cause string) string {
return "they need to bring their computer back online"
case wire.NeedsMacSandbox:
return "they need to let it be tested on their Mac"
+ case wire.NeedsMacRunner:
+ return "it needs a Mac, and they need to add a Mac runner; it will not run on Linux"
+ case wire.NeedsMacEngineering:
+ return "it needs a Mac to make the change, and their Mac runner can only run checks for now; it will not run on Linux"
case causeGoingLive:
return "going live failed, and they need to try it again"
case causeNoAccess:
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 8f658ea9..bea45450 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1758,6 +1758,14 @@ var pageCopy = map[string]string{
"work.checks.waiting_sandbox": "Waiting for the Mac's sandbox", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"work.decide.sandbox_why": "Checks are waiting for the Mac's sandbox. They run automatically once %s passes its sandbox check, unless the Mac is tainted.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"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 Mac runners can’t make changes yet", // 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. Your Mac runner can run checks but can’t make changes yet, 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.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_wait_view_test.go b/internal/equipo/mac_wait_view_test.go
new file mode 100644
index 00000000..cc3b25a3
--- /dev/null
+++ b/internal/equipo/mac_wait_view_test.go
@@ -0,0 +1,46 @@
+package equipo
+
+import (
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Mac work waiting for a Mac runner, or for a Mac that can make changes,
+// is the creator's to see under Needs you (2026-11-28): the decision says
+// why in words, the line says what waits, and a waiting checks step does
+// not read as running. Only the wait for a runner links setting up a Mac.
+func TestMacWaitNeedsYou(t *testing.T) {
+ for _, c := range []struct {
+ need, specialist, placement, why, line, checks string
+ mac bool
+ }{
+ {wire.NeedsMacRunner, wire.SpecialistChecks, wire.PlacementMac, "work.decide.mac_runner_why", "work.needs.mac_runner", "work.chip.waiting_mac", true},
+ {wire.NeedsMacRunner, wire.SpecialistEngineering, wire.PlacementMac, "work.decide.mac_runner_why", "work.needs.mac_runner", "", true},
+ {wire.NeedsMacEngineering, wire.SpecialistEngineering, wire.PlacementMacEngineering, "work.decide.mac_engineering_why", "work.needs.mac_engineering", "", false},
+ } {
+ task := wire.Task{ID: "t1", Creator: "owner@example.com", Stage: wire.StageInProgress, NeedsYou: c.need, Steps: []wire.Step{{ID: "s1", Specialist: c.specialist, State: wire.StepQueued, Placement: c.placement, Attempt: 1}}}
+ if !needsViewer(task, "owner@example.com", nil) || !needsSomeone(task) || groupOf(task, "owner@example.com", nil) != "needs" {
+ t.Fatalf("%s: not under Needs you", c.need)
+ }
+ if needsViewer(task, "other@example.com", nil) {
+ t.Fatalf("%s: someone else's decision", c.need)
+ }
+ v := taskLineOf(task, "owner@example.com")
+ if v.StageLine != copyText(c.line) || copyText(c.line) == "" {
+ t.Fatalf("%s: stage line %q", c.need, v.StageLine)
+ }
+ if c.checks != "" && v.ChecksLine != copyText(c.checks) {
+ t.Fatalf("%s: checks line %q", c.need, v.ChecksLine)
+ }
+ v.Mine, v.Cancel = true, true
+ d := decisionOf(task, v)
+ if d == nil || d.Why != copyText(c.why) || d.Why == "" || d.Ask == "" || d.Mac != c.mac || !d.Cancel {
+ t.Fatalf("%s: decision %+v", c.need, d)
+ }
+ if r := waitReason(task, v); r == "" || strings.HasPrefix(r, "Needs you") {
+ t.Fatalf("%s: wait reason %q", c.need, r)
+ }
+ }
+}
diff --git a/internal/equipo/work_pages.go b/internal/equipo/work_pages.go
index fcd85de5..026f4c2e 100644
--- a/internal/equipo/work_pages.go
+++ b/internal/equipo/work_pages.go
@@ -203,6 +203,9 @@ func taskLineOf(t wire.Task, viewer string) taskLine {
if s.Placement == wire.PlacementSandbox {
v.ChecksLine = copyText("work.checks.waiting_sandbox")
}
+ if s.Placement == wire.PlacementMac {
+ v.ChecksLine = copyText("work.chip.waiting_mac")
+ }
case wire.SpecialistReview:
v.ReviewLine = copyText("work.review.running")
}
@@ -229,6 +232,8 @@ func taskLineOf(t wire.Task, viewer string) taskLine {
v.StageLine = copyText("work.needs." + t.NeedsYou)
case wire.NeedsMacSandbox:
v.StageLine = copyText("work.checks.waiting_sandbox")
+ case wire.NeedsMacRunner, wire.NeedsMacEngineering:
+ v.StageLine = copyText("work.needs." + t.NeedsYou)
case wire.NeedsBranchMoved:
// What was checked and reviewed is not what the branch holds now:
// none of it is shown beside the branch's link.
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go
index e865b8e3..7906d3ba 100644
--- a/internal/equipo/work_views.go
+++ b/internal/equipo/work_views.go
@@ -260,7 +260,7 @@ func needsViewer(t wire.Task, viewer string, card *wire.Card) bool {
return true
}
switch t.NeedsYou {
- case wire.NeedsRetry, wire.NeedsReviewBlocked, wire.NeedsFixRounds, wire.NeedsBranchMoved, wire.NeedsMergeConflict, wire.NeedsMachineRemoved, wire.NeedsMacSandbox, wire.NeedsDirection:
+ case wire.NeedsRetry, wire.NeedsReviewBlocked, wire.NeedsFixRounds, wire.NeedsBranchMoved, wire.NeedsMergeConflict, wire.NeedsMachineRemoved, wire.NeedsMacSandbox, wire.NeedsMacRunner, wire.NeedsMacEngineering, wire.NeedsDirection:
return true
case wire.NeedsMerge, wire.NeedsHeld:
return card != nil
@@ -274,7 +274,7 @@ func needsSomeone(t wire.Task) bool {
return !wire.FinalStage(t.Stage)
}
switch t.NeedsYou {
- case wire.NeedsRetry, wire.NeedsReviewBlocked, wire.NeedsFixRounds, wire.NeedsBranchMoved, wire.NeedsMergeConflict, wire.NeedsMachineRemoved, wire.NeedsMacSandbox, wire.NeedsDirection:
+ case wire.NeedsRetry, wire.NeedsReviewBlocked, wire.NeedsFixRounds, wire.NeedsBranchMoved, wire.NeedsMergeConflict, wire.NeedsMachineRemoved, wire.NeedsMacSandbox, wire.NeedsMacRunner, wire.NeedsMacEngineering, wire.NeedsDirection:
return !wire.FinalStage(t.Stage)
}
return false
@@ -803,6 +803,14 @@ func decisionOf(t wire.Task, v taskLine) *decisionView {
d.Choices = append(d.Choices, decisionChoice{Value: o, Label: copyText("chat.card." + o), Primary: o == wire.ChoiceBuild})
}
}
+ case wire.NeedsMacRunner:
+ // Not a failure: Mac work waits for a Mac runner rather than run on
+ // Linux, and starts by itself once one is added.
+ d.Why, d.Ask, d.Mac, d.Cancel = copyText("work.decide.mac_runner_why"), copyText("work.decide.mac_runner_ask"), true, v.Cancel
+ case wire.NeedsMacEngineering:
+ // A Mac runner takes only checks so far: the change waits, and
+ // never goes to Linux.
+ d.Why, d.Ask, d.Cancel = copyText("work.decide.mac_engineering_why"), copyText("work.decide.mac_engineering_ask"), v.Cancel
case wire.NeedsMacSandbox:
// Not a failure: the checks wait, and run by themselves once the
// Mac's sandbox is proven. Only the creator may choose otherwise.
diff --git a/internal/thintest/mac_wait_contract_test.go b/internal/thintest/mac_wait_contract_test.go
new file mode 100644
index 00000000..8b8d8c70
--- /dev/null
+++ b/internal/thintest/mac_wait_contract_test.go
@@ -0,0 +1,122 @@
+package thintest
+
+import (
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/equipo/chat"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// engineeringStep is the task's first Engineering step.
+func (r *runnersRig) engineeringStep(task string) wire.Step {
+ r.t.Helper()
+ k, err := r.client.Task(r.ctx, task)
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ for _, s := range k.Steps {
+ if s.Specialist == wire.SpecialistEngineering {
+ return s
+ }
+ }
+ r.t.Fatalf("no engineering step: %+v", k.Steps)
+ return wire.Step{}
+}
+
+func (r *runnersRig) needsYou(task string) string {
+ r.t.Helper()
+ k, err := r.client.Task(r.ctx, task)
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ return k.NeedsYou
+}
+
+// Checks that need a Mac, with no Mac runner enrolled, no longer go to the
+// Linux primary to end as needs_macos (task tkdn6i2ex2xj, 2026-11-28: a
+// Mac sidebar change checked and reviewed on docs-t1 alone). They wait,
+// needing the person (a Mac runner), past the offline limit too, and run
+// on the Mac as soon as one enrols.
+func TestContractChecksWaitForAMacRunner(t *testing.T) {
+ r := newRunnersRig(t)
+ task, sha := r.candidate("Mac sidebar", true)
+ r.primary.none(wire.FrameDispatch, 200*time.Millisecond)
+ s := r.checksStep(task)
+ if s.State != wire.StepQueued || s.Placement != wire.PlacementMac || s.RunnerID != "" || strings.Join(s.Needs, ",") != "macos,xcode" {
+ t.Fatalf("checks did not wait for a Mac: %+v", s)
+ }
+ if got := r.needsYou(task); got != wire.NeedsMacRunner {
+ t.Fatalf("needs you %q", got)
+ }
+ clock := time.Now().UTC().Add(chat.OfflineLimit + time.Hour)
+ r.inst.Store.Chat().SetClock(func() time.Time { return clock })
+ if err := r.inst.Store.Chat().Place(r.ctx); err != nil {
+ t.Fatal(err)
+ }
+ if s := r.checksStep(task); s.State != wire.StepQueued || s.Placement != wire.PlacementMac {
+ t.Fatalf("waiting for a Mac ended by the offline limit: %+v", s)
+ }
+ w, _ := r.newWorker("Tito Studio")
+ _, body := w.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ if d.TaskID != task || d.Specialist != wire.SpecialistChecks || d.CandidateSHA != sha || strings.Join(d.Needs, ",") != "macos,xcode" {
+ t.Fatalf("checks on the new Mac: %+v", d)
+ }
+ if s := r.checksStep(task); s.Placement != "" || s.RunnerLabel != "Tito Studio" {
+ t.Fatalf("not placed on the Mac: %+v", s)
+ }
+ if got := r.needsYou(task); got != "" {
+ t.Fatalf("still needs you: %q", got)
+ }
+}
+
+// Engineering for a repository whose gate needs Xcode (the base's
+// catalog says so) never runs on the Linux primary: with no Mac runner it
+// waits for one; with one, it still waits, saying why, because a Mac
+// runner does not take Engineering yet (only checks, until slice F). A
+// repository that needs no Mac is unchanged: Engineering on the primary.
+func TestContractMacEngineeringWaits(t *testing.T) {
+ r := newRunnersRig(t)
+ h := primaryHello(0)
+ h.Catalog[0].NeedsMacOS = true
+ r.primary.heartbeat(h)
+ task := taskID(t, r.call("c-mac", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Mac app", "brief": "b"}))
+ r.call("s-mac", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"})
+ r.primary.none(wire.FrameDispatch, 200*time.Millisecond)
+ s := r.engineeringStep(task)
+ if s.State != wire.StepQueued || s.Placement != wire.PlacementMac || s.RunnerID != "" {
+ t.Fatalf("engineering did not wait for a Mac: %+v", s)
+ }
+ if got := r.needsYou(task); got != wire.NeedsMacRunner {
+ t.Fatalf("needs you %q", got)
+ }
+ w, _ := r.newWorker("Tito Studio")
+ w.none(wire.FrameDispatch, 200*time.Millisecond)
+ r.primary.none(wire.FrameDispatch, 0)
+ if s := r.engineeringStep(task); s.State != wire.StepQueued || s.Placement != wire.PlacementMacEngineering || s.RunnerID != "" {
+ t.Fatalf("engineering with a Mac that cannot take it: %+v", s)
+ }
+ if got := r.needsYou(task); got != wire.NeedsMacEngineering {
+ t.Fatalf("needs you %q", got)
+ }
+
+ // Not Mac work: Engineering on the primary, as before.
+ h.Catalog[0].NeedsMacOS = false
+ r.primary.heartbeat(h)
+ plain := taskID(t, r.call("c-go", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Go fix", "brief": "b"}))
+ r.call("s-go", wire.ToolStartTask, map[string]string{"task": plain, "brief": "go"})
+ // (The first task, no longer Mac work by its catalog, may go first.)
+ for range 2 {
+ _, body := r.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ if d.Specialist != wire.SpecialistEngineering || d.RunnerID == "" {
+ t.Fatalf("engineering %+v", d)
+ }
+ if d.TaskID == plain {
+ return
+ }
+ }
+ t.Fatal("plain engineering not dispatched to the primary")
+}
diff --git a/internal/thintest/macrecheck_contract_test.go b/internal/thintest/macrecheck_contract_test.go
index e76a16ca..6a592801 100644
--- a/internal/thintest/macrecheck_contract_test.go
+++ b/internal/thintest/macrecheck_contract_test.go
@@ -8,20 +8,35 @@ import (
"amadan.net/oficina/equipo/internal/wire"
)
+// legacyMacChecks is an iOS change's checks as an instance before
+// 2026-11-28 placed them with no Mac enrolled: on the Linux primary, which
+// judged them not run (needs_macos). An instance now leaves them waiting
+// for a Mac runner (waiting_mac); the tasks that reached Ready to merge
+// that way before still wait for a Mac, and these contracts keep them.
+// The fixture moves the waiting step onto the primary as the old
+// placement did and returns its dispatch, for the primary to report.
+func (r *runnersRig) legacyMacChecks(task, sha string) *wire.DispatchCommand {
+ r.t.Helper()
+ s := r.checksStep(task)
+ if s.Placement != wire.PlacementMac {
+ r.t.Fatalf("checks not waiting for a Mac: %+v", s)
+ }
+ if _, err := r.inst.DB.Writer().Exec("UPDATE chat_steps SET placement = '', waiting_since = NULL, needs = '', runner_id = ? WHERE id = ?", r.primary.fr.Welcome.RunnerID, s.ID); err != nil {
+ r.t.Fatal(err)
+ }
+ return &wire.DispatchCommand{TaskID: task, StepID: s.ID, Attempt: s.Attempt, Specialist: wire.SpecialistChecks, BaseSHA: s.BaseSHA, CandidateSHA: sha}
+}
+
// waitingForMac runs an iOS change with no Mac enrolled to Ready to merge:
-// its checks end on the primary as not run (needs_macos), review
-// approves, and the merge card asks. It returns the task, its candidate
-// and the card.
+// its checks end on the primary as not run (needs_macos, legacyMacChecks),
+// review approves, and the merge card asks. It returns the task, its
+// candidate and the card.
func (r *runnersRig) waitingForMac(title string) (task, sha string, card wire.Card) {
r.t.Helper()
task, sha = r.candidate(title, true)
- _, body := r.expect(wire.FrameDispatch)
- c := body.(*wire.DispatchCommand)
- if c.Specialist != wire.SpecialistChecks || c.TaskID != task || len(c.Needs) != 0 {
- r.t.Fatalf("checks on the primary %+v", c)
- }
+ c := r.legacyMacChecks(task, sha)
r.checks(task+"-c", c, wire.ChecksCannotRun, nil, "needs_macos", "")
- _, body = r.expect(wire.FrameDispatch)
+ _, body := r.expect(wire.FrameDispatch)
r.verdict(task+"-r", body.(*wire.DispatchCommand), wire.VerdictApprove)
r.wait("waiting for a Mac", func(c *Conversation) bool {
for _, k := range c.Cards {
diff --git a/internal/thintest/macrecheck_mergeauth_contract_test.go b/internal/thintest/macrecheck_mergeauth_contract_test.go
index a8fa7eff..e62664de 100644
--- a/internal/thintest/macrecheck_mergeauth_contract_test.go
+++ b/internal/thintest/macrecheck_mergeauth_contract_test.go
@@ -13,13 +13,9 @@ import (
func (r *runnersRig) waitingForMacMeasured(title string, paths ...string) (task, sha string, card wire.Card) {
r.t.Helper()
task, sha = r.candidate(title, true)
- _, body := r.expect(wire.FrameDispatch)
- c := body.(*wire.DispatchCommand)
- if c.Specialist != wire.SpecialistChecks || c.TaskID != task {
- r.t.Fatalf("checks on the primary %+v", c)
- }
+ c := r.legacyMacChecks(task, sha)
r.checks(task+"-c", c, wire.ChecksCannotRun, nil, "needs_macos", "")
- _, body = r.expect(wire.FrameDispatch)
+ _, body := r.expect(wire.FrameDispatch)
rv := body.(*wire.DispatchCommand)
r.step(task+"-r", wire.StepReport{TaskID: rv.TaskID, StepID: rv.StepID, Attempt: rv.Attempt, State: wire.StepDone, BaseSHA: rv.BaseSHA, CandidateSHA: rv.CandidateSHA, Termination: true, Family: "codex", Account: "codex-a", Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Findings: []wire.Finding{}, Summary: "Read it.", Change: facts(rv, paths...)})
card = r.mergeCardsWait(task)
diff --git a/internal/thintest/placement_contract_test.go b/internal/thintest/placement_contract_test.go
index 37651b76..d7ea3885 100644
--- a/internal/thintest/placement_contract_test.go
+++ b/internal/thintest/placement_contract_test.go
@@ -341,17 +341,14 @@ func TestContractChecksPlacedOnTheWorker(t *testing.T) {
}
}
-// M3 at the contract: with no worker that fits, checks go to the primary
-// with no needs and end there honestly (needs_macos), as before.
+// M3 at the contract: with no worker that fits, checks no longer go to
+// the Linux primary (2026-11-28): they wait for a Mac runner, nothing
+// dispatched (TestContractChecksWaitForAMacRunner follows them to a Mac).
func TestContractChecksWithoutAWorker(t *testing.T) {
r := newRunnersRig(t)
- task, sha := r.candidate("iOS swipe", true)
- _, body := r.expect(wire.FrameDispatch)
- d := body.(*wire.DispatchCommand)
- if d.Specialist != wire.SpecialistChecks || len(d.Needs) != 0 || d.CandidateSHA != sha {
- t.Fatalf("checks %+v", d)
- }
- if s := r.checksStep(task); s.Placement != "" || s.RunnerLabel != "docs-t1" {
+ task, _ := r.candidate("iOS swipe", true)
+ r.primary.none(wire.FrameDispatch, 200*time.Millisecond)
+ if s := r.checksStep(task); s.Placement != wire.PlacementMac || s.RunnerID != "" {
t.Fatalf("checks step %+v", s)
}
}
diff --git a/internal/wire/runners.go b/internal/wire/runners.go
index 50f45fca..0cf4dea7 100644
--- a/internal/wire/runners.go
+++ b/internal/wire/runners.go
@@ -465,10 +465,17 @@ func Covers(tags, needs []string) bool {
// Placement of a step: "" placed on its runner; waiting_runner while the
// only runners that fit are offline; waiting_sandbox while the only Macs
// online that fit have not proven their sandbox (probe P2) or are
-// tainted, and nobody chose to run the checks outside it.
+// tainted, and nobody chose to run the checks outside it; waiting_mac
+// while Mac work (checks that need macOS, Engineering for a repository
+// whose gate needs Xcode) has no enrolled runner that fits, so it waits
+// for one rather than run on a Linux primary; waiting_mac_engineering
+// while the only runners that fit Mac Engineering are Mac workers, which
+// do not take Engineering yet.
const (
- PlacementWaiting = "waiting_runner"
- PlacementSandbox = "waiting_sandbox"
+ PlacementWaiting = "waiting_runner"
+ PlacementSandbox = "waiting_sandbox"
+ PlacementMac = "waiting_mac"
+ PlacementMacEngineering = "waiting_mac_engineering"
)
// Publication of a worker's Engineering candidate: only the primary
diff --git a/internal/wire/tasks.go b/internal/wire/tasks.go
index 655a977d..6921efb5 100644
--- a/internal/wire/tasks.go
+++ b/internal/wire/tasks.go
@@ -122,6 +122,12 @@ const (
// themselves once it is proven, or the creator may choose to run them
// outside it.
NeedsMacSandbox = "mac_sandbox"
+ // NeedsMacRunner: Mac work waits for a Mac runner to be added; it
+ // starts by itself once one is.
+ NeedsMacRunner = "mac_runner"
+ // NeedsMacEngineering: Engineering for Mac work waits because a Mac
+ // runner does not take Engineering yet, and it never runs on Linux.
+ NeedsMacEngineering = "mac_engineering"
)
// MaxRebaseRounds is how many times Engineering is sent to put the change