Repository navigation
Description
Goal
Child of #290. Move the toolchain passes to Effect: engine-native/toolchain.ts, deps.ts, and bun.ts, with typed errors in the error channel. Calls into the process layer and the kit store, which a later child of #290 moves, go through the bridge rule of the #290 Research. Remove the bridges that the seam child put around these passes. Keep the toolchain output, the exit codes, and the cache behavior unchanged.
Yolo: the user delegated every decision except the merge to the agent.
Mode: plan-and-implement
Research
Repository facts (main at ab33f4f; #296 lands first and bridges the two deps.probe calls of ompPlugins.ts):
toolchain.ts:field,isNewer,belowFloorare plain;presentcallsdeps.probe;installedVersion,report,latestUpstream, andoutdatedReportareasync.latestUpstreamuses the injectedFetchLike(defaultglobalThis.fetch) withAbortSignal.timeout(8000), readsprocess.env, reads and writes the cache throughkitDb.ts readCacheandwriteCache, and turns a lookup error into{ ok: false, reason }, whichoutdatedReportprints aslookup failed: <reason>.outdatedReportruns the lookups withPromise.alland returns 0.deps.ts:resolveDependencyis plain;resolveVersionReading,resolveVersion, andresolvePathareasyncand callexec.ts captureorcaptureWithin(60 s limit) andwhich; the probe callsexec.ts commandExists, and the Bun probe falls back fromPATHtohome.ts engineHome; the Bun spec readsBUN_INSTALL.bun.ts:bunBootstrapand its install helpers areasync; they make a temporary folder withmkdtempSyncand remove it in afinally, run twoexec.ts spawnProcesscalls, and call the dependency methods and the logger.engineCtx.tsmemoizes the bootstrap as a Promise (bunRuntime), which the Move the engine seam and the sync orchestration to Effect #294scanrow allowed for this child.services.tsDependencyManagerhasprobe,version,versionReading,path,spec, andwarnMissing;versionReadinghas no production caller; test doubles inenvGlobals.test.ts,ompKitPlugin.test.ts, andompRemovals.test.tsdefine it.- Move the engine seam and the sync orchestration to Effect #294 bridges:
modes.tsbridgesreport,outdatedReport,bunBootstrap,installedVersion,present,field, andbelowFloor;ompSync.tsbridgesbunBootstrap. - Tests:
toolchain.test.ts,toolchainOutdated.test.ts(in-process cache and fetch cases),deps.test.ts,bun.test.ts,syncLock.test.ts, and both golden suites, which pintoolchain check. No spawnedtoolchain outdatedcase exists; the parentcommandsrow asks for one.
Tool facts: the pins of package.json and bun.lock (Bun 1.4.5 in CI, effect 4.1.7, Vitest 5.1.2, @effect/tsgo 0.74.1, oxlint 1.95.0). Runtimes of the rows (the #290 Research, 2026-12-01): Vitest runs on Node v26.13.0 through its shebang, and the spawned toolchain outdated child runs on Bun 1.4.5; Git 2.53.0 runs the Git rows. The new spawned case uses only Bun and a node:net listener of the test. The gate row is the repository's standard check, unchanged by this plan, and CI provisions it on the runner images of .github/workflows/parity.yml (the precedent of #296 plan round 4).
Decisions:
- Dependency methods (delegated, one line):
probe,version, andpathreturn Effects with a typed failure; their calls intoexec.ts(capture,captureWithin,which,commandExists) andhome.ts engineHomego throughbridgePromiseorbridgeSync, with the probe order and outcomes unchanged;versionReadingand its test doubles go; every caller moves, the twoompPlugins.tsprobes included, whose Move the omp passes and the kit store to Effect #296 bridges go. - Toolchain (delegated, one line):
installedVersion,report,latestUpstream, andoutdatedReportbecome Effects; the request and the body read run in oneEffect.tryPromisethat keepsAbortSignal.timeout(8000)across both, so one 8 s deadline covers them and a timeout keeps its current reason text; a failed lookup keeps itslookup failed: <reason>text; the lookups run withEffect.alland unbounded concurrency, each recovering its own failure, so no lookup interrupts another;readCacheandwriteCache(Move the process layer, the file helpers, and the kit store to Effect #297) go throughbridgeSync. - Bun (delegated, one line):
bunBootstrapbecomes an Effect; the bootstrap of one engine context runs as one uninterruptible region, as the bridged base did: it makes the temporary folder, runs the installer calls underEffect.exit, removes the folder, then fails with the removal failure alone when the removal fails (a typedBunInstallFolderFailedwith the original filesystem message, as a throw from the basefinallyreplaced the installer outcome) and otherwise replays the installer outcome, before the result is logged and the executable is probed; a creation failure is the same typed failure;index.tsandcli/src/engine.tscarry it to both CLI entry paths with that message;spawnProcessgoes throughbridgePromise; the Promise memobunRuntimeofengineCtx.tsbecomes a run-ownedDeferredof the bootstrap'sExit: the first caller runs the uninterruptible region and completes it, every other caller in that context awaits it with an uninterruptibleDeferred.await, as the base bridge waited for the shared Promise, so every caller observes the settled outcome (a typed cleanup failure included) and no caller starts a second install. An interrupted waiter gets the interruption, with the cleanup failure kept in its cause, as an interrupted base bridge did; no CLI path interrupts an engine run except SIGINT and SIGTERM, which exit the process at once (Move the engine seam and the sync orchestration to Effect #294 Signals decision), so the CLI output does not depend on this case. The outer mask is a Move the toolchain passes to Effect #298-only exception to parent D1 while the installer calls are bridged; Move the process layer, the file helpers, and the kit store to Effect #297 narrows it to the cleanup when its process service makes the installer calls interruptible (recorded in the Move the process layer, the file helpers, and the kit store to Effect #297 Goal). Rejected:Effect.cached, which abandons the computation when its last waiter is interrupted. - Logger (delegated, one line): logger calls of the moved code go through
bridgeSyncuntil Move the process layer, the file helpers, and the kit store to Effect #297, as in Move the omp passes and the kit store to Effect #296. - Bridges (delegated, one line):
modes.tsandompSync.tscall the moved passes directly; the remaining bridges wrap only Move the process layer, the file helpers, and the kit store to Effect #297 code and logger calls. - Failure model (delegated, one line): the writes are the cache rows (
writeCache) and the Bun install into its temporary folder andBUN_INSTALL; each keeps its base behavior after a crash (after an install that stopped part way, the next run skips the installation only when the existing probe resolves Bun, as now, and installs again otherwise, for example for a relativeBUN_INSTALLthat the probe rejects; the installer's own writes to shell startup files are outsideBUN_INSTALLand outside this plan, as now) and on a signal (the immediate exit of Move the engine seam and the sync orchestration to Effect #294); the cache write stays after a successful lookup only. - Version: no bump; the output, the exit codes, and the cache behavior do not change.
Steps
| # | Id | Task | Files | Depends | Effect | Status | Done when |
|---|---|---|---|---|---|---|---|
| 1 | toolchain | Move toolchain.ts, deps.ts, bun.ts, and the dependency methods as the decisions say; move every caller and remove the #294 and #296 bridges around them; remove versionReading; port the tests; add the spawned toolchain outdated case of the commands row |
cli/src/engine-native/toolchain.ts, cli/src/engine-native/deps.ts, cli/src/engine-native/bun.ts, cli/src/engine-native/services.ts, cli/src/engine-native/engineCtx.ts, cli/src/engine-native/modes.ts, cli/src/engine-native/ompSync.ts, cli/src/engine-native/ompPlugins.ts, cli/src/engine-native/index.ts, cli/src/engine.ts, cli/src/services.ts, cli/test/unit/toolchain.test.ts, cli/test/unit/toolchainOutdated.test.ts, cli/test/unit/deps.test.ts, cli/test/unit/bun.test.ts, cli/test/unit/envGlobals.test.ts, cli/test/unit/ompKitPlugin.test.ts, cli/test/unit/ompRemovals.test.ts, cli/test/unit/syncLock.test.ts, cli/test/unit/ompPluginInventory.test.ts, cli/test/unit/syncPipelineFailure.test.ts |
- | local | done | the unit, commands, goldens, scan, and bridges rows pass |
| 2 | guidance | Update toolchain-context, the dependency lines of engine-native-context and host-platform-context that name the Promise forms or resolveVersionReading, and the bridge list of dispatch-flow.md, which stops naming bun.ts and toolchain.ts |
.agents/skills/toolchain-context/SKILL.md, .agents/skills/engine-native-context/SKILL.md, .agents/skills/host-platform-context/SKILL.md, .agents/skills/sync-orchestration-context/references/dispatch-flow.md, .agents/skills/sync-orchestration-context/SKILL.md, .agents/skills/omp-sync-context/SKILL.md |
1 | local | done | the guidance row passes |
| 3 | repairs | Repair code review round 1: make the Bun temporary folder with the original prefix passed to the OS (the callback form of the node:fs temporary-folder call through Effect.callback, with the prefix string unchanged, so TMPDIR is not folded lexically and the scan row still finds no synchronous call), keeping the typed BunInstallFolderFailed; call the bounded probe with exec as its receiver; bound the spawned toolchain outdated child with a deadline below the case timeout, kill and reap it on expiry, close the listener on every path, and pass --no-env-file; add a folder-creation failure case and a spawned toolchain ensure bun case without --dry-run, on Linux and macOS only (Bun ignores TMPDIR on Windows), with Bun absent, stub installer commands first on PATH, and a TMPDIR of a symlink followed by .., that asserts that the installer stages under the parent that the OS resolves; type the version-report fixture without a cast; correct the guidance lines on the Bun bootstrap lock test, the signal deferral, and the version probe |
cli/src/engine-native/bun.ts, cli/src/engine-native/deps.ts, cli/test/unit/toolchainOutdated.test.ts, cli/test/unit/bun.test.ts, cli/test/unit/toolchain.test.ts, cli/test/unit/syncLock.test.ts, .agents/skills/sync-orchestration-context/SKILL.md, .agents/skills/sync-orchestration-context/references/dispatch-flow.md, .agents/skills/host-platform-context/SKILL.md, .agents/skills/omp-sync-context/SKILL.md |
2 | local | done | the unit, commands, scan, bridges, and guidance rows pass |
| 4 | repairs_2 | Repair code review round 2: the spawned toolchain ensure bun case gets a fixture-only PATH and stubs that use only shell builtins, so no installer command can resolve outside the fixture; each stub writes its physical folder to its own file under the fixture home without truncating a destination; the CLI runs in its own POSIX process group that the watchdog ends; the guard allows Linux and macOS only; the signal guidance distinguishes the fiber mask from a synchronous cleanup that delays the handler |
cli/test/unit/toolchain.test.ts, .agents/skills/sync-orchestration-context/SKILL.md, .agents/skills/sync-orchestration-context/references/dispatch-flow.md |
3 | local | done | the unit and guidance rows pass |
Acceptance
| ID | Command | Expected |
|---|---|---|
| deps | bun install --frozen-lockfile in the linked worktree |
Exit 0 |
| unit | bun x --no-install vitest run --reporter=verbose cli/test/unit/toolchain.test.ts cli/test/unit/toolchainOutdated.test.ts cli/test/unit/deps.test.ts cli/test/unit/bun.test.ts cli/test/unit/envGlobals.test.ts cli/test/unit/ompKitPlugin.test.ts cli/test/unit/ompRemovals.test.ts cli/test/unit/syncLock.test.ts cli/test/unit/ompPluginInventory.test.ts cli/test/unit/engine.test.ts cli/test/unit/syncPipelineFailure.test.ts cli/test/unit/rootFlags.test.ts cli/test/unit/skillMetadata.test.ts |
Exit 0, with every base case kept with its texts, and a case where repeated and concurrent bootstrap calls within one engine context share one bootstrap, while two engine runs do not share it; from step 3, on Linux and macOS: a spawned toolchain ensure bun with a TMPDIR of a symlink followed by .. stages the installer under the parent that the OS resolves |
| commands | bun x --no-install vitest run --reporter=verbose cli/test/unit/toolchainOutdated.test.ts -t "spawned" |
Exit 0: a spawned toolchain outdated in an isolated home prints the seeded upstream version from a fresh seeded cache with no lookup failed line, while the child gets every proxy variable set to a local listener of the test, NO_PROXY and no_proxy set empty, and the listener records no connection; the case fails when the cache read is skipped (red baseline) |
| goldens | On the reviewed commit with git status --porcelain empty: bun run golden:dryrun && bun run golden:mutation && git diff --exit-code --merge-base origin/main HEAD -- cli/test/goldens |
Both suites OK; no golden changed |
| red-dry | bun run golden:dryrun --prove-red |
Exit 1; prints prove-red OK: golden-dryrun |
| red-mut | bun run golden:mutation --prove-red |
Exit 1; prints prove-red OK: golden-mutation |
| scan | git grep -nF -e 'async function' -e 'async (' -e 'Promise<' -e 'Effect.promise(' -e 'Effect.runPromise(' -e 'Effect.runSync(' -e 'mkdtempSync(' -e 'throw ' -- cli/src/engine-native/toolchain.ts cli/src/engine-native/deps.ts cli/src/engine-native/bun.ts cli/src/engine-native/services.ts cli/src/engine-native/engineCtx.ts |
Exit 1, no match outside comments |
| bridges | git grep -n -e 'bridgeSync(' -e 'bridgePromise(' -e 'Effect.tryPromise(' -- cli/src/engine-native/toolchain.ts cli/src/engine-native/deps.ts cli/src/engine-native/bun.ts cli/src/engine-native/modes.ts cli/src/engine-native/ompSync.ts cli/src/engine-native/ompPlugins.ts |
Each bridgeSync or bridgePromise match wraps a call into exec.ts, kitDb.ts, home.ts, atomicWrite.ts, processes.ts, or a logger call; the one Effect.tryPromise wraps fetch; no match wraps a toolchain, dependency, or Bun pass |
| guidance | git grep -n -e 'resolveVersionReading' -e 'versionReading' -e 'async function bunBootstrap' -- .agents/skills/toolchain-context .agents/skills/engine-native-context .agents/skills/host-platform-context; git grep -n -e 'bun.ts' -e 'toolchain.ts' -- .agents/skills/sync-orchestration-context/references/dispatch-flow.md |
The first exits 1; the second prints no line that lists bun.ts or toolchain.ts as bridged |
| dry | ./docks-kit sync --dry-run |
Exit 0 |
| types | bun run check:types |
Exit 0 |
| ci-tools | bun cli/scripts/verify-ci-tools.ts |
Exit 0 |
| smoke | bun run smoke:package |
Exit 0 |
| gate | bun run check |
Exit 0 |
Do not touch
- The toolchain output, the exit codes, the cache rows and their keys, and the goldens.
exec.ts,kitDb.ts,kitLock.ts,home.ts,processes.ts,atomicWrite.ts, andlogger.ts(Move the process layer, the file helpers, and the kit store to Effect #297).
Open questions
Verification Results
Reviewed head c41d9d7d (2026-12-02), linked worktree:
deps: exit 0.unit: exit 0, 13 files, 200 tests, the spawnedtoolchain ensure bunstaging case and the bootstrap-sharing case included.commands: exit 0 (the spawnedtoolchain outdatedcase).goldens: both suites OK, no golden changed.red-dryandred-mut: exit 1 withprove-red OK.dry: exit 0.types: exit 0.ci-tools: exit 0.smoke: exit 0.gate: exit 0, 6543 tests passed, 12 skipped.scan: exit 1, no match (b91caa91and after).bridges: everybridgeSyncorbridgePromisewraps anexec.ts,home.ts, orkitDb.tscall, a logger call, orrecordFailure; the oneEffect.tryPromisewrapsfetch.guidance: the first grep exits 1; the dispatch reference namesbun.tsandtoolchain.tsonly as not bridged.- Red baselines: the spawned
outdatedcase fails withlookup failed: ECONNRESETwhen the cache read is skipped; the sharing case fails without the memo and with a memo shared across runs; the folder cases fail with the removal or creation mapping removed; the staging case fails with the lexical temporary-folder version (<root>/lexical).
Activity
DocksDocks commentedon Dec 1, 2026
Delegation grant: yolo: "now start #290 please, use yolo, also fix open findings in a follow up"
Parent event: 7326116204
DocksDocks commentedon Dec 2, 2026
Delegation grant: yolo: "continue with all remaining issues via yolo please, but its an "ultra-yolo" i allow you to review rounds untill it passes and i allow you to merge without asking."
DocksDocks commentedon Dec 2, 2026
Plan review round 1
Plan-review: repair
bridges-toolchain.ts:140–142, 190–196keeps the abort signal active throughresponse.text()and reports the original rejection message. Timing onlyfetch()lets a response that sends 200 headers and then stalls escape the deadline. Effect's defaultTimeoutErroralso changes the reported reason. See the Fetch Standard and Effect 4.1.7 timeout implementation - Apply one eight-second deadline to the request and body read, recover either failure on that tool's row, and preserve the existing timeout diagnostic - class: timeout replacement changes coverage and diagnosticstoolchain-bun.ts:95–118removes the installer directory before logging the result or probing the executable. If removal fails, the CLI reports the original filesystem error. The pinned filesystem implementation deletes at scope close and turns removal failure into a defect withorDie. A run-wide scope delays deletion; even a local scope still changes how cleanup errors reachengine.ts:48–51- Bound the directory to the installer calls and use cleanup that keeps the original diagnostic and failure precedence in the typed channel. Include the shared error boundary in Files if it needs to change - class: scoped cleanup changes failure semanticstoolchainandguidance, Files -cli/test/unit/syncPipelineFailure.test.ts:23–25still mocksbunBootstrapwith a Promise. OnceompSyncyields its Effect directly, the test fails before it reaches the plugin failure and ledger assertions. Also,.agents/skills/sync-orchestration-context/references/dispatch-flow.md:95–103directs callers to bridgebun.tsandtoolchain.ts; Move the omp passes and the kit store to Effect #296'sguidancerow deliberately leaves Move the toolchain passes to Effect #298 calls bridged - Add the pipeline test totoolchainand port its mock. Add the dispatch reference toguidanceand remove the instructions to bridge the converted calls - class: path missing from a Files cellunit, “the sync andtoolchain ensureshare one bootstrap per run” -cli/src/engine-native/index.ts:61–68creates one context and dispatches eithersyncortoolchain, not both. Separate invocations cannot share that context. The existing memo tests incli/test/unit/bun.test.ts:135–155exercise repeated or concurrent calls within a single context - Make the row check that repeated or concurrent calls share one bootstrap within a context, without sharing it across engine runs - class: acceptance requires two exclusive dispatch branches in one runguidance- The row expects exit 1 after obsolete guidance is removed, but it already exits 1 with the guidance untouched..agents/skills/host-platform-context/SKILL.md:3,71spells the old referenceresolveVersionReadingwith an uppercaseV; the case-sensitivegit grepsearches forversionReading- Change the row to match the exact stale reference so leaving either occurrence fails the check - class: acceptance pattern misses the obsolete referencedeps.tsand Dependency methods decision - The bridge inventory omitsexec.commandExistsindeps.ts:108–113andhome.ts engineHomeindeps.ts:121–135. An ordinary git probe and a Bun probe that falls back from PATH both reach code owned by Move the process layer, the file helpers, and the kit store to Effect #297. Bridging only the listed calls leaves those paths outside the parent D1 bridge rule; replacingcommandExistswithwhichalso changes the injected missing verdict asserted incli/test/unit/deps.test.ts:279–288- Include both live calls in the bridge decision and preserve the existing probe order and outcomes - class: incomplete inventory of calls crossing the migration boundarytoolchain ensurerepeats it” - The Bun installer makes the executable runnable before it finishes cleanup or shell configuration. If it stops in that interval,bun.ts:73–74anddeps.ts:121–135accept the executable on the next run and skip installation. The installer can also modify shell startup files outsideBUN_INSTALL- Record that retry depends on whether Bun resolves, and account for installer-managed shell writes without adding a repair or reinstall path - class: incorrect install recovery premiseunit,commands,goldens,scan,bridges, andguidance- The stated tool facts omit Node and Git. Bun respects the executable's shebang, andnode_modules/vitest/vitest.mjs:1selects Node. With Bun but no compatible Node, the test that is supposed to spawntoolchain outdatednever reaches the CLI. The Git rows also invoke Git directly - Adopt Move the engine-native layer to Effect #290's recorded Node and Git versions for the linked worktree and distinguish the Node test runner from the Bun child - class: unrecorded acceptance runtime prerequisiteDocksDocks commentedon Dec 2, 2026
Plan review round 2, delta
Plan-review: repair
toolchain- Effect 4.1.7ensuringrequires a finalizer with error typenever, butFileSystem.removereturnsPlatformError. The stated cleanup therefore cannot propagate a typed removal failure. The stated precedence is also reversed: if the installer fails and removal throws,cli/src/engine-native/bun.ts:95–107reports the removal error before it can log the installer result, andcli/src/engine.ts:41–51preserves the later error when both reach the CLI - Use typed, exit-aware cleanup around the installer calls. Preserve the original filesystem diagnostic, let removal failure take precedence, and list any shared error-boundary files that need to change - class: scoped cleanup changes failure semanticsBUN_INSTALLas supplied. If it makesrelative-bun/bin/bunexecutable and then stops,cli/src/engine-native/exec.ts:306–319returns that relative path andcli/src/engine-native/deps.ts:121–136rejects it. With no other Bun and the normal install prerequisites met, the next run tries installation again, contrary to the revised decision - State that the next run skips installation only if the existing probe resolves Bun. Keep the recorded shell-startup behavior unchanged - class: incorrect install recovery premisePrevious findings:
bridges: resolved - The Toolchain decision keeps the original eight-second abort signal across both the request and body read and preserves the rejection text.toolchain: open - repeated abovetoolchainandguidance, Files: resolved - Step 1 includessyncPipelineFailure.test.tsin the test port. Step 2 includesdispatch-flow.mdand removes the obsolete bridge instructions.unit: resolved - The row checks repeated and concurrent calls within one context and isolation across runs.guidance: resolved - The row now matches the exactresolveVersionReadingspelling and checks the dispatch bridge list.deps.tsrepository facts and Dependency methods decision: resolved - Both passages namecommandExistsandengineHome; the decision preserves probe order and outcomes.Manager response to round 1
Repaired:
Effect.tryPromisekeepsAbortSignal.timeout(8000)across the request and the body read, with the current timeout reason text.makeTempDirectoryplus anEffect.ensuringaround the installer calls only; a removal failure keeps its message and the basefinallyprecedence in the typed channel.syncPipelineFailure.test.tsjoins step 1;dispatch-flow.mdjoins step 2, which stops namingbun.tsandtoolchain.tsas bridged.unitrow: the shared bootstrap is checked within one engine context, not across runs.guidancerow: matchesresolveVersionReadingand checks the dispatch reference.exec.ts commandExistsandhome.ts engineHomeare bridged, with the probe order and outcomes unchanged.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 3, delta
Plan-review: repair
toolchainFiles (line 38) -Effect.onExitpermits typed cleanup failures, butEngineFailureand its renderer do not acceptPlatformError(cli/src/engine-native/index.ts:27–42,cli/src/engine.ts:24–51). If removal fails withEACCES, propagating the platform error fails the type check; printing its wrapper message instead changes the original filesystem diagnostic thatbun.ts:95–107surfaced - Map temporary-directory creation and removal failures to a typed Bun error that preserves the original filesystem message. Addcli/src/engine-native/index.tsandcli/src/engine.tsto the step so the error reaches both CLI entry paths - class: scoped cleanup changes failure semanticsEffect.exitfollowed by the removal” - Effect'sexitdocumentation says an interrupted fiber in an interruptible region does not produce anExitvalue. [INFERENCE] When the last bootstrap awaiter is interrupted, the pinnedEffect.cachedimplementation interrupts the installer fiber (node_modules/effect/src/internal/effect.ts:4519–4531). The plainexitalternative can then skip removal and leave the installer files behind, contrary to the cleanup guarantee - UseEffect.onExitand protect directory acquisition through finalizer registration so interruption cannot leave a created directory without cleanup - class: interruptible resource without a guaranteed finalizerPrevious findings:
toolchain: open - repeated aboveBUN_INSTALLthat the probe rejects.Manager response to round 2
Repaired:
Effect.onExit, orEffect.exitthen the removal); a removal failure is typed, keeps its message, and takes precedence over the installer outcome, as the basefinallythrow did.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 4, delta
Plan-review: repair
acquireUseReleasemakes release failure fail the bracket, but the pinned implementation combines it with any installer failure and puts the installer failure first (node_modules/effect/src/internal/effect.ts:177–216,4018–4023,4450–4462). If the spawn bridge fails and removal then fails withEACCES, the oldfinallyrejects with the removal error alone (cli/src/engine-native/bun.ts:95–101). The bracket leaves typed recovery seeing the installer error first, even thoughengineFailureDetailprints the last error - Make the bracket return the installer outcome as a value and replay it only after successful cleanup, so a removal failure is the typed result rather than a second cause - class: finalizer combines failures instead of replacing the installer outcomeEffect.cached; Acceptance,unit- Effect’scachedabandons the computation when the last waiter is interrupted. The pinned implementation clears the in-flight entry before waiting for the worker and discards the worker’s exit (node_modules/effect/src/internal/effect.ts:978–1005,4521–4531). [INFERENCE] If a sync fiber is interrupted while the installer is running, as the sync lock tests exercise for bootstrap (cli/test/unit/syncLock.test.ts:574–622), a subsequentEACCESfrom removal is lost to the waiting fiber. Another call in that same context can also start an install while the first one is still settling, unlike the retained Promise inbun.ts:63–67- Keep the in-flight bootstrap owned by the engine run until cleanup settles, and preserve its typed cleanup failure when a waiter is interrupted - class: waiter cancellation abandons a run-owned installPrevious findings:
toolchainFiles: resolved - The decision maps creation and removal failures toBunInstallFolderFailedwith the original filesystem message, and Step 1 includes both engine error-boundary files.Effect.exitfollowed by the removal”: resolved - The revised decision replaces the interruptible gap withEffect.acquireUseRelease, which protects acquisition and guarantees release after successful acquisition.Manager response to round 3
Repaired:
Effect.acquireUseReleasemakes the folder and registers its removal around the installer calls, so it is removed on success, failure, and interruption.BunInstallFolderFailedwith the original filesystem message;index.tsandcli/src/engine.tsjoin step 1 and carry it to both CLI entry paths.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 5, delta
Plan-review: repair
unit- The run-ownedDeferredprevents a second install, but an interruptibleDeferred.awaitunregisters the waiter (node_modules/effect/src/Deferred.ts:180–192). [INFERENCE] If a second caller is interrupted during installation and removal then fails withEACCES, that caller has already returned with interruption and cannot observeBunInstallFolderFailed. The old bridge waited for the shared Promise to settle (cli/src/engine-native/bridge.ts:49–54,cli/src/engine-native/bun.ts:63–67). The ordinary concurrency case inunitdoes not distinguish these outcomes - Specify how an interrupted caller waits for settlement and preserves the typed cleanup failure at the engine boundary without restarting the install - class: waiter cancellation discards the shared cleanup resultspawnProcessbridges incli/src/engine-native/bun.ts:44–57leaves both installer calls under the new outer mask. An interrupt during a stalled installer then remains pending instead of stopping the child, as documented forEffect.uninterruptible- Limit masking to the legacy calls and cleanup, or record the full mask as a Move the toolchain passes to Effect #298-only exception and make narrowing it part of Move the process layer, the file helpers, and the kit store to Effect #297's process cutover - class: outer interruption mask survives the process cutoverPrevious findings:
Effect.exit, removes the folder, and replays the installer outcome only if removal succeeds.Effect.cached; Acceptance,unit: open - repeated above. The run-ownedDeferredfixes duplicate installs, but the interrupted waiter's cleanup result is still unprotected.Manager response to round 4
Repaired:
Effect.exit, removes the folder, then fails with the removal failure alone or replays the installer outcome, as the basefinallydid.Deferredof itsExit; a waiter's interruption neither stops the region nor starts a second install.Effect.cachedis rejected.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 6, delta
Plan-review: repair
Deferred.await”; Acceptance,unit- The mask keeps the waiter attached until cleanup finishes, butDeferred.awaitreturns the storedExitas a value. [INFERENCE] If the waiter is interrupted and folder removal then fails withEACCES, Effect delivers the pending interruption when the await mask ends, before the waiter can replayBunInstallFolderFailed(node_modules/effect/src/Deferred.ts:180–192,1559;node_modules/effect/src/internal/effect.ts:4609–4626). Even moving replay inside the mask does not protect an engine recovery handler outside it: Effect can drop the typed failure when interruption skips that handler (node_modules/effect/src/internal/core.ts:647–660). The ordinary concurrency case still passes without detecting either loss - Specify how the engine observes the typed cleanup failure before interruption can discard it, and make the existingunitconcurrency case distinguish that failure from interruption alone - class: waiter cancellation discards the shared cleanup resultPrevious findings:
unit: open - repeated above.Manager response to round 5
Repaired:
Deferreduninterruptibly, as the base bridge waited for the shared Promise, so it observes a typed cleanup failure and never starts a second install.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 7, delta
Plan-review: pass
None.
Previous findings:
Deferred.await”; Acceptance,unit: rejected - not repeated. Round 7 clarifies that interruption takes precedence for an interrupted waiter. During CLI bootstrap, SIGINT and SIGTERM exit the process rather than interrupting the waiter: exit 130 for either signal on the public path (cli/src/engine.ts:61–84,137–139), and exit 130 or 143 on the raw path (cli/src/main.ts:40–50).Manager response to round 6
Repaired:
Rejected:
cli/src/engine.tsexitOnSignal,cli/src/main.ts, Move the engine seam and the sync orchestration to Effect #294 Signals decision), so no consumer observes the difference; the basebridgePromisegave an interrupted waiter the same outcome. This finding class returned in rounds 4 to 6 with a new Effect detail each time.Redesigned: none.
4 remaining items
DocksDocks commentedon Dec 2, 2026
Plan review round 8, delta
Plan-review: repair
repairs(line 40); Acceptancescan(line 52) - The step calls for the basenode:fsoperation insideEffect.try. That operation ismkdtempSync(cli/src/engine-native/bun.ts:95), so restoring it as specified makes the fixed-string scan return 0 instead of the required 1 - Specify callback-basednode:fsmkdtempthroughEffect.callback, passing the prefix unchanged and preserving the typed error, or explicitly allow the one wrapped synchronous call inscan- class: repair contradicts acceptance scanrepairs(line 40); Acceptanceunitandcommands(lines 47–48) - The repair changes real installer staging, but the spawnedensurecases reject an unknown tool or use--dry-run(cli/test/unit/toolchain.test.ts:136–179), which returns before creating the folder (cli/src/engine-native/bun.ts:89–95). The spawnedoutdatedcase does not install Bun. The checks can therefore pass while a symlink followed by..inTMPDIRstill sends the installer to the wrong directory - Extend the existingunitrow to cover a spawnedtoolchain ensure bunwith stubbed installer commands and assert that staging occurs under the OS-resolved temporary parent - class: changed CLI path lacks end-to-end acceptancePrevious findings:
None.
Manager response to round 7
Plan edits after the round-7 pass:
repairs: the Bun temporary folder made with the original prefix passed to the OS (no lexical folding ofTMPDIR), the bounded-probe receiver, a bounded and env-file-free spawnedtoolchain outdatedchild, a folder-creation failure case, a typed fixture, and three guidance corrections..agents/skills/sync-orchestration-context/SKILL.mdand.agents/skills/omp-sync-context/SKILL.md, which step 1 changed for their source ranges and stale bridge sentences.DocksDocks commentedon Dec 2, 2026
Plan review round 9, delta
Plan-review: repair
repairs(line 40); Acceptanceunitandcommands(lines 47–48) - The new in-process case checks wherebunBootstrapcreates the folder, but it does not run the CLI under Bun. The spawnedensurecases reject an unknown tool or use--dry-run(cli/test/unit/toolchain.test.ts:136–179), which returns before staging (cli/src/engine-native/bun.ts:89–98). The spawnedoutdatedcase does not install Bun. Acceptance can pass without observing whether a realensure bunstages under the OS-resolvedTMPDIRparent - Run the planned symlink case through a spawnedtoolchain ensure bunwithout--dry-run, stub the external installer commands, and have the existingunitrow require that the installer stages under the OS-resolved parent - class: changed CLI path lacks end-to-end acceptancePrevious findings:
repairsand Acceptancescan: resolved - Line 40 now specifies callback-basednode:fsmkdtempthroughEffect.callback, with the original prefix and typed failure preserved. It no longer requires themkdtempSync(call thatscanrejects.repairsand Acceptanceunitandcommands: open - repeated above.Manager response to round 8
Repaired:
node:fscall throughEffect.callback, with the prefix unchanged, so thescanrow still holds.TMPDIRof a symlink followed by..; it asserts the OS-resolved parent. The staging path is computed only inbun.ts, so the in-process case reaches the same code as the CLI.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 10, delta
Plan-review: repair
repairs(line 40); Acceptanceunitandcommands(lines 47–48) - Steprepairsnow plans a realtoolchain ensure bunrun, but neither Acceptance row names its staging assertion.unitcan meet its stated expectations if the new case is omitted: the existing public install preview incli/test/unit/toolchain.test.ts:157–179returns before staging incli/src/engine-native/bun.ts:89–98, andcommandsonly runsoutdated- Add the expected staging result to the existingunitrow: the spawnedensure bunmust stage under the OS-resolved parent of the symlink-basedTMPDIR- class: changed CLI path lacks end-to-end acceptancerepairs(line 40); Acceptanceunit(line 47) - The new fixture setsTMPDIRwithout limiting the case to POSIX. The Windows CI shards run the same unit suite (.github/workflows/parity.yml:98–126;vitest.config.ts:43–46), but Bun 1.4.5'sos.tmpdir()ignoresTMPDIRon Windows. Since bootstrap takes its staging prefix fromtmpdir()(cli/src/engine-native/bun.ts:95–98), the Windows child would stage outside the fixture even with the correct implementation - Make the symlink-basedTMPDIRcase POSIX-only and state that scope inunit- class: platform-specific fixture in a portable suitePrevious findings:
repairsand Acceptanceunitandcommands: open - repeated above. Line 40 now specifies the spawned install case, but Acceptance still does not require its staging result.Manager response to round 9
Repaired:
toolchain ensure bunwithout--dry-run, with Bun absent, stub installer commands first onPATH, and the symlinkTMPDIR; it asserts that the installer stages under the OS-resolved parent.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 11, delta
Plan-review: pass
None.
Previous findings:
repairsand Acceptanceunitandcommands: resolved - Acceptanceunitnow requires the spawnedtoolchain ensure bunto stage the installer under the OS-resolved parent of the symlink-basedTMPDIR.repairsand Acceptanceunit: resolved - Both the step and the acceptance row limit that case to Linux and macOS, where Bun honorsTMPDIR.Manager response to round 10
Repaired:
unitrow requires the staging result of the spawnedtoolchain ensure buncase.TMPDIRon Windows.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 2, delta
Code-review: pass
Previous findings
ppreserves the literal prefix passed tomkdtempat lines 179-188.bounded.call(exec, ...)preserves the receiver at line 234.execasthisat line 234.--no-env-fileat line 233.mutationRegionsignal deferral from the Bun fiber mask. The new timing overstatement is listed below.LegacyStepFailed.Ctxwithout a cast at lines 128-145.Standards
noexectemp mount, the fixture'scurlandbashstubs cannot execute. The test retains any runner PATH directory without Bun, so, assuming that PATH contains realcurlandbash, the inference from the CLI's bare-name probe and spawn is that the test can download and execute the real installer before its assertions fail. - Give the child a fixture-only PATH and use shell builtins in the stubs so neither installer command can fall through to the runner. - class: fail-open installer stub resolutionTMPDIRbreaks the generated shell redirection because both stubs insert the log path into single-quoted source. A newline in the same path also splits one directory into multiple records. The fixture inherits its root fromtmpdir(), so both are valid inputs. - Have each stub write its physical path without a line delimiter to a separate, quoted file under the fixture'sHOME. - class: lossy fixture pathname handlingdirnameit resolves from the runner's PATH. Waiting for the CLI'sclosedoes not wait for that descendant. - Run the fixture CLI in its own POSIX process group and terminate the group on expiry before removing the fixture. - class: incomplete subprocess teardowncurl -oelsewhere, the stub truncates that destination before the test checks where staging happened. The sibling stub in cli/test/unit/bun.test.ts:253-272 already protects its write. - Remove the truncation; thebashstub only records the directory and does not read the script. - class: unchecked fixture write destinationbun.ts:193callsrmSync, so the inference from the JavaScript listener atsignalGuard.ts:48-57is that the handler can run only after the synchronous call returns. The new text explicitly promises immediate exit during removal. - Say the fiber mask does not defer the signal handler, and distinguish that from synchronous cleanup blocking delivery to the handler. - class: overstated signal timingSpec
plan-298-cr2.md:40nevertheless specifies “on Linux and macOS only,” while the fixture skips only Windows. On another platform with a Bun test runtime, it would attempt the fixture instead of skipping it. - Allowlist Linux and macOS in the fixture guard. - class: platform exclusion used as an allowlistDocksDocks commentedon Dec 2, 2026
Plan review round 12, delta
Plan-review: pass
None.
Previous findings:
None open.
Manager response to round 11
Plan edit after the round-11 pass:
repairs-2: a fail-closed spawnedtoolchain ensure bunfixture (fixture-onlyPATH, builtin-only stubs, one record file per stub, no truncation, own process group, Linux and macOS allowlist) and a signal-timing correction in the sync guidance.DocksDocks commentedon Dec 2, 2026
Code review round 3, delta
Code-review: pass
Previous findings
Standards
TMPDIRcontains:, the stub directory becomes multiple POSIX PATH entries. If an entry names a directory with real installer tools, the inference from the bare commands incli/src/engine-native/os/posix.ts:33-38is that the test can run those tools outside the fixture, contrary to the “fixture-onlyPATH” guarantee inplan-298-cr3.md:41. - Resolve the CLI entry before changing the child cwd to the private fixture root, then use the single relative PATH entrystubs. - class: fail-open installer stub resolutionclose, the watchdog'sprocess.killthrowsESRCHoutside the awaited test. The timing is scheduler-dependent. The inference is that Vitest reports an unhandled exception instead of the fixture's deadline diagnostic. - TreatESRCHas an already-ended group and report other signal errors through the awaited test. - class: uncaught watchdog exit racedetached: truekeeps the CLI outside the worker's process group. The inference is that worker cleanup can remove the fixture while the CLI or its stubs are still running, because their only stop path is the worker's timer. - Register the active group with the existing pre-removal shutdown hook and stop and await it before removing the fixture. - class: detached child leaks on worker cancellationSpec
None.
Manager response to round 2
Repaired: every round-2 finding as step 4
repairs-2says (commit c41d9d7).Deferred to the follow-up issue: the round-3 LOW findings, and from round 1 the concurrent-lookup deadline case and the interrupted-waiter case.
Rejected: none.
Redesigned: none.
Move the toolchain passes to Effect
Point the toolchain guidance to the Effect passes
Repair code review round 1 of the toolchain passes
Repair code review round 2 of the toolchain passes
DocksDocks commentedon Dec 2, 2026
Archived with landing pull request #312