Repository navigation
Description
Context
Found while qualifying #4238 / #3613. Determinism run 44189374470 tested merge checkout 64a2594b9f9a8e5597328e138aed3ff926409c98, parents 51d0f6de637509a97bed014eb0a284a196199e80 and b75fb11b08165f2ced5fb6c7926e1c4ff1d9a290, tree 86376893978894ae64fff4f75df78c07e2a3cfac. All 480 cases across ten changed files passed their four repetitions. The launcher then failed TEST_WROTE_INVOKING_CLAUDE_HOME; its last-file fallback names installed-turn-surface but does not attribute the writer.
A focused real Bun 1.4.4 reproduction proves that the first repetition uses the preload-owned test home and repetitions two through four use the invoking home. The preload installs isolation at (installTestHome, scripts/test-network-preload.ts:13) and its afterAll disposes it at (afterAll, scripts/test-network-preload.ts:28-36). Under --rerun-each, that cleanup happens before later repetitions. Disposal restores the invoking HOME/config descriptors and removes the working root (installTestHome, scripts/test-home.ts:24-42). The outer launcher correctly detects resulting writes (invokingHome.assertUnchanged, scripts/test.ts:248). Those three files are byte-identical to the recorded PR base and current main; this is a pre-existing shared harness defect.
An isolated installed-CLI control reproduced successful test assertions plus prompt-context writes into a disposable invoking home's .claude/prompt-context during later repetitions. No real account storage was involved. The original failing run remains failed; repeating it unchanged is not a fix. PR #4238 may make its own changed fixtures independently own storage, but that does not repair this shared lifecycle.
The binding rules remain docs/process/testing.md and the changed-test repetition/provider-history rules in docs/decisions/ci-utility.md.
Out of scope
- Production reference reads, repository trust, permissions and provider conversations.
- Reducing repetitions, skipping cases, disabling the invoking-home/network guards or arbitrary cleanup delays.
- Treating a last-file fallback as proof of the writer.
- Modifying real account storage or weakening descriptor-restoration guarantees for nested fixture users.
Scope
Keep disposable test-home and private fixture cleanup ownership valid for the complete Bun invocation, including every repeated file. Preserve eventual cleanup and the outer invoking-home sentinel. Audit the adjacent CLI-utility/private-admission cleanup for the same early-afterAll lifecycle; change only what the repeated invocation demonstrates is necessary.
Acceptance criteria
- Every repetition and every selected file runs with a live disposable working HOME and CLAUDE_CONFIG_DIR, rather than the invoking home.
- Actual host-state writes in later repetitions stay in owned storage; the outer invoking-home snapshot remains byte-identical.
- Owned test-home/utility/admission resources are cleaned after their last consumer, including nonzero/cancelled invocations where supported, without arbitrary sleeps.
- Existing network-denial, invoking-home overwrite detection and nested
installTestHomedescriptor restoration tests remain effective. - A real Bun repeated-invocation regression fails before the fix at its intended isolation assertion, and passes afterward, with meaningful mutation evidence and hosted changed-test determinism.
Verification
A minimal fixture for bun run test --rerun-each=4 --bail=1 <fixture.test.ts>:
import { expect, test } from "bun:test";
const state = globalThis as typeof globalThis & { odysseusInitialTestHome?: string };
state.odysseusInitialTestHome ??= process.env.HOME;
test("every repetition retains invoking-home isolation", () => {
expect(process.env.HOME, "TEST_HOME_SURVIVES_REPETITION").toBe(state.odysseusInitialTestHome);
});Observed: repetition one passes; repetition two fails TEST_HOME_SURVIVES_REPETITION because HOME changed from the working home to the invoking home. This does not require CPU load, credentials or the network. Add actual filesystem writes and verify cleanup through the real launcher for the durable regression. Run focused test-home/host-storage-isolation and launcher/determinism tests, bun run check:pr --base origin/main, and normal hosted proof. Preserve the original run identities above.
Contract impact
Test harness only. No published CLI/MCP/schema/frontmatter or package behavior change is intended. No consumer changeset is required unless the chosen implementation actually changes a published surface.
Activity
schlessera commentedon Nov 17, 2026
PR #4238 now has scoped fixture isolation in commit
d32d197ff03f84567abf873525fb5e48ab8f8928(published in headeda2d17c7771b6397bfb9e95990b174953beea7c): its SDK snapshot and installed-tool-surface tests install/dispose their own home for each case. The focused four-repetition run changed from 28 passing cases followed by the invoking-home guard failure to a complete pass including that guard; the same repetition passes under four CPU burners. This does not change or fix the shared preload lifecycle described here. The minimal global-preload reproduction still fails on repetition two; this issue remains open for its own bounded implementation and proof.schlessera commentedon Nov 18, 2026
Claimed for implementation. Claim token:
claim-94313ff2. Branch:fix/4244-retain-test-homes.schlessera commentedon Nov 18, 2026
Readiness review passed: no parent epic or open blockers, no active implementation PR, and the reported preload teardown matches the fetched source. Read #4238's per-case isolation change at d32d197; its branch is untouched.
The pre-claim path scan reported closure overlap with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4234, #4238 and #4240, with no shared edited paths. Implementation stays scoped to the shared launcher/preload and the adjacent CLI utility lifetime.
schlessera commentedon Nov 18, 2026
Implementation is in draft PR #4248 at
ea579b648327f6b8555f321b5c1e96ab5bcb703e. Local build, typecheck, focused storage/network and launcher/determinism tests, independent early-cleanup mutations, and final-headcheck:prall passed; the PR contains exactly one receipt block (1,230 affected fast invariants passed). PR and issue are both milestone0.45.0. The final collision scan reports ten closure overlaps and no path/unknown collision; the result is recorded in the PR.Hosted proof-system qualification requested: https://github.com/schlessera/brain-kit/actions/runs/44208909191. Claim retained for the merge queue. Resume by inspecting that result (including changed-test determinism), recording successful qualification in the PR or fixing a demonstrated regression, and arranging the required independent review of this head before queue confirmation. No confirmation or merge was run by this worker.
schlessera commentedon Nov 18, 2026
Corrected the regression in PR #4248 at
c851a002d17888b8cdc46f2d3085905680cd37fd: the Bun test process again creates its conventional PID/start private ledger. It records the identity in the launcher-owned resource tree, so cleanup remains deferred until the child group drains. No invoking-home guard or ledger assertion was weakened.Failing-first: the prior implementation fails the extended nested/repeated probe at
TEST_PROCESS_OWNS_ADMISSION(exit 1). An early-ledger-removal mutation fails atADMISSION_SURVIVES_REPETITION; restored. Final focused four-repetition proof: 284 passed. Launcher/determinism proof: 60 passed. Root typecheck and final-headcheck:prpassed (1,230 affected fast invariants); the PR has one replacement receipt.The complete unit runner was attempted locally with the three requested files and two workers, but this host refuses UID-map namespace setup before preparation/tests. The same diagnostics fixture fails at that namespace setup using the
origin/mainharness. The previous hosted planned-worker failures and exit-7 build messages belong to negative controls whose enclosing tests passed; only the ledger test failed that run. This distinction and the local limitation are recorded in the PR.New hosted feedback requested after checking the two slots: https://github.com/schlessera/brain-kit/actions/runs/44213935275. Fresh independent review is required for this head; the old record covers the prior head. Resume with this run's result and the fresh review, record successful qualification or fix a demonstrated regression, then return to the merge queue. Claim retained; no confirmation or merge attempted. No follow-up issues filed.
schlessera commentedon Nov 18, 2026
Watch-rerun correction pushed in PR #4248 at
a871008193b053e8411a08445db112d202d745c1. The ledger is now reused only for the same PID/start owner in a real directory owned by the current user. The launcher records device/inode and retains foreign/replaced entries during cleanup. The invoking-home guard and ledger assertions are intact. No new watch-state environment variable was added: a diagnostic run confirmed Bun restores the original launcher handoff on each watch reload.Failing-first: the strengthened nested wrapper-watch test fails on the previous head with
SECOND_WATCH_CONSUMERafter the second preload throwsEEXIST. The corrected test verifies three watch runs, a stable live ledger inode, prior homes remaining live, and final cleanup. Mutations disabling idempotency, foreign-owner refusal and replacement retention each fail at the intended assertion; restored. Local proof: 91 focused tests, 156 tests across four repetitions of home/admission/full invocation-lifetime files, fresh build, root typecheck and final-headcheck:pr(1,230 fast invariants) passed. Exactly one replacement receipt is in the body.The complete unit runner was attempted with the full wrapper-watch test file but is refused at this host's UID-map namespace setup before tests, as in the previous main control; cleanup passed. #3809 is unchanged and out of scope. Final collision scan: ten closure overlaps, no path/unknown collisions, recorded in the PR. PR and issue remain milestone
0.45.0.New heavy feedback (requested after both slots were checked): https://github.com/schlessera/brain-kit/actions/runs/44218334569. Fresh review is needed for this head. The live proof-system lane is also closed after main run 44213143475 failed; browser-only incident #4250 does not block this feedback request, but landing requires the next green main run. Resume by inspecting the new feedback and fresh review, recording successful qualification or fixing a demonstrated regression, and rechecking the stability window before queue confirmation. Claim retained; no confirmation or merge attempted. No new follow-up issues filed.
schlessera commentedon Nov 18, 2026
Merged in #4248 as
80a16d2b7through the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.