runner: Task 23 review 1, worker refuses a malformed go.mod
A go.mod that does not parse gets the primary's empty bundle; the Linux worker now reads both trees' modules (depsbundle.ModulesFor) before the go.sum checks, staging or any gate, and ends the step cannot_run checks_unavailable on ErrMalformed or ErrTooLarge, so no gate can pass, fail or certify the base. The progress record names the two tests-after cases as a ruled exception.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+70
−6
.rastrillo/budgets.txt+1 −1docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md+19 −2internal/runner/linuxworker/worker.go+11 −1internal/runner/linuxworker/worker_test.go+36 −0internal/runner/thin/relay.go+3 −2
CI failed — 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/hosted-runners-2: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 4.3s
ci-box: codex: fetched and verified in 4.7s
ci-box: codex-code-mode-host: fetched and verified in 1.6s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.7s
ci-box: pi: installed and verified in 7.4s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.5s
ci-box: clone deepened in 5.8s
ci-box: file times set from content: 3909 files, 272 directories
ci-box: ready in 20.6s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 87ms
FAIL amadan.net/oficina/equipo/internal/equipotest 0.240s
FAIL
make: *** [Makefile:273: copy-release-check] Error 1
amadan: step copy failed: exit status 2
amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 395893a4..472cbb6e 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -41,7 +41,7 @@ perf GET /releases/* skip Verified runner release file downloads, not browser GE |
| 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; |
| time internal/runner/linuxworker 30s Hosted slice 2 Task 17: each test starts real bubblewrap namespaces through the containment manager over real git stores (base gates, pins, restart and cancel proof, offline, staged cache, six dependency outcomes); measured 11.6 to 14.5s on a loaded docs-t1; review round 1 tests: 15 to 23s under load. |
| -size internal/runner/thin 36173 36353 Protocols 31-35, merge credential, publication guards, kept work, scans, 36 lookups; Mac pin, Engineering, asks, F probes, D1, P2, held reports; 38 Design step, renderer; hosted slice 2 Task 11 moved the base-gate checks to checkrun (source down) and pinned the primary and Mac behaviour with tests (test up), and its round 1 fixes added the worker step-engine wiring test; Task 12 added Link.TokenSource and Link.HTTPClient (a hosted runner's bearer is read at each dial and its dial goes through the proxy) and their two tests; 35831/35453. Task 14 review round 1 added Link.ReconnectWait (the wait between connections, a fake clock's in the hosted renewal tests, which drive the real Link through certificate rotation and bearer renewal); 35839/35453. Task 15: the hosted pack (inboundHeader selects by attempt and kind, Worker.Hosted indexes the base and the candidate into an empty store, pack_incomplete) and hosted_pack_test.go; 35863/35688. Task 17 wiring for the Linux checks worker (hosted_worker.go): Options.Hosted (HostedLink: the session's in-memory credential, proxy client, Work context, Flush on a failed renewal and token_renewal_failed), WorkerKind.Checks and Probe, runHosted, the Linux worker refusal outside hosted-run, the hand-off of an indexed hosted attempt and its deps bundle to the kind's checks, the receiver's per-kind transfer limits; its two tests; 36073/35768. Review round 1: the deps header checked before the wait, and TestDepsPackPerKindLimits (the receiver past the old 64 MiB and chunk limits); 36076/35824. Review round 2: TestPrimaryChecksCancelledChangedGate (a certified changed-gate run cancelled in its base run ends cancelled, no diagnostic); 36076/35882. Task 23: the primary's dependency bundle (Relay.deps after every pack, Engineer.depsBundle from the clone's trees and its module cache, a deps request refused unless it is exactly one), per-kind limits and a dataless oversize declaration in queueUpload; the relay_test.go tests, the 100 MiB end-to-end relay through the instance's store included; 36173/36353. |
| +size internal/runner/thin 36174 36353 Protocols 31-35, merge credential, publication guards, kept work, scans, 36 lookups; Mac pin, Engineering, asks, F probes, D1, P2, held reports; 38 Design step, renderer; hosted slice 2 Task 11 moved the base-gate checks to checkrun (source down) and pinned the primary and Mac behaviour with tests (test up), and its round 1 fixes added the worker step-engine wiring test; Task 12 added Link.TokenSource and Link.HTTPClient (a hosted runner's bearer is read at each dial and its dial goes through the proxy) and their two tests; 35831/35453. Task 14 review round 1 added Link.ReconnectWait (the wait between connections, a fake clock's in the hosted renewal tests, which drive the real Link through certificate rotation and bearer renewal); 35839/35453. Task 15: the hosted pack (inboundHeader selects by attempt and kind, Worker.Hosted indexes the base and the candidate into an empty store, pack_incomplete) and hosted_pack_test.go; 35863/35688. Task 17 wiring for the Linux checks worker (hosted_worker.go): Options.Hosted (HostedLink: the session's in-memory credential, proxy client, Work context, Flush on a failed renewal and token_renewal_failed), WorkerKind.Checks and Probe, runHosted, the Linux worker refusal outside hosted-run, the hand-off of an indexed hosted attempt and its deps bundle to the kind's checks, the receiver's per-kind transfer limits; its two tests; 36073/35768. Review round 1: the deps header checked before the wait, and TestDepsPackPerKindLimits (the receiver past the old 64 MiB and chunk limits); 36076/35824. Review round 2: TestPrimaryChecksCancelledChangedGate (a certified changed-gate run cancelled in its base run ends cancelled, no diagnostic); 36076/35882. Task 23: the primary's dependency bundle (Relay.deps after every pack, Engineer.depsBundle from the clone's trees and its module cache, a deps request refused unless it is exactly one), per-kind limits and a dataless oversize declaration in queueUpload; the relay_test.go tests, the 100 MiB end-to-end relay through the instance's store included; 36173/36353. Task 23 review 1: depsBundle's comment says the worker ends a malformed go.mod's empty bundle cannot_run; 36174/36353. |
| 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). |
diff --git a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md| index 90f1769b..54278a39 100644 |
| --- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| @@ -1791,14 +1791,14 @@ The dependency bundle relayed from the primary (S2-1's send half). |
| - **Wire:** `SendPackCommand` gains `Deps bool` (`deps`, omitempty, so a checks send_pack keeps its bytes). `downgradeHostedRunners` refuses a send_pack with `Deps` below `ProtocolHostedRunners`, whatever its header. |
| - **Instance:** `openHostedPack` (called by Task 21's dispatch of an enrolled job) opens two transfers, each with an instance-made `tr_` ID and its own send_pack to the primary: the hosted pack, then the deps bundle (`openTransfer` sets `Deps` for a deps header). It returns both. The instance's chunk check (`transfers.go`) and its per-transfer relay storage check use `wire.MaxChunks(tr.Kind)` and `wire.MaxBytes(tr.Kind)`. A deps transfer past its limit (a declared total, or bytes) ends the checks `cannot_run` `deps_too_large` (`tooLarge`), at once when not started, else withdrawn with that reason and the runner told to stop. When a checks step ends, however it ends (`saveStep`), its attempt's `hosted_pack` and `deps` transfers are closed (`closeTransfers` takes kinds): unacked chunks and send_packs voided, relayed chunk bodies emptied. When the job ends and the step goes again, `voidAttempt` already closes them. |
| -- **Primary:** `Relay.Once` answers every other send_pack first, then each bundle request (`Relay.deps`), so the bundle follows the pack. `Engineer.depsBundle` refuses (upload `refused`, never retried) anything but a valid deps header asked with `Deps`, for commits the clone has. It reads both trees from the clone with no checkout (`depsbundle.CommitTree`: `ls-tree`, then each go.mod `cat-file`d when `ModulesFor` opens it), takes `ModulesFor(base, candidate)`, and builds from `firstNonEmpty(Runner.ModuleCache, ~/go/pkg/mod)` (the cache its own checks mount) within `depsBundleLimit` (256 MiB). Too many modules or a bundle past the limit is `ErrTooLarge`: `queueOversize` sends no bundle bytes, one chunk with no data declaring `MaxChunks(deps)+1`, so the instance ends the step `deps_too_large`. A go.mod that does not parse gives an empty bundle (MODULES only): the hosted worker's checks then fail as a personal runner's would, instead of waiting for a bundle. `queueUpload` declares by the kind's own bound (`wire.MaxBytes`). Every oversize declaration, for any kind, now carries no data (it used to carry the first chunk's bytes, which no receiver read). |
| +- **Primary:** `Relay.Once` answers every other send_pack first, then each bundle request (`Relay.deps`), so the bundle follows the pack. `Engineer.depsBundle` refuses (upload `refused`, never retried) anything but a valid deps header asked with `Deps`, for commits the clone has. It reads both trees from the clone with no checkout (`depsbundle.CommitTree`: `ls-tree`, then each go.mod `cat-file`d when `ModulesFor` opens it), takes `ModulesFor(base, candidate)`, and builds from `firstNonEmpty(Runner.ModuleCache, ~/go/pkg/mod)` (the cache its own checks mount) within `depsBundleLimit` (256 MiB). Too many modules or a bundle past the limit is `ErrTooLarge`: `queueOversize` sends no bundle bytes, one chunk with no data declaring `MaxChunks(deps)+1`, so the instance ends the step `deps_too_large`. A go.mod that does not parse gives an empty bundle (MODULES only), instead of leaving the worker waiting for a bundle. (As first written, the worker could then run the gates and report passed or failed; review round 1 below fixed that.) `queueUpload` declares by the kind's own bound (`wire.MaxBytes`). Every oversize declaration, for any kind, now carries no data (it used to carry the first chunk's bytes, which no receiver read). |
| - `depsbundle.CommitTree` (new `gittree.go`) lists only regular go.mod and vendor/modules.txt files (a symlink is not a file) and refuses a name that is not a full object name before git runs. A listing past 64 MiB is `ErrTooLarge`. |
| Red (API stubs only: the `Deps` field and `depsBundleLimit` declared): |
| - `CGO_ENABLED=0 go test ./internal/wire -run TestHostedKindsNeedProtocol -count=1`: FAIL `hosted_test.go:97: a deps send_pack at 38 = ({..."deps":true}, <nil>), want ErrProtocol`. |
| - `CGO_ENABLED=0 go test ./internal/equipo/chat -run 'TestPrimarySendsBundle|TestNoBundle|TestBundleTooLarge|TestDepsTransfer' -count=1`: FAIL `TestPrimarySendsBundleForHostedStep`, `TestBundleTooLargeEndsStep`, `TestDepsTransferInstanceLimits`, both `TestDepsTransferCleanedUp` subtests: `hosted_deps_test.go:...: send_pack commands to the primary: 1 [{... Kind:hosted_pack ... Deps:false}], want the hosted pack and the deps bundle`. `TestNoBundleForPersonalWorker` passed (a personal worker already got no bundle); mutations 332 and 333 below are its failing evidence. |
| - `CGO_ENABLED=0 go test ./internal/runner/thin -run 'TestPrimarySendsBundle|TestNoBundle|TestBundleTooLarge|TestDepsTransfer' -count=1`: FAIL `relay_test.go:463: bundle sent false; uploads sent and pending`; `relay_test.go:512: a blob under {ID:tr_wrong_0 ... Kind: ...}, want only the checks pack` (the old primary packed a checks header asked with Deps); `relay_test.go:536: an oversize bundle sent 0 chunks [], want one declaring 1822 chunks with no data`; `TestDepsTransferAbove64MiB`: `100_MiB: relay_test.go:643: the worker's assembly of 0 chunks: pack incomplete`, `257_MiB: relay_test.go:637: 257 MiB: sent 0, relayed 0, transfer open, checks {State:queued ...}; want one declaring chunk, nothing relayed, cannot_run deps_too_large`. |
| -- Written after their code (mutations their failing evidence): `TestPrimarySendsBundleMalformedGoMod` (340) and `depsbundle`'s `TestCommitTree` (343). |
| +- Written after their code: `TestPrimarySendsBundleMalformedGoMod` and `depsbundle`'s `TestCommitTree`. This is a tests-first exception, accepted as historical by the coordinator's ruling on review round 1. Mutations 340 and 343 show the tests fail when the code breaks; they are not evidence that the tests came first. |
| `TestDepsTransferAbove64MiB` is in process, end to end: the primary's real `Relay` and `Engineer` over a git remote and a module cache whose module zip is a 100 MiB sparse file; the instance's real `chat.Store` (`Apply` of each chunk, `Pending` to the VM's runner, `Apply` of each ack, which closes the transfer after the last); the worker's `State.AcceptChunk` and its assembly (`pack`). 712 chunks arrive under the deps header and reassemble to the primary's digest; the transfer is closed after the last ack. A 257 MiB zip: the primary sends one dataless chunk declaring 1822 chunks, the instance relays nothing and the checks end `cannot_run` `deps_too_large`. The three SQLite stores run with `synchronous=OFF` in this test only: with fsync per chunk it took 16.5 s on docs-t1 (7 s of CPU), without it 7.4 s. |
| @@ -1824,3 +1824,20 @@ Mutations (each an exact-string replace by a script under `$TMPDIR`, one at a ti |
| - **344** the bundle limit ignored (`depsBundleLimit` → `1<<40` in `Build`'s call). `CGO_ENABLED=0 go test ./internal/runner/thin -run TestBundleTooLargeEndsStep -count=1`: exit 1, `relay_test.go:576: an oversize bundle sent 1 chunks, the first declaring 1 with 25260 bytes of data; want one declaring 1822 chunks with no data`. Restored. |
| Budgets, each with its reason: `internal/wire` 9902, `internal/runner/thin` 36173/36353, `internal/equipo/chat` 46957/21199. `internal/runner/depsbundle` stays within the defaults. |
| + |
| +### Task 23 review round 1 (t23-r1.md: the malformed go.mod's outcome; the tests-first record) |
| + |
| +Finding 1 (Important): with a malformed go.mod the primary sends an empty bundle, and the worker never ran module discovery. Its go.sum checks and `Stage` passed, so the base's gate could run and report passed, with base certification. Now the Linux worker (`linuxworker/worker.go`) runs `depsbundle.ModulesFor` over the base and candidate trees (read through their roots) before the go.sum checks, staging or any gate. `ErrMalformed`, or `ErrTooLarge` from discovery (more than 64 modules), ends the step `cannot_run` `checks_unavailable`, and the log tail says why. Any other error goes through the existing `stopped` mapping. `Engineer.depsBundle`'s comment now says what the worker does. |
| + |
| +Finding 2 (Minor): the Task 23 record above now names the two tests-after cases as an exception the coordinator ruled historical, and no longer counts their mutations as tests-first evidence. |
| + |
| +Red (test first): `TestHostedDepsMalformedGoMod`, with subtests for a malformed go.mod in the candidate and in the base. The base has a certifying gate that passes, and the bundle is the primary's empty one (`depsbundle.Build` of no modules, `emptyBundle(t)`). The test asserts `done`, `cannot_run` `checks_unavailable`, a log tail naming go.mod, no gate, no base checks, no `BaseChecksSHA`, no sandbox, and zero gate launches (`countLaunches`). `CGO_ENABLED=0 go test ./internal/runner/linuxworker -run TestHostedDepsMalformedGoMod -count=1`: FAIL in both subtests, `worker_test.go:762: report {... BaseChecks:passed BaseChecksSHA:d2c82bfe... State:done Reason: ... Checks:passed Gate:make ci ... ChecksSandbox:bubblewrap ...}; want cannot_run checks_unavailable with no gate, no base checks and no certification` (the reviewer's scenario: passed, base certified). |
| + |
| +Mutation: |
| +- **345** the worker's validation removed (`if _, err := depsbundle.ModulesFor(baseFS, candidateFS); errors.Is` → `if err := error(nil); errors.Is`). Same command: exit 1, both subtests `worker_test.go:762: report {... BaseChecks:passed BaseChecksSHA:cfbf6904... Checks:passed Gate:make ci ...}; want cannot_run ...`. Restored from a copy, `cmp` identical. |
| + |
| +Green: |
| +- The whole `./internal/runner/linuxworker` package (17.7 s). |
| +- The brief's command (thin 11.7 s, chat 0.4 s). |
| +- `make migration-check budget build vet`: exit 0. The thin record is raised by one line for the comment, to 36174. |
| +- staticcheck v0.7.0 on linuxworker: clean. `git diff --check`: clean. |
diff --git a/internal/runner/linuxworker/worker.go b/internal/runner/linuxworker/worker.go| index 27000506..e3706b5e 100644 |
| --- a/internal/runner/linuxworker/worker.go |
| +++ b/internal/runner/linuxworker/worker.go |
| @@ -91,7 +91,9 @@ func (w *worker) probe(context.Context) wire.Capabilities { |
| // checks runs a hosted attempt: the base and the candidate checked out |
| // of the attempt's store; the candidate's go.sum against the base's pins |
| -// (deps_conflict, deps_new_module); the bundle staged outside the |
| +// (deps_conflict, deps_new_module), after both trees' go.mod files are |
| +// read as the primary read them (checks_unavailable when they cannot |
| +// be); the bundle staged outside the |
| // sandbox (deps_missing, deps_new_module, deps_too_large); then checkrun |
| // with the base's gates and the staged cache. Nothing runs in a sandbox |
| // before the dependencies are settled. |
| @@ -138,6 +140,14 @@ func (w *worker) checks(ctx context.Context, hc thin.HostedChecks) checkrun.Outc |
| // Read through roots: a tree's symlink out of it is refused, never |
| // followed. |
| baseFS, candidateFS := baseRoot.FS(), candidateRoot.FS() |
| + // The worker's own module discovery, as the primary's bundle saw it: |
| + // a go.mod that does not parse (the primary then sends an empty |
| + // bundle), or too many modules, is never judged by a gate. |
| + if _, err := depsbundle.ModulesFor(baseFS, candidateFS); errors.Is(err, depsbundle.ErrMalformed) || errors.Is(err, depsbundle.ErrTooLarge) { |
| + return cannot("checks_unavailable", "Not run: the Go modules could not be read ("+err.Error()+").") |
| + } else if out, stop := stopped(err); stop { |
| + return out |
| + } |
| conflicts, err := depsbundle.Conflicts(baseFS, candidateFS) |
| if out, stop := stopped(err); stop { |
| return out |
diff --git a/internal/runner/linuxworker/worker_test.go b/internal/runner/linuxworker/worker_test.go| index d112ff88..8ca16b79 100644 |
| --- a/internal/runner/linuxworker/worker_test.go |
| +++ b/internal/runner/linuxworker/worker_test.go |
| @@ -735,6 +735,42 @@ func TestHostedDeps(t *testing.T) { |
| } |
| } |
| +// TestHostedDepsMalformedGoMod (Task 23 review 1): a go.mod that does |
| +// not parse, in the candidate or in the base, gets the primary's empty |
| +// bundle (MODULES and nothing else, as Engineer.depsBundle builds it). |
| +// The worker's own module discovery refuses it before staging: cannot_run |
| +// checks_unavailable, saying why, with no gate launched, no pass or fail |
| +// and no base certification, though the base's gate would pass. |
| +func TestHostedDepsMalformedGoMod(t *testing.T) { |
| + good := "module example.com/app\n\ngo 1.26\n" |
| + bad := "module example.com/app\n\nrequire example.com/m\n" |
| + base := map[string]string{".equipo/gates.json": contract, "Makefile": gateMake, "size.txt": "1\n", "budgets.txt": "1\n"} |
| + for _, tc := range []struct{ name, base, candidate string }{ |
| + {"in the candidate", good, bad}, |
| + {"in the base", bad, good}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + r := newRig(t) |
| + b := map[string]string{"go.mod": tc.base} |
| + for k, v := range base { |
| + b[k] = v |
| + } |
| + r.dispatch(b, map[string]string{"go.mod": tc.candidate, "NEWS": "news\n"}, emptyBundle(t)) |
| + launches := r.countLaunches() |
| + rep := r.run() |
| + if rep.State != wire.StepDone || rep.Checks != wire.ChecksCannotRun || rep.Reason != "checks_unavailable" || !rep.Termination || rep.Gate != "" || rep.BaseChecks != "" || rep.BaseChecksSHA != "" || rep.ChecksSandbox != "" { |
| + t.Fatalf("report %+v; want cannot_run checks_unavailable with no gate, no base checks and no certification", rep) |
| + } |
| + if !strings.Contains(rep.LogTail, "go.mod") { |
| + t.Fatalf("log tail %q does not say why", rep.LogTail) |
| + } |
| + if *launches != 0 { |
| + t.Fatalf("%d gate launches", *launches) |
| + } |
| + }) |
| + } |
| +} |
| + |
| // countLaunches counts the kind's gate launches (each still started). |
| func (r *rig) countLaunches() *int { |
| g := r.kind.Gate.(*bwrapGate) |
diff --git a/internal/runner/thin/relay.go b/internal/runner/thin/relay.go| index 8ab80756..8e67efb3 100644 |
| --- a/internal/runner/thin/relay.go |
| +++ b/internal/runner/thin/relay.go |
| @@ -593,8 +593,9 @@ func (e *Engineer) packCommits(ctx context.Context, h wire.TransferHeader) ([]by |
| // over their trees in the clone), from this runner's module cache as its |
| // own checks use it, within depsBundleLimit. Too many modules, or a |
| // bundle past the limit, is depsbundle.ErrTooLarge. A go.mod that does |
| -// not parse gives an empty bundle: the hosted worker reaches its own |
| -// verdict, as a personal runner's checks would. A request that is not a |
| +// not parse gives an empty bundle: the hosted worker's own discovery |
| +// then ends the checks cannot_run checks_unavailable before any gate |
| +// (linuxworker), instead of waiting for a bundle. A request that is not a |
| // valid deps header asked with Deps, for commits the clone has, is |
| // refused before anything is read. |
| func (e *Engineer) depsBundle(ctx context.Context, u wire.SendPackCommand) ([]byte, error) { |