Repository navigation
Keep each Docker test run's containers and counts to itself - #185
Merged
Merged
Conversation
The supervisor tests named agent containers from fixed attempt IDs under one fixed runner owner, so a container that a failed run left behind (an agent that ignores SIGTERM keeps running) took the next run's name and failed it with a name conflict. Each run now has its own attempt suffix and runner owner, and afterAll force-removes every container, network and volume labelled with that owner after the ordinary cleanup, even when that cleanup throws. The storage, egress-network and keeper counts in both files counted every object on the daemon, so a concurrent run's objects failed them; the keeper test would also force-remove another run's keepers. They now count only this run's objects, by runner owner, or by allocation where the objects are made without the runner label on purpose. The first supervisor test had no timeout of its own and could exceed Vitest's 5 s default while its fixture created task storage. Ported from fix/supervisor-test-cleanup (84dd662). Its macOS /var versus /private/var fix for the unreleased-inventory tests is not needed: main records the resolved directories already. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…moves Independent review (round 1) found the runner-scoped storage counts would miss a leaked object whose runner label was wrong or missing; the three tests now count their own allocation's objects. The afterAll sweep now reports each removal, its comment says a hook timeout skips it, and profile()'s parameter no longer shadows attempt(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review (round 2): the vendor-network test counted only networks, so a leaked unlabelled proxy would pass; it now counts every object of both allocations. The afterAll sweep reports a Docker call that fails, and its comment says it may not run before a hook timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review (round 3): with a random runner owner, nothing would find what a failed agent-container run leaves behind. Both files' afterAll hooks now call the same removeRunnerObjects fixture after their ordinary cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review (round 4): Docker cannot force-remove a network that a container still uses, and the sweep does not try to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues remain in these test-only changes, and the PR reports successful type checking and real-Docker validation.
No open issues 🎉
What changed in this PR
Isolates Docker-backed test runs so leftover or concurrent resources do not cause naming conflicts, incorrect counts, or cross-run cleanup.
Changes:
- Adds per-run owners and unique supervisor attempt IDs.
- Scopes resource checks to the relevant run or allocation.
- Adds shared fallback cleanup and extends the first supervisor test’s timeout.
| File | Description |
|---|---|
| test/fixtures/docker-sweep.ts | Adds owner-scoped cleanup with removal and failure reporting. |
| test/agent-supervisor.test.ts | Isolates names and counts, adds fallback cleanup, and adjusts a timeout. |
| test/agent-container.test.ts | Isolates inventory checks and adds fallback cleanup. |
Review effort: Balanced
This was referenced Oct 20, 2026
mchwang
added a commit
that referenced
this pull request
Oct 21, 2026
…188) * Give the network, gate and workspace Docker tests per-run isolation Each file now has its own random runner owner and removes what that owner still holds after its ordinary cleanup, as #185 did for the supervisor and container tests. - runner-workspace: the path identity probe test counted probe containers and probe-option volumes across the whole daemon, so a leftover probe container or another runner's probe failed it. It now follows only this probe's container, by the name a PATH shim records (the shim runs the real docker unchanged), and the volumes Docker's events show mounted in it. - agent-gate: broken-isolation containers carry the runner label, and the client is killed with SIGKILL at its timeout. SIGTERM was passed to the container's shell, which ignores it, so the client waited for the container to exit. - agent-network: network and proxy names are random, so the fixed attempt IDs reach only labels; the per-run owner and sweep are preventive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fail a gate case whose probe client is killed at its timeout A SIGKILLed client has no exit status, which the cases' not.toBe(0) checks accepted, so a probe that hung would have passed. Found in independent review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keeps each run of the Docker-backed supervisor and container tests to its own containers and counts. Ported from the local branch
fix/supervisor-test-cleanup(84dd662, never opened as a PR) onto current main. It was not rebased, because the tests have changed a lot since.Problem, checked on main 42abf4a
agents/container/profile.ts:318), and the supervisor tests use fixed IDs. Withcodeboost-agent-finite-d4f568b800c6a61bleft running, "captures finite output" fails:Conflict. The container name ... is already in use.expected [ …(8) ] to deeply equal []. Under the same load, the keeper-orphan test listed 17 of the other run's keepers as orphans, and its code force-removes every orphan before it asserts./varvs/private/varin the unreleased-inventory testsprofile.ts:298-299now records the resolved directory. The old branch'sresolved()helper is not ported.Change
test/fixtures/docker-sweep.ts(removeRunnerObjects): both files call it in afinallyblock after their ordinaryafterAllcleanup. It removes everything labelled with the run's owner: containers and volumes by force, networks without force.byAllocation, now at module level;fixture()takes a caller-made owner).Validation
Each gate is reported separately. The machine was heavily loaded (load average 60–90).
npx tsc --noEmit) on a0c38a3: passed.npx vitest run --project docker test/agent-supervisor.test.ts test/agent-container.test.ts) on validated head a0c38a3: 198 passed, 0 failed, 1 skipped (the Linux-only non-UTF-8 test). Neither sweep found anything to remove.finitecontainer running, "captures finite output" passes on 523a4da (it fails on main).Vendor network cleanup did not settle) and still fails the suite. The sweep then removes 2 containers, 1 network and 2 volumes, and nothing with that owner is left.testandreal-dockerwill report.Reviews
Base for every round: 42abf4a.
profile()parameter shadowsattempt().io.codeboost.runnerliterally.Clean independent review: round 5, base 42abf4a / head a0c38a3. After the PR opened, main moved to aded16e (#183). That commit touches none of this PR's files, and the branch was not rebased, so the reviewed diff is unchanged. Copilot review was requested on a0c38a3.
Review-lesson audit
Follow-ups (not in this PR)
0123456789abcdef…. agent-network.test.ts also uses the fixed attemptnetwork-probe. runner-workspace.test.ts:155 lists volumes across the whole daemon, and states that as a precondition.The old branch
fix/supervisor-test-cleanupstays until this merges.🤖 Generated with Claude Code