Mac slice F task 11 fix 2: inventory needs an accepted capability report
Astra round 2, finding 1, test first: a marked hello after the welcome is a complete report only with a capability report the instance accepts. A marked hello with none, or with one cleanHello drops, signs no connection out and releases no hold. TestContractWorkerReconnectKeepsHold covers both; mutations G1 (no capability check) and G2 (the raw report) each fail it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+22
−3
.rastrillo/budgets.txt+2 −2internal/equipo/chat/worker_connections.go+5 −1internal/thintest/worker_connections_fix1_contract_test.go+15 −0
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 3d9886fb..7df6d78b 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -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 39190 12096 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places, waiting cards, Mac waits, Mac Engineering, Mac conns; measured 39190/12096. |
| +size internal/equipo/chat 39194 12096 File facts/diffs, previews, merge authority, unfinished work, CI feedback, notification receipts, Assistant files, places, waiting cards, Mac waits, Mac Engineering, Mac conns; measured 39194/12096. |
| 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 - 11977 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 11977 test lines. |
| -size internal/thintest - 39588 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places, Mac waits, Mac Engineering, Mac conns; measured 39588. |
| +size internal/thintest - 39603 Protocol 31 contracts, 35 diffs, stuck tasks, no-access merges, held retries, unfinished work, free rounds, previews, Assistant files, places, Mac waits, Mac Engineering, Mac conns; measured 39603. |
| 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/internal/equipo/chat/worker_connections.go b/internal/equipo/chat/worker_connections.go| index 7ccc473b..cfea6397 100644 |
| --- a/internal/equipo/chat/worker_connections.go |
| +++ b/internal/equipo/chat/worker_connections.go |
| @@ -180,7 +180,11 @@ func (t *txn) workerHello(l Lease, h wire.Hello, handshake bool) error { |
| if l.Role != wire.RoleWorker || l.Protocol < wire.ProtocolMacEngineering { |
| return nil |
| } |
| - if err := t.helloConnections(l, h.Connections, h.Inventory && !handshake); err != nil { |
| + // Complete only when marked, after the welcome, and with a capability |
| + // report the instance accepts: one with none, or one cleanHello |
| + // drops, is not the Mac's whole word. |
| + complete := h.Inventory && !handshake && cleanHello(h).Capabilities != nil |
| + if err := t.helloConnections(l, h.Connections, complete); err != nil { |
| return err |
| } |
| return t.helloHold(l, h, handshake) |
diff --git a/internal/thintest/worker_connections_fix1_contract_test.go b/internal/thintest/worker_connections_fix1_contract_test.go| index 14ce776f..daf5e95b 100644 |
| --- a/internal/thintest/worker_connections_fix1_contract_test.go |
| +++ b/internal/thintest/worker_connections_fix1_contract_test.go |
| @@ -97,6 +97,21 @@ func TestContractWorkerReconnectKeepsHold(t *testing.T) { |
| partial.Inventory = false |
| w.heartbeat(partial) |
| stillThere("a hello without its inventory") |
| + // Nor does a marked hello with no capability report, or one the |
| + // instance refuses: nothing in it can be judged (fix round 2). |
| + bare := workerConnHello(key) |
| + bare.Capabilities = nil |
| + w.heartbeat(bare) |
| + stillThere("a marked hello with no capability report") |
| + invalid := workerConnHello(key) |
| + caps := *invalid.Capabilities |
| + caps.Tags = append([]string{"not-a-tag"}, caps.Tags...) |
| + invalid.Capabilities = &caps |
| + if wire.ValidCapabilities(caps) == nil { |
| + t.Fatal("the report meant to be refused is valid") |
| + } |
| + w.heartbeat(invalid) |
| + stillThere("a marked hello with a refused capability report") |
| w.heartbeat(inventoryHello(key, nil)) |
| if c, _ := r.connRow(wid, "claude-1"); c.State != wire.ConnSignedOut || r.heldNow(wid) { |
| t.Fatalf("a full report of nothing: row %s, held=%v", c.State, r.heldNow(wid)) |