Repository navigation
Description
Goal
Child of #290, the last one. Move the process layer, the file helpers, and the kit store to Effect: engine-native/exec.ts (one host-aware process service with typed errors and a kill on interrupt, no direct process exit), processes.ts, atomicWrite.ts, kitDb.ts and kitLock.ts (node:sqlite handles as scoped resources), scratch.ts, home.ts, os/windows.ts (a typed refusal for an argument it cannot encode), and their callers outside engine-native: cli/src/commands/scratch.ts, update.ts, sync.ts (the update nudge), root.ts, and cli/src/plan/services.ts. Remove every bridge that the earlier children of #290 left, and the replaceFile bridge in ompFastMode.ts, so the #290 Acceptance holds. When the bridges of tidy go, remove the hard signal exit of the tidy command (exitOnSignal, deferSignalExit, and signalExitPoint of cli/src/engine.ts, #295) in favor of fiber interruption through the process service, narrow the uninterruptible apply region of tidy.ts applyTidy so that an interrupt stops a running tool call while the tidy.log rotation and append stay protected inside the apply lock, and update the #295 tidy signal case so that it verifies that the tool child is stopped and reaped before the CLI exits; and narrow the uninterruptible Bun bootstrap region of bun.ts (#298) to the folder cleanup, with its awaiters, so that an interrupt stops a stalled installer through the process service. Update cli/src/engine-native/DESIGN.md and the host-platform-context, engine-native-context, and sync-orchestration-context skills to the new contract. Keep the outputs, the exit codes, and the lock behavior unchanged.
Yolo: the user delegated every decision except the merge to the agent.
Mode: plan-and-implement
Research
Repository facts (main at b3b277fd, after #294, #295, #296, and #304; #298 lands first and leaves bridges around its calls into exec.ts, home.ts, kitDb.ts, processes.ts, and the logger):
exec.ts:spawnHostisspawnSyncand callsprocess.exit(2)on a refusal ofhost.invoke;spawnProcessreturns aPromisewith a refusal or spawn error inerror; only a bounded child (timeoutMs) isdetachedon POSIX and ended at its timeout (killProcessTree, lines 185-245); an unbounded child is never stopped.os/types.ts HostOs.invokereturns anInvocation;os/windows.ts assertCommandLineValuethrows for%, CR, or LF in a shim call; the otheros/modules are plain.- Process callers:
update.ts(UpdateSpawn, defaultspawnHost),sync.ts updateNudge(twospawnHost("git", ...)calls, a 4000 ms fetchtimeout),runTool,spawnOmp(no timeout),installBun, anddeps.ts(captureWithinis the only timed probe);kitGate.tscallswhich. Bun 1.4.5spawnSyncgivesENOBUFSpast 1 MiB on one pipe, none for 600 KiB on each (checked). processes.ts processExitedis a synckill(pid, 0)probe.atomicWrite.ts replaceFileis synchronous (awxsibling, chmod, rename, stale cleanup); callers:ompFileDeploy.ts,ompKitPlugin.ts,ompRemovals.ts(bridgeSync),ompFastMode.ts(Effect.try).kitDb.ts withKitDbopensDatabaseSync, secures the modes, migrates, checkpoints after a write or migration, and closes infinally;migrateandinTransactionthrow;readCacheandwriteCache(callertoolchain.ts) turn every throw into a miss or a no-op.kitLock.tsimports onlynode:modules;acquireKitLock(aPromisepoll) has only test callers (alsoRACERandHOLDER). The parent D4 lock scope issyncDispatch.ts scopedKitLock(Move the engine seam and the sync orchestration to Effect #294), pinned bysyncLock.test.ts; tidy takes onetryAcquireKitLocktry.scratch.ts:createScratchDirthrows for a bad label; the removal helpers turn eachnode:fsthrow into arefusedoutcome. Callers:commands/scratch.ts,plan/services.ts(infileOperation), andtidy.ts applyTidy(bridgeSync).home.ts engineHomefalls back toos.homedir().kitHome.tsreadspackage.jsonwithreadFileSyncand throws the fourexplicitKitHomediagnostics; callers:engineCtx.ts(bridged intoKitHomeInvalid),sync.ts,update.ts.fileText.ts(Move the omp passes and the kit store to Effect #296) hasreadTextKeepingBom,pathExists, andnodeError.logger.ts writeIgnoringEpiperethrows a non-EPIPEwrite error, also an asynchronous one (an uncaught exception);flushDurablerethrows the first buffered error; the passes call theLoggerthroughbridgeSync.bridge.tsdefinesLegacyStepFailed,failureText,bridgeSync, andbridgePromise;engine.ts,ompYaml.ts, andompKitPlugin.tsusefailureText. The parentbridges,throws, andpromisesscans match onb3b277fd.engine.ts(noEffect.tryPromise, Move the engine seam and the sync orchestration to Effect #294) and the raw channel ofmain.tsrun insignalGuard.ts exitOnSignal, whose listeners callprocess.exit(code)unlessdeferSignalExitis open and nosignalExitPointwaits; tidy and the passes use them too.- Tidy apply:
planAndApplymasksapplyTidyand its printing;applyTidytakesdeferSignalExit, wrapsgitanddockerinsignalExitPoint, and ends withappendLog; tidy'sgitcalls pass--no-optional-locks(tidy.tsline 961).EXIT_BOUND_MSis 10 000 in the signal tests. - Move the toolchain passes to Effect #298 candidate
c41d9d7d:bunBootstrapmasks all ofrunBunBootstrap, also an unboundeddeps.version("bun")after the folder removal; waiters use theDeferred;toolchain-context/SKILL.mdnames thebridge.tsroute until Move the process layer, the file helpers, and the kit store to Effect #297. - Test doubles:
vi.mockofexec.tsin five stepprocesstests,UpdateSpawnrecorders inupdate.test.ts, and bridge imports in three tests.
Effect and runtime facts (effect 4.1.7, @effect/platform-bun 4.1.7):
NodeRuntime.ts runMaininterrupts the main fiber on SIGINT and SIGTERM and takes ateardown;Runtime.ts defaultTeardowngives 130 only for an interrupt-only cause;signalEngineEntry.tssupplies its own layers and a failing logger finalizer, after whichsyncSignals.test.tsexpects 130.- Process semantics:
detached: truemakes a POSIX child callsetsid, a new session with no controlling terminal (Node); Git can prompt on/dev/ttywith stdin ignored (gitcredentials). A child can emitexitbeforeclose(Node).killreports a zombie as a process (POSIXkill); POSIX_exitgives the children of an exiting process to a system process. Effect.acquireReleasetakes an infallible release (Effect.tsline 14260);DatabaseSync.close()can throw;Writable.writereports errors through its callback.syncDispatch.ts(line 100) andDESIGN.md(148) nameacquireKitLock.talk.jsembeds the version; the payload embedstalk.js.DOCKS_KIT_TEST_CLI_ENTRY,GOLDEN_FILTER, andDRY_RUN, also from a default-loaded.env, change the golden drivers and their CLI children (goldenExecution.ts).BunFileSystem.layerisNodeFileSystem.layer, whoserealPathusesrealpath.nativeon Windows;internal/utils.ts handleErrnoExceptionkeepssyscalland the Node error. On Bun 1.4.5FileSystem.removereportsEPERMasEFAULT(plan-296.md, decision Files).Effect.acquireUseReleaselets the release fail;uninterruptibleMask,Effect.callback,Deferred, andSchedule.spacedexist.ChildProcesslackswindowsVerbatimArguments(parent D2).cli/tsconfig.json allowedUnstableApiscovers the unstable symbols in use. No package has anode:sqlitedriver (D4).
Tool facts: Bun 1.4.5 (SoT/toolchain.json bun.verified), Node v26.13.0, and Git 2.53.0 (2026-12-02); Vitest 5.1.2, effect 4.1.7, @effect/platform-bun 4.1.7, @effect/tsgo 0.74.1 (bun.lock). The windows row runs the portable (windows-2025) unit shards of .github/workflows/parity.yml.
Decisions:
- Process service (delegated):
- Question: the API of the parent D2 service, its stop and refusal, and the fate of
spawnHostand each synchronous caller. - Options: (a) a
Context.ServiceHostProcessinexec.tswhoserunowns the child in its own scope; (b) module-level Effect functions with the host in the options, faked withvi.mockas now; (c) keepspawnHostfor the command callers and move onlyspawnProcess. - Evidence: the test doubles above;
cli/src/services.ts engineServicesLayergives the services as layers;defaultTidyHostinjects the tool calls. - Failure modes: (a) every Effect that spawns needs
HostProcess, and a POSIX group stop needsdetached, which ends a child's terminal access; (b) a module mock hides the seam from the type checker, and a typo in its path runs real children; (c) the nudge andupdatestay blocking, against parent D2. - Reversibility: inside this child; a later plan can swap
HostProcess.layerwith no caller change. - Durability: one spawn path.
HostProcess.run(command, args, options)returnsEffect<ProcessResult, HostArgumentRefused | ProcessStopFailed>;ProcessResultandProcessOptionsrename the async types and addgroup: "own" | "shared"(default"own"),writer, andmaxOutputBytes.runis anEffect.acquireUseRelease: the acquire spawns and records the direct child'sspawn,error, andexitevents at once; the use returns afterclose; the release stops what runs and can fail. An"own"child isdetachedon POSIX and leads its own group; the release works on the group, whatever the leader's state: atESRCHfromkill(-pgid, 0)it is done; else it sendsSIGTERM, polls withSchedule.spaced(PROCESS_GONE_POLL_MS)for up toPROCESS_STOP_GRACE_MS(3000 ms), sendsSIGKILL, and polls with the locks held untilESRCH, with no deadline (SIGKILLcannot be caught, uninterruptible sleep ends with its I/O, and POSIX_exitgives orphans to a reaping system process), so a stop takes the grace period plus the kernel's time; then the release waits for the recorded exit and destroys the pipe ends. On POSIX a"shared"child keeps the CLI's group, session, and terminal; the release sendsSIGTERMto it alone and waits for its exit, asspawnSyncdid. One timeout rule per path: a POSIX"own"bounded probe keeps the base rule (SIGKILLto the group once, destroy the pipes, unref, resolvetimedOutwith the partial output at the deadline); a POSIX"shared"child with a timeout (the 4 s nudge fetch) works asspawnSyncwithtimeout:SIGTERMto the direct child, a wait for its exit, and a result with the child's exit code andtimedOut: true, so the nudge keeps its exit-status check (exit 0 goes on torev-list); Windows stops follow the Windows stop decision. Only an interrupt uses the group poll. Each captured pipe has its ownmaxOutputBytesbudget, as in Bun'sspawnSync: output past it on either pipe stops the child and gives the output so far with anENOBUFSerror; the formerspawnHostcallers that pipe output passSPAWN_SYNC_MAX_OUTPUT(1 MiB), sogit statusover it still takes thegit status failedbranch.trackBoundedChildgoes. - Refusal:
HostOs.invokereturns aResult<Invocation, HostArgumentRefused>with the current message;runfails with it and spawns nothing.refusalAsResultfolds it into a result whoseerrorholds that message, asspawnProcessdid, forrunTool,spawnOmp,installBun,capture, andcaptureWithin, soomp plugin linkstill records a failure and the inventory only warns.update.tsandupdateNudgeturn it intobail(message, 2), asspawnHostdid. The service never exits the process. - Callers:
spawnHostis deleted; no synchronous caller remains.update.tsruns"shared"children with the same argv, stdio, andcwd, with one exception: the status check becomesgit -C <home> --no-optional-locks status --porcelain, so it writes no index, sogit pullcan still prompt, and on POSIX a chained CLI that implements Move the process layer, the file helpers, and the kit store to Effect #297 stops its own groups before the outer CLI sees its exit (on Windows the updater ends it by handle); an older chained entry handles its signal as before, and itsompchild can outlive it, as with the base (known limit);chainSynckeeps its forwarded exit code.updateNudgebecomes an Effect overkitHome,pathExists, and two"shared"runcalls (timeoutMs: 4000for the fetch); the exit status decides, as in the base (a timed-out fetch that exits 0 still reachesrev-list;timedOutalone skips nothing), an ordinary failure stays a silent miss, the refusal exits 2 (parent D2 amendment), and aProcessStopFailedis printed withlogger.warn, thensyncproceeds, and a recorded signal keeps its exit code.defaultTidyHostreadsHostProcessonce, soToolCallkeeps no requirement.whichandcommandExistsstay plain, because the synchronouskitGate.ts headingScanscallswhich(runsrow). - Pre-mortem: a
"shared"child that ignoresSIGTERMkeeps the CLI waiting, asspawnSyncdid; the"shared"children end onSIGTERM. An"own"child that reads the terminal stops withSIGTTIN; engine children have stdin"ignore". ASIGKILLof the CLI leaves the"own"groups running, as before. A PID 1 that does not reap (a container without an init) keeps the post-SIGKILLpoll waiting; the CI hosts have an init. - Choice: (a). Rejected: (b), a test seam that the type checker does not see; (c), against parent D2.
- Question: the API of the parent D2 service, its stop and refusal, and the fate of
- Windows stop (delegated; the policy by operation):
- Question: how a Windows child stops at a timeout and on an interrupt without ending an unrelated process, and which operations need a confirmed exit.
- Options: (a) the handle policy below, with no
taskkill.exeon any path; (b) keep the base best-efforttaskkill /TforcaptureWithintimeouts and at CLI exit; (c) a Job Object. - Evidence:
taskkill /PID /Tselects a numeric PID, and Windows can reuse a PID after the last handle closes (Old New Thing); the base runs it throughspawnSyncafter its exit guard (exec.ts killProcessTree); an async helper cannot pin the identity, and a sync one blocks the runtime;TerminateProcessis asynchronous and can fail; Node and Bun have no Job Object API. Lock holders: the sync CLI holds the sync locks (forupdate, the chained CLI),tidy --applythe apply lock (not its report); the updater andtoolchain ensure bunhold none. - Failure modes: (a) descendants survive, and a writer that cannot be terminated keeps the CLI waiting until the user ends it; (b) a recycled PID can name an unrelated process, or the runtime blocks; (c) needs native code.
- Reversibility: a later plan can add a Job Object behind the layer.
- Durability: every stop of every Windows child, at a timeout or an interrupt, kills the direct child through its handle (which pins the identity), disposes of the parent's pipe ends, and observes the direct child's
exitapart fromclose. The writers (spawnOmp, the Bun installer, also intoolchain ensure bun, the tidy apply tool calls, the chained sync CLI, and theupdatechildrengit pull --ff-only,bun install --frozen-lockfile, and the global package install) then wait for thatexitwith no deadline before their scope, and any lock scope above it, closes; a failed kill keeps waiting, so no lock releases while a writer runs, and the recorded signal still decides the exit code. The read-only children (captureandcaptureWithinprobes, tidy report reads, the nudgerev-list, andupdate'sgit status --porcelain, run with--no-optional-locks, as tidy's calls are, so it writes no index) and one delegated exception, the nudgegit fetchat its 4 s deadline (it writes refs; on interrupt it is a writer), resolve after the kill with no wait: they dispose of the pipes andunref()a still-live child, as the base did, so the CLI can exit; a failed kill of a live one givesProcessStopFailed, whichcaptureWithinmaps totimed-out(toolchain checkprintsunknown) and the nudge prints beforesyncproceeds. The nudge's deadline return is an intentional Windows change (the basespawnSyncwaited). Descendants and an unkillable no-wait child are known limits. - Pre-mortem: a Windows wrapper leaves a writer running; no guard beyond the base.
- Choice: (a). Rejected: (b) for the PID reuse or a blocked runtime, (c) for native code.
- Signals (delegated):
- Question: how a signal ends
tidy, the public run, and the raw channel once children are interruptible, and whatapplyTidyprotects. - Options: (a) remove the hard exit; the runtime interrupts the fiber, the process service stops each child and reaps it (apart from the Windows no-wait children of the Windows stop decision), and only the started mutations and the tidy log step stay uninterruptible; (b) keep the hard exit and add a child kill to the exit handler.
- Evidence:
runMainandRuntime.tsabove; the parentsignal-orderandthrowsrows; the Goal. - Failure modes: (a) a mutation region or a stop delays the exit by the grace period plus the end of the group, and a second signal does not shorten it; (b) the OS releases the locks while a child still writes (
signal-orderforbids it). - Reversibility: inside this child.
- Durability:
signalGuard.tskeeps the exit codes andmutationRegion(nowEffect.uninterruptible(mutation)); the signal state, the old helpers, and everyprocess.exitgo. A newrecordSignal(codes)records the first signal's code;main.tsandsignalEngineEntry.tsgiverunMainateardownthat exits with it after every finalizer, so a failing finalizer after a signal still gives 130. The raw channel runs withEffect.runFork; its listeners also interrupt the fiber, andmain.tsexits with the recorded 130 or 143 after it ends.applyTidyruns its actions interruptibly (eachprocess.killstop and scratch removal is one unsplittable step) and always ends with onemutationRegionthat rotates and appendstidy.logwith the lines so far and prints them (Effect.onExit), inside the apply lock;planAndApplyno longer prints the apply lines and keepsprocess.exitCode = 1for failures. - Pre-mortem: an edit puts a tool call back into the protected log step. Guard: the tidy signal case checks that the tool child is stopped and reaped before the CLI exits, and the
bridgesrow lists every remainingEffect.uninterruptible. - Choice: (a). Rejected: (b). On Windows a forced termination stays as it is (parent ownership table).
- Question: how a signal ends
- Logger (delegated):
- Question: how a stream write error reaches the typed channel without the logger bridges.
- Options: (a) each
Loggermethod returnsEffect<void, LoggerWriteFailed>; the first asynchronous non-EPIPEerror is recorded, and every later call andlogger.settlefail with it; (b) the methods stay synchronous, never throw, and a recorded error surfaces only atsettle. - Evidence:
writeIgnoringEpipeandflushDurableabove. - Failure modes: (a) every call site changes to
yield*; (b) a failed write is followed by more writes and the run fails later than now. - Reversibility: inside this child.
- Durability: (a) keeps the current order: a synchronous write error fails the call at once with the bridge's text;
EPIPEis ignored; a stream write stays pending until its callback runs;settlewaits interruptibly for no pending write and then fails with the first recorded error;runEngineNativeruns it only on success or a failure exit, so the last ledger write's error still fails the run and comes last, as a throwingfinallydid. The lease becomeswithTerminal(message, use), anEffect.acquireUseReleasewhose release (the progress erase) fails withLoggerWriteFailed, used byrunPipeline, which prints a failed pipeline's ledger withEffect.catchCause;withExclusiveflushes in its release and fails the section withLoggerWriteFailed; no uninterruptible region (lease draw, lease erase, exclusive flush) waits for a callback: each submits its writes and fails only with a synchronous or recorded error, so a signal never waits on a stalled sink.deps.warnMissingandrecordFailurebecome Effects; the logger bridges go. - Pre-mortem: a write fails after
settlereturned. Guard:settlewaits for every submitted write's callback, and the error listener records any non-EPIPEerror without a throw. - Choice: (a). Rejected: (b).
- Files (delegated, one line):
atomicWrite.ts, the effectfulscratch.tsexports, andkitHome.tsbecome Effects overFileSystemwith the same order, modes, outcomes, and texts;replaceFileruns its write, chmod, rename, and cleanup in onemutationRegion;kitHome.tsreads throughreadTextKeepingBom, keeps its diagnostics (nodeError), and ownsKitHomeInvalid;scratch.tskeepsnode:fsrealpathSyncandrmSyncinEffect.try, becauseFileSystem.realPathis native on Windows andFileSystem.removeon Bun 1.4.5 reportsEPERMasEFAULT; a bad label isScratchLabelInvalid;home.tsstays andprocessExitedbecomesEffect.sync; the bridges aroundengineHomego;os/apart from the refusal,errorText.ts(which takesfailureTextfrombridge.ts),jq.ts, andsharedTypes.d.tsstay plain. - Kit store (delegated, one line):
kitDb.ts withKitDb(home, access, use)opens one handle withEffect.acquireUseRelease, withEffect.tryovernode:sqliteandFileSystemfor the modes; its release (the checkpoint after a write or migration, thenclose) can fail, so a failed close stays a typedKitDbFailed; a newer schema isKitDbTooNewwith the current text;inTransactionis anEffect.uninterruptibleMaskthat commits or rolls back and keeps the original failure;readCacheandwriteCachekeep their miss and no-op, andtoolchain.tsyields them unbridged. - Kit lock (delegated, one line):
acquireKitLock,KitLockResult, and the poll options go, becausescopedKitLockis the parent D4 lock scope; itsEffect.sleeploop stays; theRACERfixture retriestryAcquireKitLockon its own 50 ms loop, theHOLDERfixture tries once, the other tests calltryAcquireKitLock, and the in-process poll cases go;syncDispatch.ts(its poll comment) andDESIGN.mdline 148 stop naming it in stepstore. - Bun bootstrap (delegated, one line): the bootstrap runs interruptibly (probes, logger, installers,
deps.version); only the folder and the shared outcome are protected: the temporary folder is anEffect.acquireUseRelease(creation in the acquire,rmSyncin the release, whose failure fails the bootstrap withBunInstallFolderFailed, as the basefinallydid), andbunBootstrapclaims theDeferredand completes it with the run'sExitinEffect.uninterruptibleMaskwith the run restored; other callers wait interruptibly. - Plan scratch caller (delegated, one line):
PlanFiles.layerbecomes aLayer.effectoverFileSystem, andscratchFolderyieldscreateScratchDir, mapping its failures to the sameFileError; the otherfileOperationadapters stay. - Bridges (delegated, one line):
bridge.tsand its test go with the last caller;LegacyStepFailedleavesEngineFailure;commands/tidy.tsdrops itsEffect.uninterruptibleand bridge; each remainingEffect.trywraps anode:module (child_process,fswhere noted,sqlite), akitLock.tsprimitive,process.kill,JSON.parse, aBunAPI, or a package. - Failure model (delegated, one line):
replaceFilestays atomic (a crash can leave a temporary file that the next write removes);tidy.logrotation and append are one region inside the apply lock (a crash between them leaves onlytidy.log.1, as now); the cache rows are one SQLite transaction (a failure is a miss); the lock rows are open transactions that the scope or the OS releases; a half-made scratch folder is an empty one that tidy removes, as now; each failure keeps its base ledger entry, text, and exit code. - Version (delegated, one line):
AGENTS.mdrequires a bump for a user-visible change (a signal now stops the running children and keeps the locks until they end); step 6 bumps to the next patch after main's, adds aCHANGELOG.mdentry in user terms, builds the talk bundle before the payload, then runsgolden:mutation --update-goldensandbun fmtonmutation.json, each build and golden run asbun --no-env-filewithDOCKS_KIT_TEST_CLI_ENTRYandGOLDEN_FILTERunset, with no.env*file on disk in the launch folder (afindwhose exit status is checked before its output, since the golden CLI children load dotenv);goldens-versionderives the expected file fromorigin/mainwith only the version bumped and compares bytes; publication stays outside.
Steps
| # | Id | Task | Files | Depends | Effect | Status | Done when |
|---|---|---|---|---|---|---|---|
| 1 | process | Add HostProcess and HostArgumentRefused with the typed refusal of os/windows.ts; move every spawn caller and kitHome.ts, delete spawnHost, narrow the Bun bootstrap, and remove the process bridges; port the tests and signalEngineEntry.ts to a HostProcess layer; add the cases of the unit-process row |
cli/src/engine-native/exec.ts, cli/src/engine-native/os/types.ts, cli/src/engine-native/os/posix.ts, cli/src/engine-native/os/windows.ts, cli/src/engine-native/deps.ts, cli/src/engine-native/bun.ts, cli/src/engine-native/engineCtx.ts, cli/src/engine-native/ompChild.ts, cli/src/engine-native/ompPlugins.ts, cli/src/engine-native/tidy.ts, cli/src/engine-native/tidyReport.ts, cli/src/engine-native/services.ts, cli/src/engine-native/index.ts, cli/src/services.ts, cli/src/kitHome.ts, cli/src/engine.ts, cli/src/commands/update.ts, cli/src/commands/sync.ts, cli/src/commands/tidy.ts, cli/test/unit/exec.test.ts, cli/test/unit/os/windows.test.ts, cli/test/unit/os/linux.test.ts, cli/test/unit/os/darwin.test.ts, cli/test/unit/deps.test.ts, cli/test/unit/bun.test.ts, cli/test/unit/update.test.ts, cli/test/unit/syncUpdateNudge.test.ts, cli/test/unit/kitHome.test.ts, cli/test/unit/ompPluginInventory.test.ts, cli/test/unit/ompRemovals.test.ts, cli/test/unit/syncLock.test.ts, cli/test/unit/tidy.test.ts, cli/test/unit/tidyReport.test.ts, cli/test/lib/signalEngineEntry.ts |
- | local | done | the unit-process, kithome, and update-cli rows pass |
| 2 | store | Move atomicWrite.ts, processes.ts, scratch.ts, and kitDb.ts; delete acquireKitLock (fixtures and tests to tryAcquireKitLock); remove the bridges around these modules and engineHome; move their command and plan callers; add the spawned scratch new and scratch remove cases |
cli/src/engine-native/atomicWrite.ts, cli/src/engine-native/processes.ts, cli/src/engine-native/scratch.ts, cli/src/engine-native/kitDb.ts, cli/src/engine-native/kitLock.ts, cli/src/engine-native/syncDispatch.ts, cli/src/engine-native/toolchain.ts, cli/src/engine-native/ompFastMode.ts, cli/src/engine-native/ompFileDeploy.ts, cli/src/engine-native/ompKitPlugin.ts, cli/src/engine-native/ompRemovals.ts, cli/src/engine-native/tidy.ts, cli/src/engine-native/engineCtx.ts, cli/src/commands/tidy.ts, cli/src/commands/scratch.ts, cli/src/commands/root.ts, cli/src/plan/services.ts, cli/src/engine-native/DESIGN.md, cli/test/unit/atomicWrite.test.ts, cli/test/unit/scratch.test.ts, cli/test/unit/home.test.ts, cli/test/unit/kitDb.test.ts, cli/test/unit/kitLock.test.ts, cli/test/unit/folderLockCreate.test.ts, cli/test/unit/ompFastMode.test.ts, cli/test/unit/tidy.test.ts, cli/test/unit/toolchain.test.ts, cli/test/unit/toolchainOutdated.test.ts, cli/test/unit/rootFlags.test.ts |
1 | local | done | the unit-store, scratch-caller, plan-scratch, and commands rows pass |
| 3 | logger | Cut the logger over, withTerminal included; move deps.warnMissing, recordFailure, and every logger call to yield*; remove the logger bridges, move failureText to errorText.ts, and delete bridge.ts and bridge.test.ts |
cli/src/engine-native/logger.ts, cli/src/engine-native/errorText.ts, cli/src/engine-native/bridge.ts, cli/src/engine-native/failures.ts, cli/src/engine-native/deps.ts, cli/src/engine-native/services.ts, cli/src/engine-native/index.ts, cli/src/engine-native/modes.ts, cli/src/engine-native/parseHelp.ts, cli/src/engine-native/syncDispatch.ts, cli/src/engine-native/toolchain.ts, cli/src/engine-native/bun.ts, cli/src/engine-native/ompSync.ts, cli/src/engine-native/ompFileDeploy.ts, cli/src/engine-native/ompKitPlugin.ts, cli/src/engine-native/ompPlugins.ts, cli/src/engine-native/ompRemovals.ts, cli/src/engine-native/ompYaml.ts, cli/src/engine.ts, cli/src/services.ts, cli/src/commands/sync.ts, cli/test/unit/logger.test.ts, cli/test/unit/bridge.test.ts, cli/test/unit/engine.test.ts, cli/test/unit/engine-di.test.ts, cli/test/unit/syncPipelineFailure.test.ts, cli/test/unit/envGlobals.test.ts, cli/test/unit/services.test.ts, cli/test/unit/deps.test.ts, cli/test/unit/ompKitPlugin.test.ts, cli/test/unit/ompRemovals.test.ts, cli/test/unit/ompPluginInventory.test.ts, cli/test/unit/syncLock.test.ts, cli/test/unit/syncUpdateNudge.test.ts |
2 | local | done | the unit-logger, logger, and gone rows pass, apart from its signal names |
| 4 | signals | Cut the signals over: reduce signalGuard.ts, add the recorded-signal teardown, narrow applyTidy to the protected log step, and update the tidy and sync signal cases |
cli/src/engine-native/signalGuard.ts, cli/src/engine-native/tidy.ts, cli/src/commands/tidy.ts, cli/src/engine.ts, cli/src/main.ts, cli/test/unit/tidy.test.ts, cli/test/unit/syncSignals.test.ts, cli/test/lib/signalSelfPreload.ts, cli/test/lib/signalEngineEntry.ts |
3 | local | done | the unit-signals, tidy-signal, signal-order, runs, bridges, promises, throws, and gone rows pass |
| 5 | guidance | Update DESIGN.md and the skills to the new contract: the process service, the typed refusal, no direct exit, the Effect forms of the file and store helpers, the removed bridges and hard signal exit, and the nudge lines |
cli/src/engine-native/DESIGN.md, .agents/skills/host-platform-context/SKILL.md, .agents/skills/engine-native-context/SKILL.md, .agents/skills/sync-orchestration-context/SKILL.md, .agents/skills/sync-orchestration-context/references/dispatch-flow.md, .agents/skills/tidy-context/SKILL.md, .agents/skills/omp-sync-context/SKILL.md, .agents/skills/omp-sync-context/references/state-and-launcher.md, .agents/skills/toolchain-context/SKILL.md |
4 | local | done | the guidance row passes |
| 6 | release | Bump the patch version, add the changelog entry, build the talk bundle, then the payload, then update and format the mutation goldens, with no .env* file in the checkout root, as the Version decision says |
package.json, CHANGELOG.md, cli/src/generated/sotPayload.ts, SoT/.omp/plugin/extensions/talk.js, cli/test/goldens/mutation.json |
5 | local | done | the generated, goldens, goldens-version, and gate rows pass |
Acceptance
| ID | Command | Expected |
|---|---|---|
| deps | bun install --frozen-lockfile in the linked worktree |
Exit 0 |
| unit-process | bun x --no-install vitest run --reporter=verbose cli/test/unit/exec.test.ts cli/test/unit/os/windows.test.ts cli/test/unit/os/linux.test.ts cli/test/unit/os/darwin.test.ts cli/test/unit/deps.test.ts cli/test/unit/bun.test.ts cli/test/unit/update.test.ts cli/test/unit/syncUpdateNudge.test.ts cli/test/unit/kitHome.test.ts cli/test/unit/ompPluginInventory.test.ts cli/test/unit/ompRemovals.test.ts cli/test/unit/syncLock.test.ts cli/test/unit/tidyReport.test.ts |
Exit 0, with every base case kept with its texts (refusal cases assert HostArgumentRefused; the tree assertion of the base timeout case runs on POSIX only, and on Windows that case asserts the partial output and the direct child's end), no vi.mock of exec.ts, and new cases: on Linux and macOS, an interrupt of an "own" run sends SIGTERM to the group of a child that traps it and completes only after the child and its grandchild exited, also when the leader exited first while the grandchild holds the pipes; a group that ignores SIGTERM gets SIGKILL after PROCESS_STOP_GRACE_MS, and the interrupt completes only after kill(-pgid, 0) gives ESRCH; a shared run whose child writes 1.1 MiB to stdout gives ENOBUFS and updateCheckout prints git status failed, while 600 KiB on each pipe takes the dirty-checkout branch; a POSIX bounded probe whose child ignores its pipes and does not exit resolves timedOut at the deadline with no wait for the exit; a shared child keeps the test's process group, and at a 4 s timeout a wrapper that handles SIGTERM and exits 0 gets SIGTERM alone, run resolves after its exit with exit code 0 and timedOut: true, and the nudge goes on to rev-list; a refused argument spawns nothing; updateCheckout and updateNudge with a refusing HostProcess layer print the encoder's text and exit 2; a refused omp plugin link records the failure and the inventory only warns; an interrupt of a Bun bootstrap stops a waiting installer and a waiting bun --version probe, removes the temporary folder, and gives the interruption to every awaiter |
| unit-store | bun x --no-install vitest run --reporter=verbose cli/test/unit/atomicWrite.test.ts cli/test/unit/scratch.test.ts cli/test/unit/home.test.ts cli/test/unit/kitDb.test.ts cli/test/unit/kitLock.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/ompFastMode.test.ts cli/test/unit/tidy.test.ts cli/test/unit/toolchain.test.ts cli/test/unit/toolchainOutdated.test.ts cli/test/unit/rootFlags.test.ts cli/test/unit/ompKitPlugin.test.ts cli/test/unit/ompRemovals.test.ts |
Exit 0, with every base case kept with its texts apart from the in-process acquireKitLock poll cases; the four cross-process cases pass with fixtures that call tryAcquireKitLock; new cases: an interrupt during replaceFile leaves the old or the new content and no temporary file; a kit.db that cannot be opened is a miss for readCache and a no-op for writeCache; a too-new schema fails with KitDbTooNew, and a bad scratch label with ScratchLabelInvalid, each with the current text |
| unit-logger | bun x --no-install vitest run --reporter=verbose cli/test/unit/logger.test.ts cli/test/unit/engine.test.ts cli/test/unit/engine-di.test.ts cli/test/unit/syncPipelineFailure.test.ts cli/test/unit/envGlobals.test.ts cli/test/unit/services.test.ts cli/test/unit/deps.test.ts cli/test/unit/ompKitPlugin.test.ts cli/test/unit/ompRemovals.test.ts cli/test/unit/ompPluginInventory.test.ts cli/test/unit/syncLock.test.ts cli/test/unit/syncUpdateNudge.test.ts |
Exit 0, with every base case kept with its texts; a signal while the lease draws on a stalled sink ends the run with no wait for the sink; the bridge cases use a failing Effect pass with the same printed text; a sink that throws synchronously fails the call with LoggerWriteFailed and the bridge's run text; a callback error after the last write fails settle with LoggerWriteFailed, also after a pipeline failure; a progress erase that throws in the release of withTerminal fails the run with LoggerWriteFailed |
| unit-signals | bun x --no-install vitest run --reporter=verbose cli/test/unit/tidy.test.ts cli/test/unit/syncSignals.test.ts cli/test/unit/engine.test.ts cli/test/unit/rootFlags.test.ts |
Exit 0; the rotation case keeps every line printed and logged and exit 130; the recheck case asserts that the first entry is removed, printed, and logged, the second entry stays, and the exit is 130; the public run whose logger finalizer fails still exits 130 |
| tidy-signal | bun x --no-install vitest run --reporter=verbose cli/test/unit/tidy.test.ts -t "SIGTERM" |
Exit 0 on Linux and macOS; in the docker rm case of --apply and in the two du cases of --report, the waiting stub writes an acknowledgment of the SIGTERM from the CLI and waits at a test barrier; while it waits, the CLI process is still alive; the test opens the barrier, and when the CLI's close event comes, process.kill(<stub pid>, 0) gives ESRCH and the exit is 130; the apply lines and tidy.log hold the steps that finished |
| kithome | bun x --no-install vitest run --reporter=verbose cli/test/unit/kitHome.test.ts |
Exit 0, with a case that provides a recording FileSystem layer and shows that both manifest reads of the resolver go through it, and a case where a failing read gives the resolver's current diagnostic (#297) |
| logger | bun x --no-install vitest run --reporter=verbose cli/test/unit/logger.test.ts |
Exit 0, with a case where an asynchronous write error that is not EPIPE reaches the typed error channel of the run, and one where EPIPE is ignored (#297) |
| signal-order | bun x --no-install vitest run --reporter=verbose cli/test/unit/syncSignals.test.ts |
Exit 0; on Linux and macOS, in both channels, with an agent folder and a data root that resolve to different folders and a writing stub child that cannot finish on its own: after one signal to the CLI process, the CLI stops the child with a catchable signal; the stub acknowledges that stop request and waits at a test barrier, and while it waits a same-home sync finds the home lock held, and syncs of other homes find the agent-folder lock and the data-root lock held, each checked on its own; the test then opens the barrier, the stub finishes its shutdown, and the CLI exits within the test bound, with no kill from the test on the passing path; after that, each competitor takes its lock; in a second case a wrapper stub exits on the first signal while its writer child ignores it, and the CLI kills the group after the grace period; no lock is free while any process of the group runs, with no help from the test; the channel exit codes stay (#297 extends the #294 cases) |
| commands | bun x --no-install vitest run --reporter=verbose cli/test/unit/tidy.test.ts cli/test/unit/scratch.test.ts cli/test/unit/toolchainOutdated.test.ts |
Exit 0, with spawned CLI cases in isolated homes that assert: tidy lists a seeded idle scratch folder, and tidy --report prints, inside its Package and tool caches section, the measured entry of a seeded .npm folder on Linux and macOS, and the support notice on Windows (#295); scratch new <label> prints a folder that exists under the scratch root, and scratch remove <that folder> deletes it (#297); toolchain outdated 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 (#298) |
| update-cli | bun x --no-install vitest run --reporter=verbose cli/test/unit/commandsReporting.test.ts -t "installs the new release on a Bun global install whose package cache is stale" |
Exit 0: the spawned update --no-sync exits 0 and prints Updated 0.1.0 -> 0.2.0. through the process service |
| plan-scratch | bun x --no-install vitest run --reporter=verbose cli/test/unit/plan/checkout-state.test.ts -t "is listed by its bytes" |
Exit 0 on a host that holds non-UTF-8 names: the listing reaches PlanFiles.scratchFolder and keeps the bytes of each path |
| red | The red baseline of practices.md for each step that adds behavior (process, logger, signals): the new-behavior spec cases, staged before the step's production code, run with bun x --no-install vitest run --reporter=verbose <files> -t "<names>" |
Each fails on an assertion or on a symbol that the step adds; Verification Results hold the Red baseline, step <id>: lines; parity cases (kept texts, the scratch round trip, the kithome reads, the exit 2 of a refusal, the 130 of a failing finalizer) are outside this row |
| runs | git grep -nE -e 'Effect\.run[A-Za-z]*\(' -- cli/src ':!cli/src/generated' |
Exit 0; matches only in cli/src/main.ts and in baseBlobSync of cli/src/plan/checkout.ts |
| bridges | git grep -nE -e 'Effect\.promise\(' -e 'Effect\.tryPromise\(' -e 'Effect\.try\(' -e 'Effect\.uninterruptible\(' -e 'Effect\.uninterruptibleMask\(' -- cli/src/engine-native cli/src/engine.ts cli/src/main.ts cli/src/commands cli/src/skills/kitGate.ts cli/src/kitHome.ts |
No Effect.promise; no Effect.uninterruptible or Effect.uninterruptibleMask bridge; the only region matches are the mutationRegion definition of signalGuard.ts, the outcome region of the Bun bootstrap in bun.ts, and the SQLite transaction region of kitDb.ts (parent bridges row), and no mask covers all of applyTidy; each other match wraps a runtime or third-party call (node: modules that FileSystem lacks, node:sqlite, the synchronous primitives of kitLock.ts (D4), fetch, a Bun API, or a package), and the #297 Verification Results list each match with its callee; no match wraps runEngineNative, planTidy, applyTidy, acquireKitLock, buildTidyReport, createScratchDir, replaceFile, or another export of cli/src/engine-native, apart from tryAcquireKitLock, releaseKitLock, and preparePrivateLockDirectory (D4) |
| promises | git grep -nE -e '^[[:space:]]*([^/*[:space:]].*)?Promise<' -e '^[[:space:]]*([^/*[:space:]].*)?async function' -e '^[[:space:]]*([^/*[:space:]].*)?async \(' -- cli/src/engine-native ':!cli/src/engine-native/sharedTypes.d.ts' |
Exit 1, no match outside comments; sharedTypes.d.ts keeps the FetchLike type of the injected fetch |
| throws | git grep -nE -e '^[[:space:]]*([^/*[:space:]].*)?\bthrow\b' -e '^[[:space:]]*([^/*[:space:]].*)?process\.exit' -- cli/src/engine-native ':!cli/src/engine-native/kitLock.ts' |
Exit 1, no match outside comments: each failure is in the error channel; kitLock.ts keeps its node:-only primitives (D4) |
| scratch-caller | git grep -n -e 'createScratchDir(' -- cli/src/plan |
The one call in cli/src/plan/services.ts yields the Effect of scratch.ts and is not inside fileOperation; the other fileOperation adapters of cli/src/plan/ stay outside this plan |
| gone | git grep -n -e 'bridgeSync' -e 'bridgePromise' -e 'LegacyStepFailed' -e 'spawnHost' -e 'spawnProcess' -e 'acquireKitLock' -e 'KitDbTooNewError' -e 'exitOnSignal' -e 'deferSignalExit' -e 'signalExitPoint' -- cli/src cli/test ':!cli/src/generated'; test ! -e cli/src/engine-native/bridge.ts |
The grep exits 1 and the test exits 0 |
| goldens | On the reviewed commit with git status --porcelain empty: out="$(find . -maxdepth 1 -name '.env*' -print)" && test -z "$out" && env -u DOCKS_KIT_TEST_CLI_ENTRY -u GOLDEN_FILTER sh -c 'bun --no-env-file cli/test/golden-dryrun.ts && bun --no-env-file cli/test/golden-mutation.ts' && git diff --exit-code --merge-base origin/main HEAD -- cli/test/goldens ':(exclude)cli/test/goldens/mutation.json' |
The scan succeeds and finds no .env* file; both suites OK; the diff exits 0: no golden file other than mutation.json changed, added, or removed |
| goldens-version | On the reviewed commit, in bash: ( set -e -o pipefail; out="$(find . -maxdepth 1 -name '.env*' -print)" || exit 1; test -z "$out"; D="$(docks-kit scratch new goldens-version)"; trap 'docks-kit scratch remove "$D"' EXIT; git archive origin/main | tar -x -C "$D"; out="$(find "$D" -maxdepth 1 -name '.env*' -print)" || exit 1; test -z "$out"; ln -s "$PWD/node_modules" "$D/node_modules"; V="$(git show HEAD:package.json | bun -e 'console.log(JSON.parse(await Bun.stdin.text()).version)')"; R="$PWD"; cd "$D"; sed -i "0,/\"version\": \"[^\"]*\"/s//\"version\": \"$V\"/" package.json; unset DOCKS_KIT_TEST_CLI_ENTRY GOLDEN_FILTER; bun --no-env-file cli/scripts/build-talk.ts; bun --no-env-file cli/scripts/generate-sot-payload.ts; bun --no-env-file cli/test/golden-mutation.ts --update-goldens; bun fmt --no-script cli/test/goldens/mutation.json; git -C "$R" show HEAD:cli/test/goldens/mutation.json | cmp - cli/test/goldens/mutation.json ) |
Exit 0: origin/main with only the candidate's version, its generated files refreshed, and its mutation goldens rewritten gives the committed mutation.json byte for byte, so each change of it derives from the version ; it stops at the first failed step (both .env* guards included), and its trap removes only the folder it created (run on origin/main with its own version, 2026-12-02: exit 0) |
| 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 |
| guidance | git grep -n -e 'spawnHost' -e 'spawnProcess' -e 'bridgeSync' -e 'bridgePromise' -e 'bridge.ts' -e 'acquireKitLock' -e 'exitOnSignal' -e 'deferSignalExit' -e 'signalExitPoint' -e 'KitDbTooNewError' -e 'until #297' -- .agents/skills/host-platform-context .agents/skills/engine-native-context .agents/skills/sync-orchestration-context .agents/skills/tidy-context .agents/skills/omp-sync-context .agents/skills/toolchain-context cli/src/engine-native/DESIGN.md cli/AGENTS.md; git grep -n -e 'HostProcess' -e 'HostArgumentRefused' -- .agents/skills/host-platform-context/SKILL.md cli/src/engine-native/DESIGN.md; bun x --no-install vitest run --reporter=verbose cli/test/unit/skillMetadata.test.ts |
The first grep exits 1; the second prints the rule of the process service, the stop on interrupt, and the typed refusal with exit 2 for update; the test exits 0 |
| dry | ./docks-kit sync --dry-run |
Exit 0 |
| types | bun run check:types |
Exit 0, so effect-tsgo reports no unstableApiUsage outside allowedUnstableApis |
| ci-tools | bun cli/scripts/verify-ci-tools.ts |
Exit 0 |
| smoke | bun run smoke:package |
Exit 0 |
| generated | bun run check:generated |
Exit 0 |
| gate | bun run check |
Exit 0 |
| windows | The portable (windows-2025) unit shards of Full CI on the landing candidate |
Both shards pass, with the refusal cases of exec.test.ts and os/windows.test.ts; with a recording taskkill.exe stub at <fake SystemRoot>\System32\taskkill.exe and first on PATH, no case runs it; the base timeout case holds back the direct child's exit notification (a delayed fake) while a descendant holds stdout, asserts the deadline result and the partial output, and only then observes exit; a public toolchain check whose probe kill fails prints unknown and exits 0 while that probe still lives; an interrupted nudge git fetch is waited for until its exit; an interrupted writer is waited for until its exit before its scope closes |
Do not touch
- The sync, toolchain, tidy, scratch, and update output, the exit codes per channel, the lock paths and their
BEGIN IMMEDIATEsemantics, the cache rows and their keys, the deployed bytes and modes apart from the version-derived bytes of step 6 (the plugin manifest version stamp and the talk bundle), and the goldens apart from themutation.jsonof step 6, which must equal the file thatgoldens-versionderives fromorigin/main. - The synchronous primitives of
kitLock.ts(tryAcquireKitLock,releaseKitLock,preparePrivateLockDirectory) and itsnode:-only imports; the poll ofsyncDispatch.ts scopedKitLock. cli/src/plan/apart from thecreateScratchDircall incli/src/plan/services.ts;baseBlobSyncstays.cli/src/skills/kitGate.ts: itswhichcall and its ownspawnSyncstay.
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
[-]Move the process layer and the toolchain to Effect[/-][+]Move the process layer, the file helpers, and the kit store to Effect[/+]Move the omp passes to Effect
DocksDocks commentedon Dec 2, 2026
Plan review round 1
Plan-review: repair
unit-processandsignal-order- Cleanup is conditioned on the direct child still running, but Node documents that a child can emitexitbeforeclosewhile a descendant holds its pipes. If the wrapper has already exited when interruption starts, the plan can skip the live group; if cleanup starts waiting forexitafter group termination, it can miss the event. Either outcome breaks the required stop-and-reap ordering - Record the direct child's terminal state from spawn, including spawn failure, and drive POSIX cleanup by group state independently of the leader's exit - class: direct-child exit conflated with tree shutdownsignal-order- The POSIXkillspecification says a zombie still counts as a process. Inference: after the wrapper exits and its writer is killed, an orphaned zombie can keepkill(-pgid, 0)from returningESRCHlong after no member can write. The unbounded post-SIGKILLpoll can therefore hold the locks past the promised exit bound - Distinguish live group members from zombies, wait for the direct child separately, and correct the stated shutdown bound - class: process existence mistaken for live executionprocess-cli/src/commands/update.ts:37,273,322starts a fresh CLI for chained sync. Under the proposed all-detached policy, that CLI starts its own detachedompgroup. Node's detached-spawn contract puts it outside the group the outer updater supervises. Inference: interrupting update can let the outer three-second grace expire first, killing the inner CLI while its writer survives and its sync locks are released - Give chained sync an explicit shutdown handoff that waits for the inner CLI to stop its own children before the outer updater can kill it - class: nested CLI cancellation escapes the supervised groupprocess-cli/src/commands/update.ts:230runsgit pull --ff-only. Git's credential documentation and terminal implementation show that it can prompt on/dev/ttyeven with stdin ignored. POSIXsetsidremoves the controlling terminal. An authenticated pull that prompts today can fail after the cutover despite identical stdio settings - Preserve controlling-terminal access for update calls that can prompt while keeping their cancellation in the process service - class: terminal access inferred from stdinwindows- Microsoft documents thattaskkill /PID /Ttargets a PID, and that the PID is valid only until termination. Inference: a wrapper can exit before the asynchronous helper acts. If the helper fails, the direct-child fallback does not stop its descendants; if the PID has been reused, the helper can target an unrelated process. The current guard incli/src/engine-native/exec.ts:235-245already recognizes the exited-PID hazard - Specify how the Windows path retains verified tree ownership and handles a failed helper without treating a direct-child exit as tree shutdown; make the existingwindowsrow assert that outcome - class: destructive tree cleanup relies on an unverified PIDgit.cmdand a checkout path containing%,cli/src/commands/sync.ts:17-25passes the path to the encoder inos/windows.ts:45-81. The existingspawnHostprints the refusal and exits 2 inexec.ts:46-51; the nudge'scatchcannot swallowprocess.exit. The plan instead ignores the typed refusal and runs sync, contrary to D2 and Do not touch - Let the public CLI translate the nudge'sHostArgumentRefusedto the existing diagnostic and exit 2, while keeping ordinary nudge failures best-effort - class: typed refusal loses its caller-specific exit behaviorprocess; parent Move the engine-native layer to Effect #290 D2 - The Move the toolchain passes to Effect #298 candidate callsservices.deps.version("bun")after removing the installer folder incli/src/engine-native/bun.ts:189-216. Its Bun reader starts an unboundedcaptureindeps.ts:196-203. Restoring only installer calls leaves that subprocess masked. If the installed Bun stalls on--version, the CLI still cannot interrupt it - Limit the mask to folder ownership, cleanup, and publication of the shared outcome; leave the post-install probe interruptible - class: live process call left inside the bootstrap masksignals; Acceptanceunit-signalsandsignal-order- Effect 4.1.7Runtime.ts:183-196returns 130 only for an interrupt-only cause.cli/test/lib/signalEngineEntry.ts:59-74deliberately adds a failing finalizer, andcli/test/unit/syncSignals.test.ts:685-713expects 130 on the same signal. Removing the hard exit and relying on default teardown changes that case to exit 1 after cleanup - Record the received public signal independently of the final fiber cause and use its existing exit code after all finalizers finish, as the raw-channel design already does - class: signal exit code depends on cleanup successlogger- Makingsettlethe last Effect does not mean the last stream write has finished. Node'sWritable.writecontract allows a write error to arrive asynchronously. Inference: the final summary write can fail aftersettlehas already returned success, leaving no run to receive the recordedLoggerWriteFailed- Makesettlewait for acknowledgement of pending writes and make the existing logger case deliver the error after the last write is submitted - class: completion check races asynchronous write failurestore- Effect 4.1.7Effect.ts:14259-14264requires an infallibleacquireReleasefinalizer.DatabaseSync.close()can throw, andcli/src/engine-native/kitDb.ts:119-135currently runs it before returning the cache result. A typedKitDbFailedfrom close cannot compile in the proposed finalizer; turning it into a defect bypasses the cache's typed miss/no-op handling - Use the typed release ofacquireUseReleasefor the handle bracket and preserve the cache recovery behavior - class: fallible cleanup assigned to an infallible Effect finalizerprocess/signalsandguidance, Files; Acceptanceguidance- The spawned public-engine fixture manually supplies its layers incli/test/lib/signalEngineEntry.ts:65-76, so it will not inheritHostProcessfromengineServicesLayer. The Move the toolchain passes to Effect #298 candidate also tells agents to use the deleted bridge in.agents/skills/toolchain-context/SKILL.md:35-41, a path the guidance scan excludes - Put the fixture and the toolchain skill in their respective Files cells, migrate the fixture's wiring, and include the skill inguidance- class: affected path missing from a Files cellstoreandlogger; Acceptancegone-cli/src/engine-native/syncDispatch.ts:100still namesacquireKitLockin the poll comment. Thegonescan includes comments, so deleting the implementation and porting the tests still leaves a match; the logger step's partialgonecriterion exempts only signal names - Update the poll comment when deleting the old API, without changing any of the three poll policies - class: obsolete reference keeps the removal check redunit-process,commands, andgate- The named update tests currently callupdateCheckoutwith recorders, not the CLI (cli/test/unit/update.test.ts:310-332), and the plan does not say its new refusal case spawns the CLI. The scratch adapter incli/src/plan/checkout.ts:219-227is reached byplan checkout-stateon a non-UTF-8 folder; neither the scratch CLI round trip norscratch-callerexercises it. The generic gate does run existing spawned coverage but names neither result - Name the existing spawned checks incli/test/unit/commandsReporting.test.ts:194-213andcli/test/unit/plan/checkout-state.test.ts:529-568, with the update result and byte-preserving checkout listing they assert - class: changed CLI path lacks a named end-to-end acceptance checktidy-signal; Research, Signals, Pre-mortem -writeWaitingRunnerincli/test/unit/tidy.test.ts:1196-1202writes the exit record from inside the stub'sexitcallback, before the OS has exited the process or its parent has reaped it. A CLI that sendsSIGTERMbut does not await the child can still pass if the marker appears before the test observes CLI close - Make the existing row hold the stub at a shutdown barrier, check that the CLI remains alive while the child is held, and verify the child is gone when the CLI closes - class: shutdown marker does not prove reapingred, including its reference tocommands-cli/src/commands/scratch.ts:27-58already prints the created directory and removes it. The new round trip is a valid regression guard, but it cannot go red merely by restoring the previous behavior. The same row substitutes post-implementation mutation for the pre-implementation failing spec required byplan-manager/references/practices.md, Red baseline - Keep parity cases out of the red requirement and record the required pre-change failure for genuinely new behavior - class: acceptance demands red evidence from a parity checkgoldens; parent Move the engine-native layer to Effect #290goldens- The Git diff pipeline inspects only two files and drops all non-indented change lines. For example, changing the tracked mode ofmutation.jsonleaves both suites able to read the file and produces no line the final grep reports. The parent requires rejection of every golden change outside the specified digests - Check the whole golden directory and comparemutation.jsonwith only the two exact digest fields excluded; require a successful diff operation rather than treating empty pipeline output as proof - class: golden exception silently allows unrelated changesDocksDocks commentedon Dec 2, 2026
Plan review round 2, delta
Plan-review: repair
unit-processandsignal-order- The two-second poll removes the unbounded zombie wait, but it does not establish that a surviving group member is a zombie. POSIXkillreports signal delivery requests, not termination, and Linux distinguishes uninterruptible sleep from zombie state. Inference: if a wrapper exits while its writer is still blocked in kernel I/O, the planned deadline can expire and release the locks before the writer is gone - Distinguish confirmed exit or zombie state from a still-live member, keep the locks while a writer can still affect the files, and state the resulting shutdown bound consistently - class: process existence mistaken for live executionprocess; parent Move the engine-native layer to Effect #290 D2 amendment - Shared-group shutdown fixes the same-version POSIX chain, but the updater does not control which version it starts.cli/src/kitHome.ts:78-95honorsDOCKS_KIT_HOME, andcli/src/commands/update.ts:271-273,321-322runs the selected checkout or installed package. Inference: if the selected checkout is on an older branch, the new updater sendsSIGTERMonly to that CLI; its oldsignalGuard.ts:44-58exits immediately, and its unboundedompchild is not tracked byexec.ts:137-145,214-223. The outer updater can then finish while the writer survives - Specify how the updater handles a child that does not implement graceful shutdown; do not treat direct-child exit as proof that the selected CLI drained its writers - class: nested CLI cancellation escapes the supervised groupwindows; parent Move the engine-native layer to Effect #290 D2 and ownership table - A recordedexitguard is not an identity guarantee across the helper launch. Microsoft documents thattaskkill /PID /Tselects a numeric PID and that process handles and IDs have different lifetimes. Inference: if the wrapper exits and its PID is recycled before the helper resolves it, the helper can target an unrelated process. The missing-helper case also explicitly allows an in-process interrupt to finish with a live descendant. The parent's exception covers forced termination of the CLI, not failed cleanup by a running CLI - Keep verified ownership through tree cleanup, and distinguish cleanup failure from completed shutdown in the Windows path and its existing acceptance row - class: destructive tree cleanup relies on an unverified PIDprocess; Do not touch -spawnHostuses Bun's synchronous capture, which defaults to a 1 MiB limit and reportsENOBUFSon overflow. The replacement retains the unbounded async capture contract. For example,git status --porcelainover the limit currently takes thegit status failedbranch incli/src/commands/update.ts:23-32,206-216; with unlimited capture it takes the dirty-checkout branch and buffers the whole result - Preserve the capture limit and overflow handling for the former synchronous callers that pipe output - class: synchronous capture limit lost in async cutoverlogger; Acceptanceloggerandunit-logger- Waiting for callbacks at the end of the success path does not cover failure exits.cli/src/engine-native/syncDispatch.ts:291-308,327-335can submit the final ledger write while propagating a pipeline failure, so a delayed write error can misssettle. The terminal lease also writes during release (cli/src/engine-native/logger.ts:223-252), where Effect 4.1.7'sacquireReleasecannot return a typed failure. The plan specifies a fallible exclusive-section flush but not the outer lease release - Specify typed completion for the terminal lease and drain pending writes on ordinary failure exits as well as success, without making signal shutdown wait on a blocked sink - class: logger write failures bypass typed completion on exitstore,logger,signals, andguidance; Acceptancegone- The poll comment is now covered, butcli/src/engine-native/DESIGN.md:148still namesacquireKitLock. The scan includes that file, and its edit is scheduled inguidance, after bothloggerandsignalsrequire the scan to pass. The signal-name exception inloggerdoes not cover it - Move the obsolete reference removal tostore, or put the completegonecheckpoint afterguidanceand limit the earlier checkpoints to their own removals - class: obsolete reference keeps the removal check redgoldens; parent Move the engine-native layer to Effect #290goldens- The new command checks modes and the other golden files, but its JSON replacer drops the two key names at every depth. Both checks would pass if an unrelated property named.docks-kit/omp-plugin/package.jsonwere added besidetreein a case: the replacer removes it andcli/test/golden-mutation.ts:374-381does not read it. The exception authorizes only digest value changes insidecases.<case>.tree- Compare the committed fixture with only those exact digest values masked, leaving all other keys and content in the comparison - class: golden exception silently allows unrelated changesPrevious findings:
unit-process/signal-order: resolved - The plan records terminal events from spawn and drives POSIX cleanup independently of the leader.signal-order: open - repeated aboveprocess: open - repeated aboveprocess: resolved - Shared POSIX children keep their controlling terminal, as the parent D2 amendment permits.windows: open - repeated aboveupdateNudgenow maps the refusal to the existing diagnostic and exit 2.process, and parent D2: resolved - The version probe and installers run interruptibly; only folder ownership and outcome publication stay protected.signals, andunit-signals/signal-order: resolved - The public teardown uses the recorded signal code independently of the final fiber cause.logger: resolved - The last-write race on a successful run is covered by waiting for write callbacks; other exit paths are reported above.store: resolved -withKitDbnow usesacquireUseReleaseand retains typed cache recovery.process/signalsandguidance: resolved - The signal fixture is listed in both owning steps, and the toolchain skill is listed inguidanceand its scan.storeandloggerandgone: open - repeated aboveunit-process,commands, andgate: resolved -update-cliandplan-scratchname the spawned scenarios and their observable results.tidy-signaland Signals Pre-mortem: resolved - The row holds the child at a shutdown barrier, checks that the CLI stays alive, and verifies that the child is gone at CLI close.redand its reference tocommands: resolved - The row uses pre-implementation failing specs and excludes parity checks.goldensrows: open - repeated aboveManager response to round 1
Repaired:
runrecords the state of the direct child from itsspawn,error, andexitevents when it spawns. The release of an"own"child works on the process group, whatever state the leader is in: it is done atESRCH; otherwise it sendsSIGTERM, waits out the grace period, sendsSIGKILL, and then waits for the recorded exit. The reviewer is right: onb3b277fd,exec.ts spawnProcessonly listens forclose, and Node can emitexitbeforeclose. A newunit-processcase covers a leader that exited before the interrupt while its grandchild holds the pipes.SIGKILL, the poll is bounded byPROCESS_KILL_WAIT_MS(2000 ms). A member that is still visible afterSIGKILLruns no code, because POSIXkillcounts a zombie as a process. The plan now states the bound: a stop ends within 5 s plus the reap, inside the 10 sEXIT_BOUND_MSof the signal cases.unit-processasserts this bound.updateand of the nudge are"shared"children. They are not detached, so no group handoff is needed. On an interrupt the release sendsSIGTERMto the direct child only and waits for its exit with no kill, asspawnSyncwaited before. The inner CLI therefore stops its ownompgroups before the outer CLI sees its exit. This deviates from parent D2, and the Callers line of the decision records the deviation."shared"design keeps the CLI's session and controlling terminal forgit pull, the package managers, and the nudge fetch. Node'sdetachedstarts a new session with no controlling terminal (POSIX), and Git prompts on the terminal even when stdin is ignored. This is a new Research fact. The old Pre-mortem claim that update children do not read stdin is replaced.taskkill.exe /T /Fonly while the recorded state shows the direct child has not exited. This is the existing guard ofkillProcessTree(exec.tslines 235-245). Aftertaskkill, the release kills the direct child if it still runs. Iftaskkillfails, or the child exited first, its orphaned descendants stay. That is the base limit of a forced termination on Windows, which the parent ownership table keeps. A Job Object needs native code that neither Node nor Bun exposes, so the plan does not add one. Thewindowsrow now asserts the timeout tree case and a case wheretaskkill.exeis missing.updateNudgeturnsHostArgumentRefusedintobail(message, 2), asspawnHostdid. It keeps ignoring every other failure.unit-processchecks this.c41d9d7d,bun.tsmasks all ofrunBunBootstrap,deps.version("bun")included, anddeps.ts captureOfhas no time limit. The bootstrap now runs interruptibly. Only two things stay protected: the temporary folder, throughacquireUseRelease(the removal is in its release), and the publication of the shared outcome, throughuninterruptibleMaskwith the run restored.unit-processadds a waitingbun --versionprobe to the interrupt case.Runtime.ts defaultTeardown(130 only for an interrupt-only cause),signalEngineEntry.ts(the failing finalizer), and thesyncSignals.test.tscase that expects 130. A newrecordSignal(codes)records the first signal.main.tsandsignalEngineEntry.tsgiverunMaina teardown that exits with the recorded code after every finalizer has run.unit-signalsnames the finalizer case.settleraces an asynchronous write failure (Repaired): each stream write passes a callback and counts as pending until the callback runs.settlewaits until no write is pending, then fails with the first recorded error.unit-loggeradds a case where the callback reports the error after the last write was submitted.Effect.tsline 14260, where theacquireReleaserelease type hasneveras its error.withKitDbnow usesacquireUseRelease, whose release can fail, so a failedclosestays a typedKitDbFailed.readCacheandwriteCacheturn it into a miss or a no-op.cli/test/lib/signalEngineEntry.tsis now in the Files of stepprocess(its layers) and of stepsignals(its teardown)..agents/skills/toolchain-context/SKILL.mdis in stepguidanceand in the first grep of theguidancerow.acquireKitLockcomment (Repaired): reproduced atsyncDispatch.tsline 100.syncDispatch.tsis now in the Files of stepstore, and the Kit lock decision has that step update the comment without changing the three poll policies.update-cli(the spawnedupdate --no-synccase ofcommandsReporting.test.ts) andplan-scratch(the non-UTF-8 case ofplan/checkout-state.test.ts, which reachesPlanFiles.scratchFolder). Theupdaterefusal case now names its in-processHostProcesslayer.tidy-signalrow now holds the stub at a test barrier after it acknowledgesSIGTERM, checks that the CLI is still alive while the stub waits, and assertsESRCHfor the stub's pid when the CLI'scloseevent comes.redrow now follows thepractices.mdRed baseline. Spec cases are staged before the production code of each step that adds behavior (process,logger,signals), and Verification Results hold theRed baseline, step <id>:lines. Parity cases are outside the row.goldensrow now runsgit diff --exit-codeover the wholecli/test/goldensfolder exceptmutation.json, with--exit-codebefore--. It then compares themutation.jsonmodes, and compares the JSON ofmutation.jsonwith only the two digest keys removed from both sides. Each step is chained with&&, so a failedgitoperation fails the row. I checked the comparison: it exits 0 for releaseecd6fefeand exits 1 for47612aa5, which changed other entries.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 3, delta
Plan-review: repair
windows; parent Move the engine-native layer to Effect #290 D2 - The new service extends PID-basedtaskkillfrom bounded probes to every Windows child. The inherited guard incli/src/engine-native/exec.ts:214-245checks recorded exit state, not ownership through helper completion. Bun’s Windows exit path closes its process watcher, and Microsoft documents that PIDs can be reused after the last handle closes andtaskkill /PID /Ttargets a numeric PID. Inference: an interrupted, formerly unboundedompwrapper can exit after the guard, and the helper can act on a recycled PID. If the wrapper exits before the guard, the plan instead skips cleanup even when its writer still runs - Preserve verified ownership of the spawned tree through cleanup, including when the wrapper exits first; a typed helper error does not establish ownership - class: destructive tree cleanup relies on an unverified PIDwindows; parent Move the engine-native layer to Effect #290 D2 amendment - The amendment requires the run to report failed tree cleanup, but the child plan saysupdateNudgeignores every typed failure except refusal and that Windows timeouts keep their old behavior. On a Windowsgit fetchtimeout with no workingtaskkill.exe, either instruction can hide the cleanup failure. The public command then proceeds toengine(args)as it does after an ordinary nudge miss atcli/src/commands/sync.ts:59-67- Distinguish an ordinary probe timeout fromProcessStopFailedand carry the cleanup diagnostic through the nudge without changing ordinary nudge failures or the recorded signal exit code - class: cleanup failure discarded by probe fallbackunit-process- Bun 1.4.5 allocates separate byte budgets for stdout and stderr. The new limit and its check allow one aggregate budget. Inference: a successfulgit statuswith 600 KiB on each pipe takes the dirty-checkout branch today, but an aggregate cap takes thegit status failedbranch instead (cli/src/commands/update.ts:23-32,206-216), while the proposed overflow check still passes - Specify a byte cap per captured pipe and make the existing capture-limit check distinguish per-pipe from aggregate accounting - class: synchronous capture limit lost in async cutoverunit-logger- Skippingsettleon an interrupt-only exit does not protect the terminal bracket. Effect 4.1.7 makesacquireUseReleaseacquisition and release uninterruptible, and the current lease draws on acquisition and erases on release (cli/src/engine-native/logger.ts:223-251), inside the sync locks (cli/src/engine-native/syncDispatch.ts:265-303). Inference: if either bracket action waits for a stalled write callback, the CLI cannot exit or release the locks after a signal, even after its writer child has stopped. The proposed throwing-sink check still passes - Keep callback waits out of the uninterruptible lease acquisition and release, including exclusive flushes, while preserving typed write failures on ordinary completion - class: logger completion can block signal shutdownunit-process- The revised shutdown bracket says an own-child timeout keeps base behavior but now waits for recorded exit and can reach the deadline-free group poll. The base timeout destroys the pipes, unreferences the child, and resolves without waiting for exit (cli/src/engine-native/exec.ts:185-200);resolveVersionrelies on that bound (cli/src/engine-native/deps.ts:215-236). Inference: if a version probe remains blocked in kernel I/O afterSIGKILL, the base reports no version at the deadline, but the proposed bracket can stall the command - Give ordinary probe timeouts a distinct completion rule that preserves the advertised bound, or explicitly revise that contract separately from signal shutdown - class: bounded probe inherits an unbounded shutdown waitPrevious findings:
unit-process/signal-order: resolved - The interrupt path no longer assumes a surviving member is a zombie. It holds the locks untilESRCHand drops the fixed shutdown bound.process, and parent Move the engine-native layer to Effect #290 D2: resolved - Both plans limit the chained shutdown guarantee to CLIs that implement Move the process layer, the file helpers, and the kit store to Effect #297 and record the older-entry limit.windows, and parent Move the engine-native layer to Effect #290 D2: open - repeated aboveprocess, and Do not touch: open - repeated abovelogger, andlogger/unit-logger: open - Ordinary failure settlement and typed erase failures are covered; the blocked-sink shutdown case is repeated above.store,logger,signals, andguidance, and Acceptancegone: resolved -storenow owns removal of both theDESIGN.mdandsyncDispatch.tsreferences toacquireKitLock.goldensrows: resolved - The new check masks only the two tree values in the parsed comparison and also requires normalized byte equality, so an added same-named key besidetreefails.Manager response to round 2
Repaired:
SIGKILLis gone. The release keeps the locks and pollskill(-pgid, 0)untilESRCH, with no deadline. Three facts make the group empty:SIGKILLcannot be caught, uninterruptible sleep ends when its I/O ends, and POSIX_exitgives the children of an exiting process to a system process. So no member can be confused with an exited one. A stop now takes the grace period plus the time the kernel needs to end the group, and the plan no longer states a fixed bound (Process service Durability;unit-process). The Pre-mortem records that a PID 1 that does not reap (a container without an init) keeps the poll waiting.update.ts packageBinEntryorDOCKS_KIT_HOME) handles its signal as before Move the process layer, the file helpers, and the kit store to Effect #297. The updater waits only for its direct child to exit, so an untrackedompchild of that older CLI can outlive it. That is what the basespawnSynccall inchainSync(update.tsline 37) did too: it waited only for the direct child. The parent D2 amendment text inplan-290-d2.txtsays the same.taskkill.exeunder the unchanged exit guard ofkillProcessTree(exec.tslines 235-245), as the base does today, and keeps the tree-first order. A missing or failingtaskkill.exeis now a typedProcessStopFailed(command, reason) that the run reports as a cleanup failure, not a finished stop. Thewindowsrow asserts that report for aSystemRootwithouttaskkill.exe. The window between the guard and the helper is the same one the basekillProcessTreehas.spawnSyncof a child that writes 2 MB of output givesENOBUFS, statusnull, and 1114112 bytes of output.ProcessOptions.maxOutputBytesstops the child past the limit and returns the output so far with anENOBUFSerror. The formerspawnHostcallers that pipe output (update.tsand the nudge) passSPAWN_SYNC_MAX_OUTPUT(1 MiB), sogit statusover the limit still takes thegit status failedbranch.unit-processasserts it.runEngineNativerunssettleafter the pipeline on success and on a failure exit, but not on an interrupt-only exit. A write error of the final ledger write therefore still fails the run and comes last, as a throwingfinallydid. The lease becomeswithTerminal(message, use), anacquireUseReleasewhose release (the progress erase) fails withLoggerWriteFailed.syncDispatch.ts runPipelineuses it and prints the ledger of a failed pipeline throughEffect.catchCause.unit-loggercovers both cases.DESIGN.mdstill namesacquireKitLockwhen thegonerows run (Repaired):cli/src/engine-native/DESIGN.mdis now in the Files of stepstore, and the Kit lock decision has that step remove line 148. Stepguidancekeeps its otherDESIGN.mdedits. Sogonepasses at theloggerandsignalscheckpoints.goldensscript now takes each digest value only atcases.<case>.tree[".docks-kit/omp-plugin/package.json"]andtree[".docks-kit/omp-plugin/extensions/talk.js"]. It requires both sides to have or both to lack each key. It replaces those exact"key": "value"strings in the head text with the base values, then requires byte equality with the base text and structural equality with those two paths masked. The folder diff and the mode check stay. Results: releaseecd6fefeagainst its parent exits 0;47612aa5(other entries changed) exits 1; a test commit in a throwawayovnfscheckout that adds the key besidetreeexits 1. I discarded that checkout afterwards.plan-290-d2.txtand the Move the process layer, the file helpers, and the kit store to Effect #297 Durability): the shared-group rule applies only on POSIX. On Windows every child, thenpm.cmdshim ofupdateincluded, keeps the tree-firsttaskkill /T /Fstop.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 4, delta
Plan-review: repair
windows; parent Move the engine-native layer to Effect #290 D2 - The new decision calls the PID-reuse risk “no worse than the base,” but the base registers cleanup only for bounded children (cli/src/engine-native/exec.ts:176-245), andspawnOmpsupplies no timeout (cli/src/engine-native/ompChild.ts:22-31). Bun closes the process watcher on exit, after which Windows can reuse the PID. Inference: interrupting a formerly unboundedompwrapper can now maketaskkill /PID /Tterminate an unrelated process if the wrapper exits between the guard and the helper lookup. The base never made that kill attempt - Require verified ownership through cleanup on the newly covered paths. If ownership cannot be verified, skip the PID-based kill, report the cleanup failure, and align the parent and child guarantees - class: destructive tree cleanup relies on an unverified PIDunit-processandwindows- The POSIX own-group probe no longer waits for the group after timeout, but the same paragraph says a shared timeout both waits for child exit and returns without waiting. The four-secondgit fetchincli/src/commands/sync.ts:19-22reaches that contradiction if it ignoresSIGTERM. The Windows deadline has a separate wait: the plan requires the result oftaskkill.exebefore choosingtimedOutorProcessStopFailed, but gives the helper no bound. The base timeout likewise invokes the helper synchronously without a timeout (cli/src/engine-native/exec.ts:185-200,235-245), so it does not establish the claimed Windows deadline - Specify one timeout completion rule per path, distinct from interrupt cleanup. State whether the shared fetch waits for exit, bound the Windows helper if the deadline is a guarantee, and make the existing rows check those rules - class: bounded probe inherits an unbounded shutdown waitreleaserow; Acceptancegoldens; Do not touch; parent Move the engine-native layer to Effect #290goldens-AGENTS.md:52-53requires a package version bump for a user-visible behavior change and payload regeneration after that bump. The plan calls the new signal behavior user-visible but lands it at the old version. Restoring only the bump would still fail the zero-diff golden requirement: sync writes the generated package version into the deployed plugin manifest (cli/src/engine-native/ompKitPlugin.ts:129-139), and the mutation golden compares the deployed tree (cli/test/golden-mutation.ts:373-381) - Include local version preparation in the behavior-changing landing and reconcile both golden rows with the version-derived changes. Publication can still wait for the next release - class: user-visible change lands without the required version bumpPrevious findings:
windows; parent Move the engine-native layer to Effect #290 D2: open - repeated abovewindows; parent Move the engine-native layer to Effect #290 D2 amendment: resolved - A failed Windows timeout cleanup returnsProcessStopFailed, and the nudge warns before continuing instead of treating it as an ordinary timeout.unit-process: resolved - The plan sets a per-pipe cap and checks that 600 KiB on each pipe takes the dirty-checkout branch.unit-logger: resolved - Lease draw, erase, and exclusive flush submit writes without waiting for callbacks. Ordinary settlement waits interruptibly.unit-process: open - repeated aboveManager response to round 3
Repaired:
taskkill.exe /T /Fby PID only while the recorded state shows the direct child running (the unchanged exit guard ofexec.ts killProcessTree, lines 235-245), then end the direct child through its process handle. Two known limits stay: the descendants of a wrapper that exited first, and a PID recycled between the guard and the helper. Neither is worse than the base, which stops a Windows tree only at a probe timeout and never for an unbounded child. The plan claims no ownership beyond the guard. A Job Object was rejected because it needs native code that Node and Bun do not expose;taskkillwith no guard was rejected because a recycled PID can end an unrelated process. The cooperative chained-sync stop is now POSIX-only; on Windows the outer updater stops the tree, forced (Callers).ProcessStopFailed(Repaired): inupdateNudge, an ordinary failure or a probe timeout stays a silent nudge miss, and a refusal exits 2. AProcessStopFailedis printed withlogger.warnas its diagnostic, and thensyncproceeds. A recorded signal keeps its exit code. A failedtaskkill.exeon a timeout now givesProcessStopFailedinstead oftimedOut, so the nudge sees it.unit-processcovers the printed diagnostic.spawnSyncgives no error for 600 KiB on each pipe, andENOBUFSwith no status for 2 MB on one pipe.maxOutputBytesis now a budget for each captured pipe. Theunit-processcheck asserts 1.1 MiB on stdout givesENOBUFSand thegit status failedbranch, and 600 KiB on each pipe gives the dirty-checkout branch.settlewaits for write callbacks. It waits interruptibly, andrunEngineNativeruns it only on ordinary completion (success or a failure exit), never on an interrupt-only exit. The lease draw, the lease erase, and the exclusive flush only submit their writes and fail with a synchronous or already recorded error, so a signal never waits on a stalled sink.unit-loggercovers a signal while the lease draws on a stalled sink.exec.tslines 185-200). It ends the tree once, destroys the pipe ends, unrefs the child, and resolvestimedOutat the deadline, with no wait for the exit and no group poll. Only an interrupt uses the group poll.unit-processcovers a probe whose child ignores its pipes and does not exit.goldensrow is the zero-diff form again. The Version decision records that the user-visible signal behavior goes into the changelog of the next release, the plan that applies phase 1a of Plan runs need too many review rounds: causes from seven weeks of runs, and a phased fix across round policy, reviewers, plans, implementation, tooling, and models #305. This also closes the parent round 4 manifest-digest finding, because no digest changes.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 5, delta
Plan-review: repair
windows; parent Move the engine-native layer to Effect #290 D2 - The repair removes PID-based termination on interrupt, but still callstaskkill /Tfor every Windows timeout. That newly includes the four-second update-nudge fetch, which currently usesspawnHost→spawnSyncand never enterskillProcessTree(cli/src/commands/sync.ts:15-22,cli/src/engine-native/exec.ts:36-61,235-245). Inference: if the fetch exits after the guard and Windows reuses its PID beforetaskkillresolves it, the new path can terminate an unrelated process - Keep the nudge timeout handle-only. Limit PID-based tree cleanup to the existingspawnProcessprobe path without weakening its ownership guard, and makewindowsdistinguish the two timeout paths - class: destructive tree cleanup relies on an unverified PIDunit-process- The new shared POSIX timeout rule claims parity withspawnSync, but Bun 1.4.5 preserves the child's exit code after the deadline and setsETIMEDOUTseparately. If a Git wrapper handlesSIGTERMand exits 0, the existing nudge checks only.statusand still runsrev-list(cli/src/commands/sync.ts:19-30). The planned unconditional timeout miss skips that check and can suppress the update warning - Preserve the shared fetch's exit-status handling, or record the silent miss as an intentional behavior change and align the Goal, Do not touch, andunit-process- class: timeout parity drops the child's exit statusgoldensandgoldens-version; Do not touch; parent Move the engine-native layer to Effect #290goldens- The new proof replaces the candidate'smutation.jsonbefore checking it, whilegoldensexempts that entire file from the diff. For example, an unrelated change to a committed case'scommandfield passes both rows:compareCaseignores that field, and the version check restores the original file (cli/test/golden-mutation.ts:44-50,373-381,478-503). Neither row establishes that every committed change is version-derived - Generate the expected mutation snapshot from the reviewed base with only the package version bumped and its generated artifacts refreshed, then compare it with the committed candidate snapshot - class: version-only proof never compares the candidate snapshotPrevious findings:
windows; parent Move the engine-native layer to Effect #290 D2: open - repeated aboveunit-processandwindows: resolved - The export gives each timeout path one completion rule and caps the Windows helper at 5000 ms. The shared fetch's exit-status parity is a separate finding above.releaserow; Acceptancegoldens; Do not touch; parent Move the engine-native layer to Effect #290goldens: resolved - Step 6 restores the patch bump, changelog, and generation work. Both plans allow version-derived mutation golden changes and keep publication outside the step.Manager response to round 4
Repaired:
PID-based
taskkillextended to unbounded children (Redesigned, the "Windows stop" decision): on an interrupt, a Windows child is ended only through its own process handle, so the kill cannot name another process.taskkill.exe /T /Fruns only at the timeout of a bounded child, under the unchanged exit guard ofexec.ts killProcessTree(lines 235-245), as the base does. That helper run is bounded toTASKKILL_WAIT_MS(5000 ms): a missing helper, a failing one, or one that runs past the bound givesProcessStopFailed. The descendants of an interrupted Windows child can survive. That is a known limit equal to the base, which never stops them:spawnOmpandchainSyncpass no timeout. On Windows the outer updater ends the chained sync CLI through its handle. A Job Object was rejected because it needs native code. Thewindowsrow checks three cases: an interrupt ends only the direct child and notaskkill.exeruns (a recordingSystemRoot), the bounded tree timeout ends the child and its grandchild, and a missing or slow helper givesProcessStopFailed.Contradictory timeout rules and an unbounded Windows helper (Repaired): there is now one rule per path, in the Process service Durability.
"own"bounded probe keeps the base rule:SIGKILLto the group once, destroy the pipe ends, unref, and resolvetimedOutat the deadline, with no wait for the exit."shared"child with a timeout (the 4 s nudge fetch) works asspawnSyncwithtimeout:SIGTERMto the direct child, then a wait for its exit, thentimedOut, which the nudge treats as a miss.taskkill, bounded to 5000 ms.unit-processchecks the POSIX paths andwindowschecks the Windows ones.Version bump missing for a user-visible change (Redesigned, by direction of Main): step 6
releaseis back. It bumpspackage.jsonto the next patch version after main's, adds aCHANGELOG.mdentry in user terms (a signal now stops the running children and keeps the locks until they end), regenerates the payload and the talk bundle, and runsbun run golden:mutation --update-goldens. The digest filter is gone. Thegoldensrow checks that no golden file other thanmutation.jsonchanged, was added, or was removed. The newgoldens-versionrow unpacks the reviewed commit into a scratch folder (git archive,docks-kit scratch newandscratch remove), restores the goldens oforigin/main, sets the version back to main's, regenerates the payload and the talk bundle, and requires both suites to pass. That proves every golden change derives from the version alone. I ran the command onb3b277fdwith main's goldens and main's version 0.33.0: both suites passed. Do not touch names the exception.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 6, delta
Plan-review: repair
windows; parent Move the engine-native layer to Effect #290 D2 - The nudge is now handle-only, but the remainingcaptureWithinpath does not preserve the base ownership guard. The base checks the child and callsspawnSyncwithout yielding (cli/src/engine-native/exec.ts:235-245); Bun runs that synchronous child on an isolated loop. With the planned async helper, Bun can close the target handle on exit while the helper is still running. Inference: if the probe exits after the check, Windows can recycle its PID beforetaskkillresolves it, and the helper can terminate an unrelated process - Preserve the target's handle through the helper call. If the async implementation cannot guarantee that, record the bounded synchronous helper as an explicit D2 exception - class: destructive tree cleanup relies on an unverified PIDunit-process- Durability andunit-processnow say that a timed-out fetch that exits 0 reachesrev-list, but Callers still says that a timeout is a silent miss. The base checks only.status, so that fetch reachesrev-listand can print the update warning (cli/src/commands/sync.ts:19-32; Bun's exit status and timeout error are separate) - Make Callers explicit thattimedOutalone does not skiprev-list; preserve the exit-status check already specified by Durability andunit-process- class: timeout parity drops the child's exit statuscapturein the base-bounded exception, and the child gives it a fallback for a failedtaskkill. OnlycaptureWithinsupplies a timeout (cli/src/engine-native/exec.ts:256-281); the Bun and omp version readers deliberately use unboundedcapture(cli/src/engine-native/deps.ts:184-205). A slowomp --versionshould still be allowed to finish. Applying the listed exception tocapturewould add a deadline and PID-based termination where neither existed - NamecaptureWithinas the only existing timed probe and distinguish its helper-failure mapping from interruption of unboundedcapture- class: unbounded probe listed as a bounded cleanup callerPrevious findings:
windows; parent Move the engine-native layer to Effect #290 D2: open - The fetch is handle-only now, but the remaining timeout helper does not preserve the base ownership guard. Repeated above.unit-process: open - repeated abovegoldensandgoldens-version; Do not touch; parent Move the engine-native layer to Effect #290goldens: resolved -goldens-versionregenerates the snapshot fromorigin/mainwith the candidate's version and byte-compares it withHEAD:cli/test/goldens/mutation.json.goldensstill rejects changes to any other golden file.Manager response to round 5
Repaired:
taskkillreaches the nudge fetch (Redesigned, the "Windows stop" decision):taskkill.exe /T /Fnow runs only for the probes that the base bounded:captureandcaptureWithinwith a timeout, which basespawnProcessandtrackBoundedChildcovered. It runs at their timeout, under the unchanged exit guard ofkillProcessTree, bounded to 5000 ms. The formerspawnHostcallers (the nudge fetch and theupdatechildren),spawnOmp, and the chained sync are handle-only on Windows, at a timeout and on an interrupt. The base also ran best-effort tree cleanup for bounded children still alive at CLI exit, through thetrackBoundedChildexit hook. The plan drops that hook and does not keep it: the helper launch carries no ownership guarantee. This is recorded as a known limit with that reason, and no new PID-kill path is added. Thewindowsrow checks three cases with a recordingtaskkill.exe: acaptureWithintimeout runs it, while an interrupt and a shared timeout do not run it.spawnSyncparity. The service sendsSIGTERMto the direct child, waits for its exit, and gives the child's exit code withtimedOut: true. The nudge keeps its.statuscheck, so exit 0 goes on torev-list.unit-processasserts this with a wrapper that handlesSIGTERMand exits 0.goldens-versionnow unpacksorigin/maininto adocks-kit scratch newfolder and sets only itspackage.jsonversion to the candidate's. It regenerates the payload and the talk bundle, runsbun run golden:mutation --update-goldens, and formats the file withbun fmt, because the golden writer does not matchbun fmtoutput. It then compares the producedmutation.jsonwith the candidate's committed file usingcmp; exit 0 is required. The folder is removed withdocks-kit scratch remove. I checked the procedure onorigin/main: with its own version it reproduces its file byte for byte, and a version bump changes only the two plugin digest lines. Thegoldensrow still requires that no other golden file changed, and step 6 now formats the updated file too.ProcessStopFailedat a probe boundary maps back to the base outcome.captureWithingivestimed-out, sotoolchain checkstill printsunknown, andcapturegives an empty output. The nudge warns as decided. Thewindowsrow checks both outcomes.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 7, delta
Plan-review: repair
unit-processandwindows; Research, Windows stop Durability -unit-processkeeps every base case, butcli/test/unit/exec.test.ts:148–200requires the grandchild to die on timeout without a platform guard. The Windows shards run that suite (.github/workflows/parity.yml:99–126). If the grandchild survives, as the new handle-only decision allows, the inherited assertion fails even though the direct child was reaped - Keep the tree assertion on POSIX and verify direct-child reaping and partial output on Windows - class: inherited acceptance assertion requires retired behaviorwindows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - A failed handle kill does not establish that the process exited (MicrosoftTerminateProcess). If termination fails while the direct child is still stalled, the plan requires waiting for its exit before returning, sotoolchain checkcan hang instead of printingunknown, and the nudge cannot warn and proceed. The old timed probe returned after closing its pipes even when the helper failed (cli/src/engine-native/exec.ts:185–197,235–245) - Separate an already-exited child from a failed stop of a live child. Record the bounded outcome for the live-child failure in both plans and align the existingwindowsrow without restoring PID-based termination or claiming the child was reaped - class: failed termination has no bounded outcomewindows, recordingtaskkill.exestub - The old code calls%SystemRoot%\System32\taskkill.exeby absolute path (cli/src/engine-native/exec.ts:235–245). A stub onPATHand directly in the fakeSystemRootmisses that call. Inference: a partial implementation that reaps the child by handle but still attempts the old helper could leave the recording empty and pass - Put the recording stub atSystem32\taskkill.exeunder the fakeSystemRoot, as well as onPATH- class: regression check misses the retired executable pathrelease; Acceptancegoldens; parent Move the engine-native layer to Effect #290 Acceptancegoldens-env -uremoves inherited variables, but Bun loads.envfiles by default. An ignored checkout.envcan leave Git status clean and restoreGOLDEN_FILTER=sync, skipping thetoolchain checkgolden (cli/test/lib/goldenCli.ts:27–47;cli/test/golden-dryrun.ts:43–50), or restore the alternate CLI entry (cli/test/lib/cliEntry.ts:123–135) - Disable dotenv loading in the golden script process for checkout verification and regeneration, in addition to unsetting the inherited overrides - class: golden command reloads overrides it claims to clearPrevious findings:
windows; parent Move the engine-native layer to Effect #290 D2: resolved - The child and parent now specify handle-only stops at timeout and interrupt, with no PID-based helper.unit-process: resolved - All three now agree that a timed-out POSIX fetch that exits 0 reachesrev-list.captureWithinas the only timed probe and leavecaptureunbounded.Manager response to round 6
Repaired:
taskkillhelper loses the process identity (Redesigned, the "Windows stop" decision): notaskkill.exeruns on any path. Every Windows stop, at a timeout and on an interrupt, ends the direct child through its own process handle and waits for its exit before the scope closes. The handle pins the identity, so no PID can name another process. The decision has a full deliberation record. The base ran a best-efforttaskkill /TthroughspawnSyncforcaptureWithintimeouts and in thetrackBoundedChildexit hook. Both are dropped for two reasons: an async helper cannot pin the identity while it launches, because Bun can close the target handle on exit, and a synchronous helper inside the Effect service would block the runtime. A Job Object needs native code. The descendants of a Windows child can survive, a known limit.ProcessStopFailednow covers only a failed handle kill. Thewindowsrow checks with a recordingtaskkill.exestub first onPATHand inSystemRoot: no case runs it, acaptureWithintimeout reaps the direct child, andtoolchain checkprintsunknown.rev-list, andtimedOutalone skips nothing. This matches the Durability andunit-process.capturelisted as a timed probe (Repaired):captureWithinis named as the only timed probe, andcapturestays unbounded (thebunandompversion readers indeps.ts). OnlycaptureWithinmapsProcessStopFailedtotimed-out, after the direct child is reaped or its handle reports it gone. The Research facts record this.goldens-versionnow buildtalk.jsfirst, because it embeds the version, then generate the payload, because it embedstalk.js. Then they update the mutation golden, format it, and runcmp. Every golden suite ingoldensandgoldens-versionruns withDOCKS_KIT_TEST_CLI_ENTRYandGOLDEN_FILTERunset (env -u).mutation.jsonstays the only golden-file exception.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 8, delta
Plan-review: repair
windows; Research, Windows stop Durability - The acceptance row requires the timeout result to arrive after the direct child exits, but the decision explicitly returns at the deadline without waiting forexitorclose. Microsoft documents thatTerminateProcesscan return before pending I/O finishes and the child exits. A correct timeout implementation can therefore fail the row - Assert that the result arrives at the deadline with partial output despite the open pipe, then observe the direct child's exit separately - class: timeout assertion requires an exit that the timeout must not wait forcli/src/engine-native/syncDispatch.ts:178,266andcli/src/commands/tidy.ts:118–134register ordinary scope finalizers that release the locks as the failure unwinds.NodeRuntime.ts:62–68calls teardown only after the fiber finishes. If the Windows handle kill fails during a writing sync, a competitor can acquire the lock before the CLI exits, while the writer may still be running - Specify how the lock scopes retain their transactions on this failure path until process exit. ReportProcessStopFailedwithout replacing the recorded signal exit code - class: lock released during unwind despite a process-exit guaranteetoolchain ensure buncallsbunBootstrapwithout one (cli/src/engine-native/modes.ts:40–49), and the updater does not hold the chained CLI's locks (cli/src/commands/update.ts:35–41,315–332). The blanket claim about tidy tool calls is also false:runTidyruns the report outside the apply lock (cli/src/commands/tidy.ts:138–158). Inference: using lock ownership to select the stop policy can let a standalone installer return without confirmed exit - Define the confirmed-exit policy by caller and operation, not by assumed lock ownership, and name which process holds each lock - class: stop policy relies on incorrect caller lock ownershipcaptureWithin, not the nudge.cli/src/commands/sync.ts:19–22checks the status returned byspawnHost, which callsspawnSync(cli/src/engine-native/exec.ts:54–60). Bun 1.4.5's synchronous spawn loop keeps waiting while the direct process is pending. If the kill fails andgit fetchstays live, the base waits; the new nudge warns and proceeds while fetch can still update refs - Keep the delegated bounded behavior, but record it as an intentional Windows nudge change rather than base parity - class: base behavior inferred from a different callergoldensandgoldens-version; parent Move the engine-native layer to Effect #290 Acceptancegoldens---no-env-fileprotects the suite drivers, butcli/test/lib/goldenExecution.ts:40–43,188–199,233–239,267–271launches fresh Bun CLI processes in the checkout without that flag. By Bun's default dotenv behavior, a locally ignored.envcontainingDRY_RUN=1makes the raw mutation child take the dry-run path (cli/src/engine-native/engineCtx.ts:65–78,cli/src/engine-native/syncDispatch.ts:261–266). The checkout can then produce different snapshots from the cleanorigin/mainarchive for reasons unrelated to the version - Disable dotenv loading in the spawned golden CLI processes as well as the drivers for checkout verification and regeneration - class: dotenv isolation stops at the suite driverPrevious findings:
unit-processandwindows, inherited tree assertion: resolved -unit-processnow limits the grandchild assertion to POSIX. Windows checks the partial output and the direct child's exit, with the ordering defect noted above.windows; parent Move the engine-native layer to Effect #290 D2: resolved - Both plans now return at the probe deadline without waiting for a live child whose kill failed.captureWithinmaps the failure totimed-out, and the nudge warns and proceeds.windows, recordingtaskkill.exestub: resolved - The row now places the stub at<fake SystemRoot>\System32\taskkill.exeand first onPATH.release; Acceptancegoldens; parent Move the engine-native layer to Effect #290 Acceptancegoldens: resolved - Both plans disable dotenv loading in the suite drivers and unset both selection overrides. The spawned CLI processes are a separate gap noted above.Manager response to round 7
Repaired:
Inherited tree assertion (Repaired):
unit-processnow keeps the tree assertion of the base timeout case ofexec.test.tson POSIX only. On Windows the same case asserts the partial output and the end of the direct child.Failed termination has no bounded outcome (Redesigned, the "Windows stop" decision): the decision now separates two paths.
captureWithin, the only timed probe, and the nudge) keeps the base completion rule at its timeout. The service attempts the handle kill, disposes of the parent's pipe ends, unrefs the child, and resolves at the deadline with no wait forexitorclose. A failed kill of a live child givesProcessStopFailed, whichcaptureWithinmaps totimed-out(sotoolchain checkprintsunknown) and which the nudge prints beforesyncproceeds. That child can survive, a known limit.spawnOmp, the Bun installer, the tidy tool calls, the chained sync). There the service observes the direct child'sexitapart fromclose, disposes of the pipes, and waits for thatexit. A failed kill keeps the lock and fails the run withProcessStopFailed; the CLI exits with that failure, and the process exit releases the lock, as on the base.The
windowsrow covers both paths. Its base timeout case now uses a descendant that holds stdout.Recording stub misses the retired path (Repaired): the
windowsrow now puts the recording stub at<fake SystemRoot>\System32\taskkill.exe, the absolute path that the basekillProcessTreeused, and first onPATH.Bun reloads the overrides from
.env(Repaired): thegoldensandgoldens-versionrows run every build and golden suite asbun --no-env-file <script>, calling the scripts directly instead ofbun run, withDOCKS_KIT_TEST_CLI_ENTRYandGOLDEN_FILTERunset. The Version decision says the same for step 6, and the Research facts record that Bun loads.envby default.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 9, delta
Plan-review: repair
goldens-version(line 127) - If the new dotenv guard fails, the shell skipsD="$(docks-kit scratch new goldens-version)"but still runsdocks-kit scratch remove "$D"after the semicolon. IfDalready names another user-owned temporary directory,cli/src/engine-native/scratch.ts:180–201permits its recursive removal even though this check never created it - Exit on a failed guard and register cleanup only after scratch creation succeeds, using the path returned by that invocation - class: cleanup can delete a resource the check did not createrelease; Acceptancegoldensandgoldens-version; parent Move the engine-native layer to Effect #290 Acceptancegoldens- The new guard checks only ignored, untracked files. The repository's.gitignoredoes not ignore.env,goldens-versionhas no clean-status precondition, and Git documents thatstatus.showUntrackedFiles=nocan hide an untracked.envfrom the childgoldensrow's status check. Inference: an unignored.envwithDRY_RUN=1can still reach the raw golden child launched from the checkout (cli/test/lib/goldenExecution.ts:40–43,188–199) and turn a mutation into a dry run (cli/src/engine-native/engineCtx.ts:65–78) - Check for Bun's dotenv paths on disk before regeneration and verification, regardless of Git tracking or ignore state, or disable dotenv loading in the golden CLI children themselves - class: dotenv isolation depends on Git ignore and status settingswindows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - The revised no-wait path dropsunref(). The base timeout closes the pipes and unreferences the child (cli/src/engine-native/exec.ts:184–198), and Bun documents that a referenced child keeps its parent alive. Inference: if a Windows version probe's kill fails, publictoolchain checkcan printunknownand still hang at exit. The public runtime does not force a normal successful exit (node_modules/@effect/platform-node-shared/src/NodeRuntime.ts:62–68) - Unreference any still-live child on the Windows no-wait paths, without changing the writer wait. Make the existingwindowsrow require that the public command exits while the failed-kill probe is still alive - class: timeout returns without releasing the child process's event-loop referencegit fetchwritesFETCH_HEADand remote refs (cli/src/commands/sync.ts:19–22,59–60; Git fetch). The updater also runsgit pull --ff-only, checkout dependency installation, and a global package install (cli/src/commands/update.ts:229–252,278–288). Inference: a Windows interrupt can return while one of these direct children is still writing, despite the confirmed-exit rule for writers - Classify each mutating command explicitly, including the updater commands before chained sync. Keep the delegated nudge deadline behavior as an explicit exception forgit fetch, separate from its interrupt policy and the read-onlyrev-list- class: mutating caller omitted from the Windows writer policyPrevious findings:
windows; Research, Windows stop Durability: resolved - The timeout result and partial output are asserted independently of the direct child'sexit.spawnSync.goldensandgoldens-version; parent Move the engine-native layer to Effect #290 Acceptancegoldens: open - repeated above.Manager response to round 8
Repaired:
windowsrow now asserts the deadline result and the partial output on their own. It then observes the direct child'sexitseparately, while the descendant still holds stdout, and does not awaitclosetogether with the result.TerminateProcessis recorded as asynchronous.spawnOmp, the Bun installer, the tidy apply tool calls, the chained sync CLI) waits for its direct child'sexitwith no deadline before its scope, and any lock scope above it, closes. A failed handle kill keeps waiting, so the lock finalizers ofsyncDispatch.tsandcommands/tidy.tscannot run while the writer runs. The recorded signal still decides the exit code. Known limit: a child that cannot be terminated keeps the CLI waiting until the user ends it.toolchain ensure bunis included through the Bun installer. The decision names which process holds each lock: the sync CLI holds the sync locks (forupdate, the chained CLI),tidy --applyholds the apply lock but not during its report, and the updater andtoolchain ensure bunhold none. The default cleanup applies to every Windows child: a handle kill, disposal of the parent's pipe ends, and anexitobserved apart fromclose. The read-only children (captureandcaptureWithinprobes, tidy report reads, the nudge) resolve after that cleanup without waiting.spawnSyncwaited for the direct process.goldensandgoldens-versionrows, and step 6, first assert that the checkout has no dotenv file:git ls-files --others --ignored --exclude-standard -- '.env' '.env.*'must print nothing. Untracked files that are not ignored already fail thegit status --porcelaincheck. The baseline archive has no dotenv file by construction.--no-env-fileand the unset overrides stay. The Research facts nameDRY_RUNand the CLI children ofgoldenExecution.ts.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 10, delta
Plan-review: repair
git fetchno-wait exception on interrupt as well as at the four-second deadline. The fetch writesFETCH_HEADand remote refs (cli/src/commands/sync.ts:19–22,59–60; Git fetch). The writer list also omitsupdate'sgit status --porcelain(cli/src/commands/update.ts:206–216), which can write the index under a lock. Inference: if either direct child cannot be stopped immediately on Windows, the CLI can return while it is still writing, despite the confirmed-exit rule for writers - Limit the fetch exception to the deadline, retain the confirmed-exit rule on interrupt, and includegit statusin the writer list in both plans. Keeprev-listread-only - class: mutating caller omitted from the Windows writer policyrelease; Acceptancegoldensand bothgoldens-versionguards; parent Move the engine-native layer to Effect #290 Acceptancegoldens-test -z "$(find …)"checks stdout, notfind's exit status. If directory enumeration fails before printing a match,testsucceeds even underset -e -o pipefail, and verification proceeds without establishing that dotenv is absent. That also contradicts thegoldens-versionpromise to stop on the first failed step. The golden child starts in the checkout without--no-env-file(cli/test/lib/goldenExecution.ts:38–43,188–199; shell command status) - Check the scan's exit status before checking its output at each launch location, or disable dotenv loading in the golden children - class: dotenv guard treats a failed scan as an empty scanPrevious findings:
goldens-version: resolved - Line 127 registers cleanup only afterscratch newsucceeds and assigns the new path.release; Acceptancegoldensandgoldens-version; parent Move the engine-native layer to Effect #290 Acceptancegoldens: resolved - Both plans now check the filesystem independently of Git tracking and ignore settings. The separate scan-error defect is reported above.windows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - Both plans requireunref()on the no-wait paths, and the childwindowsrow requires the public command to printunknownand exit while the failed-kill probe remains alive.Manager response to round 9
Repaired:
spawnOmp, the Bun installer (also intoolchain ensure bun), the tidy apply tool calls, the chained sync CLI, and theupdatechildrengit pull --ff-only,bun install --frozen-lockfile, and the global package install. The nudgegit fetchwrites refs, so it is named as the one delegated exception, with a deadline return. The nudgerev-listis read-only.unref()on a still-live child, as the base did, so the CLI can exit. The parent D2 reap promise is qualified the same way. Thewindowsrow requires that a publictoolchain checkwhose probe kill fails printsunknownand exits while the probe still lives.exitnotification with a delayed fake while a descendant holds stdout. It asserts the deadline result and the partial output first, and only then observesexit.goldensrow, step 6, the Version decision, andgoldens-versioncheck each launch folder on disk withtest -z "$(find . -maxdepth 1 -name '.env*' -print)", whatever Git tracks.goldens-versionchecks both the candidate checkout root and the unpacked baseline folder before regeneration.goldens-versionshell (Repaired): the row runs in a bash subshell withset -e -o pipefail. A failed guard ends it. The trapdocks-kit scratch remove "$D"is registered only afterdocks-kit scratch newsucceeded and assignedDinside the subshell, so it never removes an unset or inherited path. I ran the command onorigin/mainwith its own version: exit 0, and the trap removed its folder.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 11, delta
Plan-review: repair
git statusas read-only only if its argv changes. The current call has no--no-optional-locks(cli/src/commands/update.ts:23–32,206–216), and Git documents that plain status can write the index. Inference: preserving the old argv while applying the new no-wait classification lets an interrupted Windows updater exit while a survivinggit statuscan still write the index - Makegit -C <home> --no-optional-locks status --porcelainthe explicit exception to argv preservation. Keep the other updater arguments, stdio, and working directory unchanged - class: safety requirement contradicts argv preservationPrevious findings:
windowsrow checks that wait. Both policies require--no-optional-locksfor read-only status; the conflicting caller instruction is reported above.release; Acceptancegoldensand bothgoldens-versionguards; parent Move the engine-native layer to Effect #290 Acceptancegoldens: resolved - The release decision and all three acceptance rows now check the scan's exit status before testing for empty output, including the archived baseline directory.Manager response to round 10
Repaired:
update'sgit status --porcelainnow runs with--no-optional-locks, as tidy'sgitcalls do (tidy.tsline 961), so it writes no index and stays a read-only child.update.tsis already in the Files of stepprocess.git fetchno-wait exception applies only at its 4 s deadline. On an interrupt the fetch follows the writer rule and waits for a confirmed exit. Thewindowsrow checks that an interrupted fetch is waited for.rev-liststays read-only.windowsfailed-kill check requirestoolchain checkto exit 0 while the probe still lives.goldensrow usesout="$(find . -maxdepth 1 -name '.env*' -print)" && test -z "$out".goldens-versionusesout="$(find …)" || exit 1; test -z "$out"for both the checkout root and the baseline folder. The Version decision says the same for step 6.Rejected:
None.
Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 12, delta
Plan-review: pass
None.
Previous findings:
plan-review-297-round-12.md:53makesgit -C <home> --no-optional-locks status --porcelainthe sole argv exception. This matches the child and parent Windows stop policies. Git documents that the flag skips writing the refreshed index.Manager response to round 11
Repaired:
git -C <home> --no-optional-locks status --porcelain; the other updater arguments, stdio, and working directory stay.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 1, lens correctness
Code-review: pass
Standards
docks-kit syncduring the nudge'sgit fetchcan let the CLI exit while Git still writes refs. The caller setswriter: falsefor the four-second deadline, but the interrupt path uses the same flag and skips waiting forexittoo. If the kill fails, Git can keep running. - Give deadline and interrupt stops separate wait policies. Treat the fetch as a writer on interrupt and keep the no-wait exception only at its deadline. - class: deadline exception applied to interruptiondocker rmsucceeds and SIGTERM arrives during the subsequent network cleanup,tidy --applyhas already deleted the containers but neither prints nor logs their removal. The finalizer can only print lines already recorded, and the success line comes after the interruptible cleanup. - Record the successful removal before starting the best-effort network cleanup. - class: completed mutation recorded after interruptible follow-uplease.release()skip its entire body. The lease remains active and the healthy progress sink never gets the erase sequence. - Release the reservation and attempt the erase independently of the stored write error, then propagate the error without waiting for callbacks. - class: cleanup skipped by prior errorsettle, the logger reports stderr's error. It selects the first failed stream in registration order, not the first failure in time. The live logger writes to both streams; whether both errors arrive in that window depends on I/O timing. - Record a sequence number with each stream's first failure and select the earliest one. - class: error precedence based on registration orderDatabaseSynccreateskit.dbbut before the interruptible chmod sets mode 0600. The release closes the handle without securing the file, and later reads intentionally leave an existing file's mode unchanged. The file is still inside a 0700 directory, so the impact is the file mode, not exposure through that directory. - Protect the open-to-chmod interval while keeping the close finalizer registered before chmod can fail. - class: interruption between creation and mode repairCOMMITfails without automatically rolling back,inTransactionreturns the commit error with the transaction still open. The base caught commit failures and attempted rollback. The production migration and cache writer both close the handle on failure, and the store fixtures do not inject a commit failure or reuse that handle. - Capture the outcome of the body and commit together, then attempt rollback on either failure while preserving the original error. - class: commit failure bypasses rollbackctx.bunRuntimeis assigned but before the mask starts leaves the publishedDeferredincomplete. A later caller on the same context then waits indefinitely.ompSyncand toolchain ensure each call once; the concurrent bootstrap fixtures interrupt only after the installer or version probe has started. - Put the check and claim inside the mask, and restore interruption for both the bootstrap and waiters. - class: shared outcome published before interruption guardwithExclusiveerases progress, the acquire still opens the durable buffer beforewrite()surfaces the error. No release runs, so later durable writes go into a buffer that nobody flushes. No production caller useswithExclusive; its fixtures cover flush failures, not this acquire failure. - Open the buffer only after the erase succeeds. - class: failed acquisition leaves buffered statesettlestarts, then stderr starts writing before stdout drains,settlecan hang after both streams finish. The stdout callback sees stderr pending and returns, but stderr has no idle listener.runEngineNativesettles after its producers finish, and the logger fixtures do not start a write on another stream duringsettle. - While waiting, subscribe to every stream the logger tracks and unsubscribe on completion or interruption. - class: drain waiter misses newly busy streamgit rev-listlost the former per-pipespawnSynclimit. If a Git wrapper emits a large stdout stream, sync now retains it all. The only call uses stock Git's--countoutput, and the nudge fixtures return small counts. - PassSPAWN_SYNC_MAX_OUTPUTfor the captured nudge call, as the update command does. - class: capture limit dropped during migrationSpec
None.
Code review round 1, lens spec-and-tests
Code-review: fixes-required
Standards
exitbefore interrupting, confirm the grandchild still holds a pipe, and assert that it receives the stop signal. - class: fixture does not reach the intended process statewithTerminaldirectly. It can catch a wait in lease acquisition or release, but still passes if the engine starts waiting for stalled writes during shutdown. - Keep the lease test and exercise the engine with a gated sink whose callbacks remain pending until after the interrupted run ends. - class: shutdown test bypasses the run boundarySpec
git fetchexits. The plan says the fetch need not be waited for “at its 4 s deadline” but “on interrupt it is a writer” (plan-297-cr1.md:62). The caller setswriter: false, and both stop paths use that flag. If the kill fails, the fetch can continue writing after the CLI is gone. The nudge test pins the wrong flag. - Give deadline stops and interrupt stops distinct wait policies, use the no-wait exception only at the deadline, and test that interrupt waits forexit. - class: timeout exception applied to writer interruptionsyncorupdateexit 1 instead of 130. The nudge runs beforeengineinstalls the recorder, andupdatenever enters that scope. Inference: if the failed stop addsProcessStopFailedto the interrupt cause, the unrecorded signal falls through to Effect's default teardown, which returns 1 for a mixed cause. The plan requires the signal code to win after finalizers (plan-297-cr1.md:53,71). - Scope signal recording around the public command run, before it starts any child, and retain the raw channel's separate codes. - class: signal recorder starts after interruptible workDeferredthat no fiber will complete. The plan says the claim and completion both happen “inEffect.uninterruptibleMask” (plan-297-cr1.md:86), but the code publishes the claim inEffect.suspendbefore entering that mask. Inference: Effect can yield between those instructions; an interrupt there abandons the claim and a second caller waits indefinitely. The concurrent fixture interrupts only after the installer or probe starts. - Claim inside the mask, and userestorefor both the bootstrap work and the wait on an existing claim. - class: shared claim published before interruption protectionEPIPEerror from the progress stream does not stop the write at the point of failure, contrary to “a synchronous write error fails the call at once” (plan-297-cr1.md:80). For example, if erasing progress throws while enteringwithExclusive, the logger still opensbufferedWrites. Acquisition then fails, so its release never clears the buffer. Later durable output, including a failure ledger, can be queued but never printed. The same delayed error lets an ordinary durable write proceed after its progress erase fails. - Propagate the synchronous error at the sink call, before later writes or state changes, while retaining the flush's behavior of attempting all buffered writes. - class: deferred synchronous error changes control flowEPIPEerror first and stderr reports another before the next write orsettle, the logger reports stderr's error because it scans stderr first. The plan promises “the first asynchronous non-EPIPEerror” (plan-297-cr1.md:76,80), not the first failing stream in registration order. - Record failure order at the callback or event and choose the earliest failure across the run's sinks. - class: stream priority replaces failure orderplan-297-cr1.md:137. The timeout case uses default writer mode, gives the descendant no inherited stdout, and awaits result and child exit together. The held-exit variant skips Windows. There is no recordingtaskkill.exefixture, no public check that printsunknownafter a failed probe kill while the probe remains alive, and no delayed-exit interrupt assertion for a writer or the nudge fetch. - Add Windows cases with separately controlled deadline, kill result, and exit notification, and assert the public CLI outcomes. - class: missing platform-specific stop-policy coveragesignal-orderrow requires a same-home sync and two other-home syncs to encounter the locks independently, then acquire them after shutdown (plan-297-cr1.md:115). - Drive those competing syncs against the live barrier and assert which lock each is refused on and that each can proceed after release. - class: direct lock probe substitutes for command acceptancerev-listcall has no capture limit, although the plan says “the formerspawnHostcallers that pipe output passSPAWN_SYNC_MAX_OUTPUT” (plan-297-cr1.md:51). The checked caller uses stockgit rev-list --count, which emits one count, and the nudge fixtures only supply short output. A PATH wrapper emitting more than 1 MiB loses the previous bound. - Pass the per-pipe budget and keep an overflow a silent miss. - class: omitted capture limit during caller migrationCOMMITfailure skips explicit rollback, contrary to the promise thatinTransaction“commits or rolls back and keeps the original failure” (plan-297-cr1.md:84). The checked migration and cache-write callers usewithKitDb, which closes the handle, and neither the store fixtures nor documented cache inputs exercise a failed commit. If SQLite leaves the transaction open on commit failure, this helper leaves rollback to the later close. - PutCOMMITon the same failure path as the body and retain the original error if rollback fails. - class: commit failure bypasses rollbackProcessStopFailed. Under the recorded policy, a POSIX own-group deadline sends SIGKILL without the interrupt grace period or exit wait, and a failed Windows bounded-probe stop becomestimed-out(plan-297-cr1.md:51,62; cli/src/engine-native/exec.ts:325-350,542-559). A maintainer following the new guidance would change deadline latency or thetoolchain checkresult. - Document the two stop paths separately and distinguishHostProcess.runerrors fromcaptureWithinoutcomes. - class: documented stop policy conflates distinct outcomesplan-297-cr1.md:100). The atomic-write probe calls the lazyreplaceFileEffect without running it and only checks that the original link still exists, so it printstrueeven if no replacement happens. The dispatch guide also listshome.tsas Effect code even though the plan says “home.tsstays” (plan-297-cr1.md:83) andengineHomestill returns a string (cli/src/engine-native/home.ts:9-15). - Point the atomic-write probe at the existing test that checks the link and new target contents, and listengineHomeas a plain helper. - class: stale Effect migration guidanceCode review round 1, lens text-and-safety
Code-review: pass
Standards
kill(..., 0)reports the group as live butEPERMfrom the actual signal aborts cleanup. The enclosing lock then releases without confirming that the writer stopped. Inference: this can happen with a privilege-changing tool wrapper; the current stop fixtures use same-user processes. - Keep the lock while the owned writer group is still live, and surface the stop failure without treating it as proof that the group ended. - class: fail-open writer shutdowngit fetchcan let the CLI exit before the ref-writing child exits.writer: falseapplies both to the four-second deadline and to interruption, although the comment describes only a deadline exception. - Give deadline and interrupt stops separate wait policies. Keep the deadline fast and await the direct child's exit on interrupt. - class: deadline exception applied to interruptionENOBUFSresult after the child is stopped. If an update child exceeds the budget and a descendant retains a captured pipe,overflowrecords the error butawaitChildstill waits forclose, even after the direct child exits. Inference: a checkout using a helper that retains the pipe can leaveupdatewaiting instead of reportinggit status failed. - Make overflow a completion event that runs the appropriate stop policy, disposes of capture pipes, and returns the bounded output withENOBUFS. - class: output-limit stop waits on inherited pipesmain.tswould leave this fixture testing its own override, not the public policy. - Move the teardown into an importable module and use that function in both entries. - class: duplicated lifecycle policyPATHentry,whichcan return a relative executable. An explicit current-directory entry can even yield a baregit.exe, contrary to the absolute-path and no-current-directory claims. - Hand the Windows host a fully qualified, verified candidate and document whether explicitly configured current-directory lookup is honored. - class: relative executable described as absoluteProcessStopFailed. Inexec.ts:339-349,554-558, a POSIX owned probe requestsSIGKILLimmediately, andcaptureWithinmaps a stop failure totimed-out. A reader following the guide would expect a grace period and a typed failure from the bounded API. - Document deadline and interruption separately and distinguish the service error from the bounded probe result. - class: incorrect bounded-stop contractduinsideapplyTidy, butduruns in the report after the apply lock is released. - State the platform-specific guarantees once and distinguish tidy apply from report. - class: incorrect interrupt wait boundarySIGTERMand waits forgit fetchto exit, so a child that does not exit can hold up sync. An argument refusal also exits 2, as the same comment later says. - Describe ordinary probe failures as best effort and state the deadline and refusal exceptions. - class: overstated best-effort guaranteeHostProcessand that a CLI-wide search for directspawnSynccalls prints nothing. Agent docs still callsspawnSync("git", ...), and the plan and skill commands retain their own direct spawns. - Scope the rule and its verification to the migrated engine and commands. - class: overbroad migration guidancereplaceFilewithout running its Effect. It printstruefor the symlink the probe just created, even if replacement is broken. - Point the guide to the existing test that checks both the link and the new target content. - class: verification probe does not exercise behaviorupdate.test.ts:646-660does inspect the spawn options,commandLineRefusalreplacedassertCommandLineValue, live service instances are built when the layer runs,runEngineNativerequiresHostProcess,runPipelineusescatchCause, andengineHomeremains synchronous. A maintainer following these pointers would look in the wrong place or omit a required service. - Update each pointer to the current symbol, test, or layer boundary. - class: stale migration guidancerecordedFailurereturns stderr's error because stderr is first in the array. That can report the wrong cause despite the documented first-error guarantee. - Preserve error arrival order across the logger's sinks. - class: error selection by sink orderactiveLease. A later acquisition on that logger then reportsLeaseHeld, even though the previous section ended. - Clear lease ownership independently of the fallible progress erase and preserve the recorded write error. - class: cleanup gated on prior write successSpec
None.
DocksDocks commentedon Dec 2, 2026
Code review round 2, delta
Code-review: pass
Previous findings
cli/src/commands/sync.ts:26-32: fixed - The fetch useswaitAtDeadline: falseand keeps the default writer policy on interrupt (cli/src/commands/sync.ts:31-36,cli/src/engine-native/exec.ts:319-322).cli/src/engine-native/tidy.ts:1482-1488: open - The standalone removal is fixed; the worktree removal path still loses the completed Docker step. See Standards.cli/src/engine-native/logger.ts:214-218,349-355: fixed - Release clears the reservation and attempts the erase even after a recorded failure (cli/src/engine-native/logger.ts:387-403).cli/src/engine-native/logger.ts:143-145,160-164,205-211: fixed - Stream errors carry an arrival sequence, and the logger selects the earliest (cli/src/engine-native/logger.ts:149-153,239-250).cli/src/engine-native/kitDb.ts:150-157: fixed - Open and chmod are one protected acquisition; a failed chmod closes the handle (cli/src/engine-native/kitDb.ts:155-170).cli/src/engine-native/kitDb.ts:80-91: fixed - The transaction captures the commit failure, attempts rollback, and returns the original failure (cli/src/engine-native/kitDb.ts:83-95).cli/src/engine-native/bun.ts:139-149: fixed - The claim and completion run inside the mask, with interruption restored for the bootstrap and waiters (cli/src/engine-native/bun.ts:135-154).cli/src/engine-native/logger.ts:167-170,291-304: fixed - A failed erase leaves the exclusive buffer unopened (cli/src/engine-native/logger.ts:275-280,330-338).cli/src/engine-native/logger.ts:391-404: fixed - Settlement subscribes to every stream and removes the listeners on completion or interruption (cli/src/engine-native/logger.ts:435-454).cli/src/commands/sync.ts:34-38: fixed -rev-listhas the per-pipe capture budget (cli/src/commands/sync.ts:39-45).cli/test/lib/signalEngineEntry.ts:82-90: fixed - The fixture and the CLI use the same public runner and teardown (cli/test/lib/signalEngineEntry.ts:90-91,cli/src/main.ts:91,cli/src/publicRun.ts:19-31).cli/test/unit/exec.test.ts:393-403: fixed - The test observes the leader's exit before interrupting and checks that the live grandchild receives the signal (cli/test/unit/exec.test.ts:481-503).cli/test/unit/logger.test.ts:486-502: fixed - The repair adds a gated-sink test at the engine boundary (cli/test/unit/syncLock.test.ts:256-286).cli/src/commands/sync.ts:26-32, Windows fetch interruption: fixed - The interrupt path waits as for any writer, and the Windows test holds back the exit notification (cli/src/engine-native/exec.ts:319-322,cli/test/unit/windowsStop.test.ts:250-282).cli/src/commands/sync.ts:78-82, signal recording: fixed - The public runner records before any command work; the raw runner keeps its separate codes (cli/src/publicRun.ts:26-31,cli/src/main.ts:45-64,82-92).cli/src/engine-native/bun.ts:135-149: fixed - No shared claim becomes visible before interruption is masked (cli/src/engine-native/bun.ts:140-154).cli/src/engine-native/logger.ts:154-172,214-252,293-315: fixed - Ordinary writes stop after a synchronous erase error, and exclusive acquisition leaves no buffer behind (cli/src/engine-native/logger.ts:253-291,330-338,471-475).cli/src/engine-native/logger.ts:133-165,175-192,205-212: fixed - The first asynchronous failure wins across sinks (cli/src/engine-native/logger.ts:149-153,239-250).cli/test/unit/exec.test.ts:179-233,245-273, Windows coverage: open - The new cases cover the stop policies in-process, but the failed-probe case still does not prove public CLI exit. See Spec.cli/test/unit/syncSignals.test.ts:695-705,727-747: fixed - Real competing syncs check each lock independently before shutdown and succeed after release (cli/test/unit/syncSignals.test.ts:713-736,770-808).cli/src/commands/sync.ts:34-43, capture limit: open - The limit is present, but an overflow with exit code 0 is not a silent miss. See Spec.cli/src/engine-native/kitDb.ts:80-92: fixed - A failed commit follows the rollback path, and a deferred foreign-key test checks that the transaction closed (cli/src/engine-native/kitDb.ts:83-95,cli/test/unit/kitDb.test.ts:167-190).cli/src/engine-native/DESIGN.md:168-177, bounded stop: fixed - The design separates the deadline and interrupt policies and distinguishesrunerrors fromcaptureWithinoutcomes (cli/src/engine-native/DESIGN.md:173-198)..agents/skills/host-platform-context/SKILL.md:84, file helpers: open - The atomic-write probe and dispatch guide are fixed; the toolchain guide still callsengineHomeeffectful. See Spec.cli/src/engine-native/exec.ts:218-271, group identity: open - The rejection establishes that a live group keeps its ID, not that the ID stays reserved between the last member's exit and the next signal. See Standards.cli/src/engine-native/exec.ts:231-237,260-272,305-317,EPERM: fixed - A permission failure keeps group polling active until the group is gone (cli/src/engine-native/exec.ts:235-250,274-286).cli/src/commands/sync.ts:26-32, fetch interruption: fixed -waitAtDeadlineno longer controls the interrupt path (cli/src/engine-native/exec.ts:319-322,342-347).cli/src/engine-native/exec.ts:119-123,353-365,450-460, inherited pipes: fixed - Overflow ends the wait and runs the stop without awaiting the captured pipe's close (cli/src/engine-native/exec.ts:371-378,468-486).cli/src/main.ts:43-47, duplicated teardown: fixed - The production and fixture entries sharerunPublicMain(cli/src/main.ts:91,cli/test/lib/signalEngineEntry.ts:91).cli/src/engine-native/exec.ts:479-483,597-602, relative executable: fixed - A relative hit becomes absolute before invocation, and a bare name found directly in the current directory is refused (cli/src/engine-native/exec.ts:505-510,616-624).cli/src/engine-native/DESIGN.md:175-176, bounded-stop contract: fixed - The new text describes immediate POSIX group kill at the deadline and thetimed-outprobe result (cli/src/engine-native/DESIGN.md:183-198)..agents/skills/omp-sync-context/SKILL.md:92-94, interrupt wait boundary: open - The repair distinguishes the waits in the design, but the new changelog overstates them. See Standards.cli/src/commands/sync.ts:11-19, best-effort guarantee: fixed - The comment now states the POSIX wait and the argument refusal (cli/src/commands/sync.ts:11-25).cli/src/engine-native/DESIGN.md:162-166, migration scope: fixed - The design and verification search are scoped to the migrated modules (cli/src/engine-native/DESIGN.md:162-171,.agents/skills/host-platform-context/SKILL.md:111-112)..agents/skills/host-platform-context/SKILL.md:84, symlink probe: fixed - The guide points at the test that checks the preserved link and new target content (.agents/skills/host-platform-context/SKILL.md:88-89,cli/test/unit/atomicWrite.test.ts:138)..agents/skills/host-platform-context/SKILL.md:76,90,116, stale guidance: open - The toolchain guide still describes calls intohome.tsas Effects. See Spec.cli/src/engine-native/logger.ts:143-165,175-211, sink order: fixed - The logger chooses by failure sequence, not registration order (cli/src/engine-native/logger.ts:239-250).cli/src/engine-native/logger.ts:214-220,349-354,366-383, lease cleanup: fixed - Release clears ownership before attempting progress output (cli/src/engine-native/logger.ts:389-395).Standards
tidy.log. The standaloneremove-containersrepair records the result before cleanup, butremove-worktreerecords nothing until the later Git call finishes. - Track the completed Docker removal before cleanup, and report it if the compound action stops before the existing worktree success line. Keep the normal success output unchanged. - class: completed mutation recorded after interruptible follow-upspawnSynccan prevent the test timeout from firing at all. - Use bounded competitors that are ready before shutdown, and assert that the writer observed the barrier before it exited. - class: test barrier races production escalationspawnOmpand tidy callers, the documented bounded probes, and the group fixtures do not exercise rapid group-ID reuse. - Bind signaling to verified ownership across the stop, and document the identity limit where the host cannot provide that guarantee. - class: reused process-group identityPATHand an installed Git later can makeupdatereport that Git is missing. The resolver rejects the first hit afterwhichhas stopped searching, so it never sees the valid next entry. This depends on the user'sPATHorder; the current-directory fixture checks only a path with no fallback. - Skip disallowed directories during the host lookup and continue searching for an allowed executable. Keep the current-directory refusal when no allowed match exists. - class: rejected candidate ends path searchrunWritessucceeds. The live sync pipeline uses the lease, but its fixtures cover the two failures separately, and the documented stalled and broken pipe cases do not combine them. - Attempt the erase without skipping the recorded-error check. Retain the original asynchronous failure when cleanup also fails. - class: cleanup failure masks recorded errorSIGKILLafter three seconds. The updater uses shared children on POSIX; it sends onlySIGTERMto the direct child and waits. The same note first promises a wait for every child, although Windows does not wait for read-only children. - Distinguish owned POSIX groups, shared POSIX children, and Windows writers and reads in the release note. - class: incorrect interrupt wait boundarycloseinstead ofexit. The fixture holds and releases both events together, so it cannot tell which event ends the scope. - Release the exit notification while keeping close held, and assert that the interrupted scope ends before releasing close. - class: fixture conflates exit and pipe closefinallyonly after a result or rejection. A Vitest timeout does not cancel those awaits, so the child fixtures can outlive a failed case. - Record ownership before waiting for the result, bound the assertion within the test, and release the event gates and stop the owned children on failure. - class: fixture cleanup waits on the operation under testSpec
synccan wait indefinitely before entering the engine.stopOnWindows(..., false)returnsProcessStopFailed, but the failed use triggers a second stop in the release. That stop uses the interrupt writer policy and waits for exit. The plan says a failed deadline kill of the nudge prints a warning and then sync proceeds (plan-297-cr2.md:53,62). - Keep the deadline policy through failure cleanup, and use the writer wait only for an actual interrupt. Test a failed deadline kill while the fetch remains alive. - class: deadline failure retried as writer interruptionunref()would not fail the test. Thewindowsrow requires a publictoolchain checkthat printsunknownand exits 0 while the probe still lives (plan-297-cr2.md:137). - Run the public entry in a subprocess with controlled probe termination, and observe exit 0 before ending the probe. - class: in-process result substitutes for public exitunit-loggerrow requires a run that ends without waiting when interrupted with a stalled lease draw (plan-297-cr2.md:110). - Gate the engine test on a real progress draw and leave its callback pending until after the interrupted run ends. - class: acceptance test misses the required combined staterev-listwrapper can exceed the limit and still exit 0. The result carries bothENOBUFSand exit code 0, so the nudge prints the truncated output as a commit count. The plan says ordinary nudge failures are silent (plan-297-cr2.md:53). Stock Git emits a short count, and the nudge fixture gives its overflow a null exit code. - Check the process error before reading the count, and test an overflow result with exit code 0. - class: failed capture treated as successhome.tsare Effects. The Files decision says “home.tsstays,” and Step 5 requires accurate guidance on the Effect forms of the helpers (plan-297-cr2.md:83,100).engineHomereturns a string. - Separate the plain home resolver from the effectful toolchain dependencies in the guide. - class: synchronous helper documented as effectfulManager response to round 1
Repaired (commit 01aa2623; Windows cases also in 1d5f197a):
ProcessOptions.waitAtDeadlineapplies only to the Windows deadline stop; an interrupt stop always followswriter, so the nudgegit fetchis waited for until its exit on interrupt. The nudge options test and a Windows interrupt case pin this.rev-listcapture limit: it passesSPAWN_SYNC_MAX_OUTPUT; an overflow is a silent miss.cli/src/publicRun.tsrecords the signal around the whole public command run; the raw channel keeps 130 and 143.signalTeardownis one function inpublicRun.tsthatmain.tsandsignalEngineEntry.tsuse.restore. No test: the interval between the claim and the mask cannot be reached deterministically.withExclusiveopens its buffer only after the erase; the earliest asynchronous failure across streams wins; the lease release clears ownership after a stored error;settlewaits on every tracked stream.windowsStop.test.tscovers the writer and nudge interrupt waits, a failed probe kill that printsunknown, notaskkill.exe, and the deadline result before a held-back exit.DESIGN.mdstates the deadline stop and the interrupt stop separately and the platform guarantees once;captureWithintimed-outis separate fromProcessStopFailed;duruns in the report; the spawn rule is scoped to the engine and migrated commands; the symlink probe points to theatomicWritetest; stale anchors are updated; a Windows name found through a relativePATHentry becomes an absolute path, and a bare name found in the current directory is refused.Rejected:
kill(-pgid, 0)gives ESRCH. The window between the last member's exit and the next signal is the same for everykill(-pgid)user; Node offers no stable handle for a group (a Linux pidfd covers one process). No fixture or caller can reach it.Redesigned: none.
Also in this round's candidate: main was merged (2a0fa084, the #315 changes, not part of this review), and step 6 released 0.33.2 (292a0a0b).
DocksDocks commentedon Dec 2, 2026
Code review round 3, delta
Code-review: fixes-required
Previous findings
cli/src/engine-native/tidy.ts:1443-1460,1481-1489: fixed - A successful Docker removal now records a pending line before network cleanup. The apply finalizer prints and logs it on interruption (cli/src/engine-native/tidy.ts:1389-1390,1458-1469).cli/test/unit/syncSignals.test.ts:138-143,713-736,765-808: open - Parallel competitors and the.seenmarker prevent the old false pass, but the production grace period can still cause a false failure. See Standards.cli/src/engine-native/exec.ts:228-250,274-286,356-365: open -DESIGN.md:190-195documents the limit; the signaling code still has it. See Standards.cli/src/engine-native/exec.ts:616-624,638-647: fixed - The resolver skips the literal current-directory hit and tries later entries; the new test checks that fallback (cli/src/engine-native/exec.ts:633-642,654-674,cli/test/unit/exec.test.ts:161-181).cli/src/engine-native/logger.ts:389-403: fixed - The release checks the recorded error even when the erase fails (cli/src/engine-native/logger.ts:389-403).CHANGELOG.md:5-17: fixed - The release note now distinguishes POSIX groups, shared POSIX children, and Windows writers and reads (CHANGELOG.md:9-20).cli/test/unit/windowsStop.test.ts:99-110,228-282: fixed - Both interrupt cases releaseexitand assert completion before releasingclose(cli/test/unit/windowsStop.test.ts:288-305,329-346).cli/test/unit/exec.test.ts:352-382andcli/test/unit/windowsStop.test.ts:194-222: open - The result waits have bounds, but there are still paths that skip fixture cleanup. See Standards.cli/src/engine-native/exec.ts:426-430,468-478: fixed - Output overflow and close now complete one deferred without a separate race (cli/src/engine-native/exec.ts:384,436,449,490-494).cli/src/commands/sync.ts:31-36,54-57andcli/src/engine-native/exec.ts:296-310,342-347,480-487,515-523: fixed - A failed deadline stop no longer triggers writer cleanup; the new Windows case checks that the nudge warns and returns while Git is alive (cli/src/engine-native/exec.ts:474-502,533-538,cli/test/unit/windowsStop.test.ts:352-384).cli/test/unit/windowsStop.test.ts:286-314: open - The test now observes subprocess exit, but it does not guarantee that the subprocess takes the public path. See Spec.cli/test/unit/syncLock.test.ts:256-286andcli/test/unit/logger.test.ts:486-502: fixed - When it reaches its gate, the new engine case interrupts with a real lease draw pending and checks that the callback is still pending after exit (cli/test/unit/syncLock.test.ts:282-295). The gate itself introduces a separate CI failure below.cli/src/commands/sync.ts:39-49: fixed - The nudge checksres.errorbefore reading the count; its fixture covers both exit 0 and null (cli/src/commands/sync.ts:45-48,cli/test/unit/syncUpdateNudge.test.ts:111-125)..agents/skills/toolchain-context/SKILL.md:35-43: fixed - The guide now describesengineHomeas a plain function (.agents/skills/toolchain-context/SKILL.md:38-41).Standards
omponPATH, the new stalled-lease test waits until Vitest times out. The fake process service does not replace the real dependency presence probes. Bun is found without spawning, the missingompskips the plugin pass, and no child completesstarted. Inference: this blocks the portable unit jobs on runners provisioned by the workflow, which installs Bun and package dependencies but does not installomp. - Use the file's existing dependency fixture to make Bun andomppresent, gate on the intended fakeompcall, and fail promptly if the engine ends before reaching that call. - class: test gate depends on an unprovisioned host executablecloseevents can still consume the three-second grace period. The new.seenassertion detects escalation but does not prevent it from racing the test. - Give the barrier case an independently controlled stop clock, and leave the separate escalation case on the production grace period. - class: test barrier races production escalationspawnOmpand tidy callers, documented bounded probes, and group fixtures do not exercise rapid ID reuse. The design now states the limit, but the source still says the ID cannot name an unrelated process. - Remove the categorical source guarantee; eliminating the defect requires a stop mechanism that can bind signals to the owned group across its lifetime. - class: reused process-group identityPATHentry is a directory alias for the current folder, the revised lookup can accept a hit in that same folder after rejecting the literal current-directory hit. Inference: the comparison checks normalized path text, not directory identity. The bare Git calls inupdateCheckoutandupdateNudge, the host-resolution fixtures, and the documented relative-PATHexample do not exercise an aliased folder. - Compare canonical containing directories before accepting bare names, while keeping explicit paths and legitimate later entries usable. - class: lexical comparison misses a directory aliasawait exited. The public probe test records ownership only after CLI close, so on a close timeout it writes a release file without waiting for the probe; the hook can remove that file before the probe sees it. - Acquire a complete, positive PID record before waiting for the result, and reserve time to release the gates and confirm shutdown infinallybefore deleting the fixture. - class: fixture cleanup waits on the operation under testPATHfallback case, exportedwhichreturns the current-folder hit butHostProcess.runselects the later entry. The guide still saysrunuseswhich, and the resolver docstring says the first hit produces an empty result. - Describe the filtered lookup used for spawning and distinguish it from plainwhich. - class: stale executable resolution guidanceENOBUFScannot come with exit 0, directly above the check and regression case for that combination. - Keep only the explanation that a capture error invalidates the count regardless of exit status. - class: stale overflow result commentSpec
windowsrow requires “a publictoolchain checkwhose probe kill fails” (plan-297-cr3.md:137). The test spreads the parent environment without clearingDOCKS_KIT_ENGINE. If it inheritsnative-raw, the child bypasses the public runner and explicitly exits 0. Inference: in that environment the test can pass even if removingunref()would leave the public CLI running. - Use the established case-insensitive child-environment helper and explicitly select the public path. - class: inherited environment bypasses required public entryplan-297-cr3.md:137), but the preload writes its only marker at spawn. Inference: if the deadline path drops the kill call but still detaches the live probe and reports a timeout, all assertions pass. - Record invocation inside the failingkillreplacement and assert that the deadline path attempted the kill. - class: fixture records setup instead of the required failure pathManager response to round 2
Repaired (commit aff8842c):
tidy.tsworktree removal: afterdocker rmsucceeds, a pending lineremoved N container(s) of worktree <path>is logged and printed when the action stops before its worktree line; normal output is unchanged.syncSignals.test.tsbarrier race: competitors start before the shutdown and wait for a go file, each bounded by a deadline, with nospawnSync; the stub writesbarrier.seen, and the case asserts it.cannot stop gitand returns while the fetch runs.unknown, and a live probe, then ends the probe.DESIGN.mdstates the limit: POSIX gives no stable group handle, the stop ends at the first ESRCH, and the window after the last member exits is not guarded.PATHentry.exitwhileclosestays held, and the scope ends beforeclose.finally.closeand overflow complete one deferred.Syncing omp...draw, interrupts, and asserts that the run ends within 5 s with the callback pending.engineHomeis plain, separate from the effectful dependencies.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 4, delta
Code-review: pass
Previous findings
cli/test/unit/syncLock.test.ts:269-282: fixed - The fixture provides Bun, omp, and git without using the host PATH, and waits specifically for the fake omp call (cli/test/unit/syncLock.test.ts:268-305).cli/test/unit/syncSignals.test.ts:717-721,848-881: fixed - The barrier case has a grace period longer than its deadline; the wrapper case still uses the production default (cli/test/unit/syncSignals.test.ts:824-831,899-916). The production exposure of the override is a separate Spec finding.cli/test/unit/syncSignals.test.ts:251-278,717-721,747-787,848-853: fixed - Competitors use the fixture supervisor, and their stubs take tickets in the supervised root (cli/test/unit/syncSignals.test.ts:400-428,747-776).cli/src/engine-native/exec.ts:233-255,285-295,356-365: open - The comment now states the limit, but the runtime still signals by reusable group ID. Repeated under Standards.cli/src/engine-native/exec.ts:633-642,663-673: open - A normal junction is covered, but a failed canonical lookup still falls back to lexical comparison. Repeated under Standards.cli/test/unit/exec.test.ts:385-415andcli/test/unit/windowsStop.test.ts:250-277,418-437: open - A late PID record can still leave teardown without ownership. Repeated under Standards.cli/test/unit/syncLock.test.ts:282-295andcli/test/unit/tidy.test.ts:1005-1031: open - The waits have bounds, but the cleanup still cannot release every stalled operation. Repeated under Standards.cli/src/engine-native/exec.ts:627-642,645-651and.agents/skills/host-platform-context/SKILL.md:44: fixed - The resolver docstring and skill distinguish the filtered spawn lookup from plainwhich(cli/src/engine-native/exec.ts:644-651,.agents/skills/host-platform-context/SKILL.md:44).cli/src/commands/sync.ts:43-47: fixed - The remaining comment correctly says a capture error invalidates the count at any exit status (cli/src/commands/sync.ts:45-46).cli/test/unit/windowsStop.test.ts:398-412,418-430: fixed -childEnvclears inherited spellings ofDOCKS_KIT_ENGINE, so the spawned test uses the public entry (cli/test/unit/windowsStop.test.ts:405-420).cli/test/unit/windowsStop.test.ts:165-174,423-430: fixed - The failing kill writes its own marker, which the test asserts (cli/test/unit/windowsStop.test.ts:169-180,445-449).Standards
spawnOmpand tidy callers, bounded probe inputs, and group-stop fixtures do not exercise rapid ID reuse. - Use an ownership mechanism that cannot redirect a stop to a recycled group ID. - class: reused process-group identityEffect.nevergives cleanup no way to unblock it. The two 10-second waits also put spy restoration after Vitest's 15-second POSIX timeout. In the sync fixture, draining callbacks once does not release a later erase submitted after a stalled draw is unblocked. Inference: a regression in the behavior under test can leave a spy or fiber active into the next case. - Give the tidy fake a release gate, let the sync sink complete future writes once cleanup starts, and reserve time to join the fibers and restore the spy. - class: fiber fixture lacks an independent cleanup pathSpec
PROCESS_STOP_GRACE_MS(3000 ms),” then sendsSIGKILL(plan-297-cr4.md:51). The live service reads the supposed test-only override from the ordinary CLI environment. If a POSIX sync inherits a longer value and its omp child ignoresSIGTERM, the CLI holds its locks beyond the specified grace period. - Keep the live grace period fixed and inject the longer grace only through a fixture-owned clock or process layer. - class: test timing override changes production shutdownManager response to round 3
Repaired (commit e253c168):
syncLock.test.tsstalled-lease case withoutompon PATH (HIGH): the case uses the file's dependency fixture (Bun, omp, and git present, no spawns), holds only theompchild, and fails at once when the run ends before that call or after 5 s. Withompoff PATH, the new case passes and the old case hangs.DOCKS_KIT_TEST_STOP_GRACE_MSreplaces the stop grace in the barrier case; the wrapper case keeps the production grace. Competitors run through the fixture supervisor, which stops them before the root goes.childEnvwithDOCKS_KIT_ENGINE: ""; the failingkillwrites a marker that the case asserts; the probe pid is taken before the wait for the CLI.DESIGN.mdand makes no categorical claim. The limit itself stays: POSIX gives no stable group handle.exitedwait, andfinallyblocks that release callbacks, interrupt fibers, and restore spies.DESIGN.mddescribe the filtered spawn lookup, separate from plainwhich.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 5, delta
Code-review: pass
Previous findings
cli/test/unit/syncSignals.test.ts:824-831,853-878,258-301: fixed - Teardown opens each launch's barrier before requesting shutdown (cli/test/unit/syncSignals.test.ts:282-295). The new escalation race is separate.cli/src/engine-native/exec.ts:259-280,298-309,378-385: open - The rejection explains why POSIX group IDs are used but does not refute the reuse window. Repeated under Standards.cli/src/engine-native/exec.ts:653-670: open - Unverifiable candidate directories are skipped, but an unverifiable current directory still falls back to a lexical path. Repeated under Standards.cli/test/unit/exec.test.ts:430-451andcli/test/unit/windowsStop.test.ts:263-284,427-457: open - Atomic publication prevents partial PID reads, but teardown can still miss a process started before its PID was published. Repeated under Standards.cli/test/unit/tidy.test.ts:1006-1012,1023-1041andcli/test/unit/syncLock.test.ts:261-268,297-318: open - The tidy fake can now be released and the sync sink drains future writes, but the sync fixture still has an independent wait that teardown cannot release. Repeated under Standards.cli/src/engine-native/exec.ts:35-49,298-309: fixed - The live stop uses the fixed 3,000 ms grace constant without an environment override (cli/src/engine-native/exec.ts:34,283-294).Standards
ESRCHonly helps when a check observes the gap. The omp and tidy callers, bounded probes, and group-stop fixtures do not exercise rapid ID reuse. - Use a process ownership mechanism that cannot redirect a stop to a recycled group ID. - class: reused process-group identity.fails while the current directory is named through an alias, a PATH candidate can still resolve successfully to that same directory. Inference: comparing the verified candidate path to the unresolved spelling of.can accept a current-directory hit. The bare Git callers, junction fixture, and documented relative-PATH example do not exercise a failed lookup of.. - Require verified identities on both sides of the bare-name comparison; leave explicit paths usable and test failures on either side. - class: lexical comparison misses a directory aliasEffect.neverafter the test fails. Draining the progress sink or releasing an interrupt finalizer does not unblock those waits. The logger-only case likewise has no cleanup path if the draw waits for its sink callback. - Give each stalled fake a teardown-controlled release, bound the assertion waits, and join the fibers before removing fixtures or restoring mocks. - class: fiber fixture lacks an independent cleanup pathSpec
signal-orderrow says “the test then opens the barrier, the stub finishes its shutdown” (plan-297-cr5.md:115). If the barrier opens after the last grace-period poll but before the preload checks for the file, inference: the preload forwardsSIGKILLbefore the stub's next poll. The stub can die without writingbarrier.seenor releasing its shutdown ticket, so a correct CLI can fail the acceptance case and leave its fixture behind. - Suppress escalation for the barrier stub's group through its exit. Keep the separate wrapper cases unpatched so they still test real escalation. - class: barrier publication races forced terminationManager response to round 4
Repaired (commit 8bf4afe8):
DOCKS_KIT_TEST_STOP_GRACE_MSis gone; the live stop polls forPROCESS_STOP_GRACE_MSand reads no environment. The barrier case holds the groupSIGKILLthrough a test preload until its barrier file exists; the wrapper case keeps the real grace and escalation.stopAndRemovewrites the barrier file of every launch before it stops the launches and waits for them.finally; the Windows probe case waits for the probe before the release file goes; the tidy network fake waits on a release gate; the sync sink completes later writes once cleanup starts; each fiber wait is bounded to 3 s.Rejected:
DESIGN.mdrecords the remaining window as a known limit. No caller or fixture reaches rapid group-ID reuse.Redesigned: none.