Skip to content

Move the process layer, the file helpers, and the kit store to Effect #297

Todo

Description

@DocksDocks

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: spawnHost is spawnSync and calls process.exit(2) on a refusal of host.invoke; spawnProcess returns a Promise with a refusal or spawn error in error; only a bounded child (timeoutMs) is detached on POSIX and ended at its timeout (killProcessTree, lines 185-245); an unbounded child is never stopped.
  • os/types.ts HostOs.invoke returns an Invocation; os/windows.ts assertCommandLineValue throws for %, CR, or LF in a shim call; the other os/ modules are plain.
  • Process callers: update.ts (UpdateSpawn, default spawnHost), sync.ts updateNudge (two spawnHost("git", ...) calls, a 4000 ms fetch timeout), runTool, spawnOmp (no timeout), installBun, and deps.ts (captureWithin is the only timed probe); kitGate.ts calls which. Bun 1.4.5 spawnSync gives ENOBUFS past 1 MiB on one pipe, none for 600 KiB on each (checked).
  • processes.ts processExited is a sync kill(pid, 0) probe.
  • atomicWrite.ts replaceFile is synchronous (a wx sibling, chmod, rename, stale cleanup); callers: ompFileDeploy.ts, ompKitPlugin.ts, ompRemovals.ts (bridgeSync), ompFastMode.ts (Effect.try).
  • kitDb.ts withKitDb opens DatabaseSync, secures the modes, migrates, checkpoints after a write or migration, and closes in finally; migrate and inTransaction throw; readCache and writeCache (caller toolchain.ts) turn every throw into a miss or a no-op.
  • kitLock.ts imports only node: modules; acquireKitLock (a Promise poll) has only test callers (also RACER and HOLDER). The parent D4 lock scope is syncDispatch.ts scopedKitLock (Move the engine seam and the sync orchestration to Effect #294), pinned by syncLock.test.ts; tidy takes one tryAcquireKitLock try.
  • scratch.ts: createScratchDir throws for a bad label; the removal helpers turn each node:fs throw into a refused outcome. Callers: commands/scratch.ts, plan/services.ts (in fileOperation), and tidy.ts applyTidy (bridgeSync).
  • home.ts engineHome falls back to os.homedir().
  • kitHome.ts reads package.json with readFileSync and throws the four explicitKitHome diagnostics; callers: engineCtx.ts (bridged into KitHomeInvalid), sync.ts, update.ts. fileText.ts (Move the omp passes and the kit store to Effect #296) has readTextKeepingBom, pathExists, and nodeError.
  • logger.ts writeIgnoringEpipe rethrows a non-EPIPE write error, also an asynchronous one (an uncaught exception); flushDurable rethrows the first buffered error; the passes call the Logger through bridgeSync.
  • bridge.ts defines LegacyStepFailed, failureText, bridgeSync, and bridgePromise; engine.ts, ompYaml.ts, and ompKitPlugin.ts use failureText. The parent bridges, throws, and promises scans match on b3b277fd.
  • engine.ts (no Effect.tryPromise, Move the engine seam and the sync orchestration to Effect #294) and the raw channel of main.ts run in signalGuard.ts exitOnSignal, whose listeners call process.exit(code) unless deferSignalExit is open and no signalExitPoint waits; tidy and the passes use them too.
  • Tidy apply: planAndApply masks applyTidy and its printing; applyTidy takes deferSignalExit, wraps git and docker in signalExitPoint, and ends with appendLog; tidy's git calls pass --no-optional-locks (tidy.ts line 961). EXIT_BOUND_MS is 10 000 in the signal tests.
  • Move the toolchain passes to Effect #298 candidate c41d9d7d: bunBootstrap masks all of runBunBootstrap, also an unbounded deps.version("bun") after the folder removal; waiters use the Deferred; toolchain-context/SKILL.md names the bridge.ts route until Move the process layer, the file helpers, and the kit store to Effect #297.
  • Test doubles: vi.mock of exec.ts in five step process tests, UpdateSpawn recorders in update.test.ts, and bridge imports in three tests.

Effect and runtime facts (effect 4.1.7, @effect/platform-bun 4.1.7):

  • NodeRuntime.ts runMain interrupts the main fiber on SIGINT and SIGTERM and takes a teardown; Runtime.ts defaultTeardown gives 130 only for an interrupt-only cause; signalEngineEntry.ts supplies its own layers and a failing logger finalizer, after which syncSignals.test.ts expects 130.
  • Process semantics: detached: true makes a POSIX child call setsid, a new session with no controlling terminal (Node); Git can prompt on /dev/tty with stdin ignored (gitcredentials). A child can emit exit before close (Node). kill reports a zombie as a process (POSIX kill); POSIX _exit gives the children of an exiting process to a system process.
  • Effect.acquireRelease takes an infallible release (Effect.ts line 14260); DatabaseSync.close() can throw; Writable.write reports errors through its callback. syncDispatch.ts (line 100) and DESIGN.md (148) name acquireKitLock. talk.js embeds the version; the payload embeds talk.js. DOCKS_KIT_TEST_CLI_ENTRY, GOLDEN_FILTER, and DRY_RUN, also from a default-loaded .env, change the golden drivers and their CLI children (goldenExecution.ts).
  • BunFileSystem.layer is NodeFileSystem.layer, whose realPath uses realpath.native on Windows; internal/utils.ts handleErrnoException keeps syscall and the Node error. On Bun 1.4.5 FileSystem.remove reports EPERM as EFAULT (plan-296.md, decision Files).
  • Effect.acquireUseRelease lets the release fail; uninterruptibleMask, Effect.callback, Deferred, and Schedule.spaced exist. ChildProcess lacks windowsVerbatimArguments (parent D2).
  • cli/tsconfig.json allowedUnstableApis covers the unstable symbols in use. No package has a node:sqlite driver (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 spawnHost and each synchronous caller.
    • Options: (a) a Context.Service HostProcess in exec.ts whose run owns the child in its own scope; (b) module-level Effect functions with the host in the options, faked with vi.mock as now; (c) keep spawnHost for the command callers and move only spawnProcess.
    • Evidence: the test doubles above; cli/src/services.ts engineServicesLayer gives the services as layers; defaultTidyHost injects the tool calls.
    • Failure modes: (a) every Effect that spawns needs HostProcess, and a POSIX group stop needs detached, 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 and update stay blocking, against parent D2.
    • Reversibility: inside this child; a later plan can swap HostProcess.layer with no caller change.
    • Durability: one spawn path. HostProcess.run(command, args, options) returns Effect<ProcessResult, HostArgumentRefused | ProcessStopFailed>; ProcessResult and ProcessOptions rename the async types and add group: "own" | "shared" (default "own"), writer, and maxOutputBytes. run is an Effect.acquireUseRelease: the acquire spawns and records the direct child's spawn, error, and exit events at once; the use returns after close; the release stops what runs and can fail. An "own" child is detached on POSIX and leads its own group; the release works on the group, whatever the leader's state: at ESRCH from kill(-pgid, 0) it is done; else it sends SIGTERM, polls with Schedule.spaced(PROCESS_GONE_POLL_MS) for up to PROCESS_STOP_GRACE_MS (3000 ms), sends SIGKILL, and polls with the locks held until ESRCH, with no deadline (SIGKILL cannot be caught, uninterruptible sleep ends with its I/O, and POSIX _exit gives 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 sends SIGTERM to it alone and waits for its exit, as spawnSync did. One timeout rule per path: a POSIX "own" bounded probe keeps the base rule (SIGKILL to the group once, destroy the pipes, unref, resolve timedOut with the partial output at the deadline); a POSIX "shared" child with a timeout (the 4 s nudge fetch) works as spawnSync with timeout: SIGTERM to the direct child, a wait for its exit, and a result with the child's exit code and timedOut: true, so the nudge keeps its exit-status check (exit 0 goes on to rev-list); Windows stops follow the Windows stop decision. Only an interrupt uses the group poll. Each captured pipe has its own maxOutputBytes budget, as in Bun's spawnSync: output past it on either pipe stops the child and gives the output so far with an ENOBUFS error; the former spawnHost callers that pipe output pass SPAWN_SYNC_MAX_OUTPUT (1 MiB), so git status over it still takes the git status failed branch. trackBoundedChild goes.
    • Refusal: HostOs.invoke returns a Result<Invocation, HostArgumentRefused> with the current message; run fails with it and spawns nothing. refusalAsResult folds it into a result whose error holds that message, as spawnProcess did, for runTool, spawnOmp, installBun, capture, and captureWithin, so omp plugin link still records a failure and the inventory only warns. update.ts and updateNudge turn it into bail(message, 2), as spawnHost did. The service never exits the process.
    • Callers: spawnHost is deleted; no synchronous caller remains. update.ts runs "shared" children with the same argv, stdio, and cwd, with one exception: the status check becomes git -C <home> --no-optional-locks status --porcelain, so it writes no index, so git pull can 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 its omp child can outlive it, as with the base (known limit); chainSync keeps its forwarded exit code. updateNudge becomes an Effect over kitHome, pathExists, and two "shared" run calls (timeoutMs: 4000 for the fetch); the exit status decides, as in the base (a timed-out fetch that exits 0 still reaches rev-list; timedOut alone skips nothing), an ordinary failure stays a silent miss, the refusal exits 2 (parent D2 amendment), and a ProcessStopFailed is printed with logger.warn, then sync proceeds, and a recorded signal keeps its exit code. defaultTidyHost reads HostProcess once, so ToolCall keeps no requirement. which and commandExists stay plain, because the synchronous kitGate.ts headingScans calls which (runs row).
    • Pre-mortem: a "shared" child that ignores SIGTERM keeps the CLI waiting, as spawnSync did; the "shared" children end on SIGTERM. An "own" child that reads the terminal stops with SIGTTIN; engine children have stdin "ignore". A SIGKILL of the CLI leaves the "own" groups running, as before. A PID 1 that does not reap (a container without an init) keeps the post-SIGKILL poll 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.
  • 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.exe on any path; (b) keep the base best-effort taskkill /T for captureWithin timeouts and at CLI exit; (c) a Job Object.
    • Evidence: taskkill /PID /T selects a numeric PID, and Windows can reuse a PID after the last handle closes (Old New Thing); the base runs it through spawnSync after its exit guard (exec.ts killProcessTree); an async helper cannot pin the identity, and a sync one blocks the runtime; TerminateProcess is asynchronous and can fail; Node and Bun have no Job Object API. Lock holders: the sync CLI holds the sync locks (for update, the chained CLI), tidy --apply the apply lock (not its report); the updater and toolchain ensure bun hold 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 exit apart from close. The writers (spawnOmp, the Bun installer, also in toolchain ensure bun, the tidy apply tool calls, the chained sync CLI, and the update children git pull --ff-only, bun install --frozen-lockfile, and the global package install) then wait for that exit with 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 (capture and captureWithin probes, tidy report reads, the nudge rev-list, and update's git status --porcelain, run with --no-optional-locks, as tidy's calls are, so it writes no index) and one delegated exception, the nudge git fetch at 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 and unref() a still-live child, as the base did, so the CLI can exit; a failed kill of a live one gives ProcessStopFailed, which captureWithin maps to timed-out (toolchain check prints unknown) and the nudge prints before sync proceeds. The nudge's deadline return is an intentional Windows change (the base spawnSync waited). 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 what applyTidy protects.
    • 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: runMain and Runtime.ts above; the parent signal-order and throws rows; 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-order forbids it).
    • Reversibility: inside this child.
    • Durability: signalGuard.ts keeps the exit codes and mutationRegion (now Effect.uninterruptible(mutation)); the signal state, the old helpers, and every process.exit go. A new recordSignal(codes) records the first signal's code; main.ts and signalEngineEntry.ts give runMain a teardown that exits with it after every finalizer, so a failing finalizer after a signal still gives 130. The raw channel runs with Effect.runFork; its listeners also interrupt the fiber, and main.ts exits with the recorded 130 or 143 after it ends. applyTidy runs its actions interruptibly (each process.kill stop and scratch removal is one unsplittable step) and always ends with one mutationRegion that rotates and appends tidy.log with the lines so far and prints them (Effect.onExit), inside the apply lock; planAndApply no longer prints the apply lines and keeps process.exitCode = 1 for 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 bridges row lists every remaining Effect.uninterruptible.
    • Choice: (a). Rejected: (b). On Windows a forced termination stays as it is (parent ownership table).
  • Logger (delegated):
    • Question: how a stream write error reaches the typed channel without the logger bridges.
    • Options: (a) each Logger method returns Effect<void, LoggerWriteFailed>; the first asynchronous non-EPIPE error is recorded, and every later call and logger.settle fail with it; (b) the methods stay synchronous, never throw, and a recorded error surfaces only at settle.
    • Evidence: writeIgnoringEpipe and flushDurable above.
    • 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; EPIPE is ignored; a stream write stays pending until its callback runs; settle waits interruptibly for no pending write and then fails with the first recorded error; runEngineNative runs it only on success or a failure exit, so the last ledger write's error still fails the run and comes last, as a throwing finally did. The lease becomes withTerminal(message, use), an Effect.acquireUseRelease whose release (the progress erase) fails with LoggerWriteFailed, used by runPipeline, which prints a failed pipeline's ledger with Effect.catchCause; withExclusive flushes in its release and fails the section with LoggerWriteFailed; 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.warnMissing and recordFailure become Effects; the logger bridges go.
    • Pre-mortem: a write fails after settle returned. Guard: settle waits for every submitted write's callback, and the error listener records any non-EPIPE error without a throw.
    • Choice: (a). Rejected: (b).
  • Files (delegated, one line): atomicWrite.ts, the effectful scratch.ts exports, and kitHome.ts become Effects over FileSystem with the same order, modes, outcomes, and texts; replaceFile runs its write, chmod, rename, and cleanup in one mutationRegion; kitHome.ts reads through readTextKeepingBom, keeps its diagnostics (nodeError), and owns KitHomeInvalid; scratch.ts keeps node:fs realpathSync and rmSync in Effect.try, because FileSystem.realPath is native on Windows and FileSystem.remove on Bun 1.4.5 reports EPERM as EFAULT; a bad label is ScratchLabelInvalid; home.ts stays and processExited becomes Effect.sync; the bridges around engineHome go; os/ apart from the refusal, errorText.ts (which takes failureText from bridge.ts), jq.ts, and sharedTypes.d.ts stay plain.
  • Kit store (delegated, one line): kitDb.ts withKitDb(home, access, use) opens one handle with Effect.acquireUseRelease, with Effect.try over node:sqlite and FileSystem for the modes; its release (the checkpoint after a write or migration, then close) can fail, so a failed close stays a typed KitDbFailed; a newer schema is KitDbTooNew with the current text; inTransaction is an Effect.uninterruptibleMask that commits or rolls back and keeps the original failure; readCache and writeCache keep their miss and no-op, and toolchain.ts yields them unbridged.
  • Kit lock (delegated, one line): acquireKitLock, KitLockResult, and the poll options go, because scopedKitLock is the parent D4 lock scope; its Effect.sleep loop stays; the RACER fixture retries tryAcquireKitLock on its own 50 ms loop, the HOLDER fixture tries once, the other tests call tryAcquireKitLock, and the in-process poll cases go; syncDispatch.ts (its poll comment) and DESIGN.md line 148 stop naming it in step store.
  • 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 an Effect.acquireUseRelease (creation in the acquire, rmSync in the release, whose failure fails the bootstrap with BunInstallFolderFailed, as the base finally did), and bunBootstrap claims the Deferred and completes it with the run's Exit in Effect.uninterruptibleMask with the run restored; other callers wait interruptibly.
  • Plan scratch caller (delegated, one line): PlanFiles.layer becomes a Layer.effect over FileSystem, and scratchFolder yields createScratchDir, mapping its failures to the same FileError; the other fileOperation adapters stay.
  • Bridges (delegated, one line): bridge.ts and its test go with the last caller; LegacyStepFailed leaves EngineFailure; commands/tidy.ts drops its Effect.uninterruptible and bridge; each remaining Effect.try wraps a node: module (child_process, fs where noted, sqlite), a kitLock.ts primitive, process.kill, JSON.parse, a Bun API, or a package.
  • Failure model (delegated, one line): replaceFile stays atomic (a crash can leave a temporary file that the next write removes); tidy.log rotation and append are one region inside the apply lock (a crash between them leaves only tidy.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.md requires 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 a CHANGELOG.md entry in user terms, builds the talk bundle before the payload, then runs golden:mutation --update-goldens and bun fmt on mutation.json, each build and golden run as bun --no-env-file with DOCKS_KIT_TEST_CLI_ENTRY and GOLDEN_FILTER unset, with no .env* file on disk in the launch folder (a find whose exit status is checked before its output, since the golden CLI children load dotenv); goldens-version derives the expected file from origin/main with 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 IMMEDIATE semantics, 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 the mutation.json of step 6, which must equal the file that goldens-version derives from origin/main.
  • The synchronous primitives of kitLock.ts (tryAcquireKitLock, releaseKitLock, preparePrivateLockDirectory) and its node:-only imports; the poll of syncDispatch.ts scopedKitLock.
  • cli/src/plan/ apart from the createScratchDir call in cli/src/plan/services.ts; baseBlobSync stays.
  • cli/src/skills/kitGate.ts: its which call and its own spawnSync stay.

Open questions

Verification Results

Activity

  1. self-assigned this
    on Dec 1, 2026
  2. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Delegation grant: yolo: "now start #290 please, use yolo, also fix open findings in a follow up"
    Parent event: 7326116204

  3. changed the title [-]Move the process layer and the toolchain to Effect[/-] [+]Move the process layer, the file helpers, and the kit store to Effect[/+] on Dec 1, 2026
  4. added a commit that references this issue on Dec 2, 2026
  5. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 1

    Plan-review: repair

    • goal_fit - Research, Process service, Durability; Acceptance unit-process and signal-order - Cleanup is conditioned on the direct child still running, but Node documents that a child can emit exit before close while 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 for exit after 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 shutdown
    • research_gap - Research, Process service, Durability; Signals, Failure modes; Acceptance signal-order - The POSIX kill specification says a zombie still counts as a process. Inference: after the wrapper exits and its writer is killed, an orphaned zombie can keep kill(-pgid, 0) from returning ESRCH long after no member can write. The unbounded post-SIGKILL poll 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 execution
    • goal_fit - Research, Process service, Durability and Callers; Step process - cli/src/commands/update.ts:37,273,322 starts a fresh CLI for chained sync. Under the proposed all-detached policy, that CLI starts its own detached omp group. 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 group
    • research_gap - Research, Process service, Pre-mortem and Callers; Step process - cli/src/commands/update.ts:230 runs git pull --ff-only. Git's credential documentation and terminal implementation show that it can prompt on /dev/tty even with stdin ignored. POSIX setsid removes 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 stdin
    • security_risk - Research, Process service, Windows release and timeout; Acceptance windows - Microsoft documents that taskkill /PID /T targets 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 in cli/src/engine-native/exec.ts:235-245 already 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 existing windows row assert that outcome - class: destructive tree cleanup relies on an unverified PID
    • goal_fit - Research, Process service, Refusal and Callers; parent Move the engine-native layer to Effect #290 D2 - With a Windows git.cmd and a checkout path containing %, cli/src/commands/sync.ts:17-25 passes the path to the encoder in os/windows.ts:45-81. The existing spawnHost prints the refusal and exits 2 in exec.ts:46-51; the nudge's catch cannot swallow process.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's HostArgumentRefused to the existing diagnostic and exit 2, while keeping ordinary nudge failures best-effort - class: typed refusal loses its caller-specific exit behavior
    • goal_fit - Research, Bun bootstrap; Step process; parent Move the engine-native layer to Effect #290 D2 - The Move the toolchain passes to Effect #298 candidate calls services.deps.version("bun") after removing the installer folder in cli/src/engine-native/bun.ts:189-216. Its Bun reader starts an unbounded capture in deps.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 mask
    • goal_fit - Research, Signals, Durability; Step signals; Acceptance unit-signals and signal-order - Effect 4.1.7 Runtime.ts:183-196 returns 130 only for an interrupt-only cause. cli/test/lib/signalEngineEntry.ts:59-74 deliberately adds a failing finalizer, and cli/test/unit/syncSignals.test.ts:685-713 expects 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 success
    • goal_fit - Research, Logger, Durability and Pre-mortem; Acceptance logger - Making settle the last Effect does not mean the last stream write has finished. Node's Writable.write contract allows a write error to arrive asynchronously. Inference: the final summary write can fail after settle has already returned success, leaving no run to receive the recorded LoggerWriteFailed - Make settle wait 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 failure
    • research_gap - Research, Kit store; Step store - Effect 4.1.7 Effect.ts:14259-14264 requires an infallible acquireRelease finalizer. DatabaseSync.close() can throw, and cli/src/engine-native/kitDb.ts:119-135 currently runs it before returning the cache result. A typed KitDbFailed from 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 of acquireUseRelease for the handle bracket and preserve the cache recovery behavior - class: fallible cleanup assigned to an infallible Effect finalizer
    • goal_fit - Steps process/signals and guidance, Files; Acceptance guidance - The spawned public-engine fixture manually supplies its layers in cli/test/lib/signalEngineEntry.ts:65-76, so it will not inherit HostProcess from engineServicesLayer. 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 in guidance - class: affected path missing from a Files cell
    • goal_fit - Steps store and logger; Acceptance gone - cli/src/engine-native/syncDispatch.ts:100 still names acquireKitLock in the poll comment. The gone scan includes comments, so deleting the implementation and porting the tests still leaves a match; the logger step's partial gone criterion 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 red
    • goal_fit - Acceptance unit-process, commands, and gate - The named update tests currently call updateCheckout with 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 in cli/src/plan/checkout.ts:219-227 is reached by plan checkout-state on a non-UTF-8 folder; neither the scratch CLI round trip nor scratch-caller exercises it. The generic gate does run existing spawned coverage but names neither result - Name the existing spawned checks in cli/test/unit/commandsReporting.test.ts:194-213 and cli/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 check
    • goal_fit - Acceptance tidy-signal; Research, Signals, Pre-mortem - writeWaitingRunner in cli/test/unit/tidy.test.ts:1196-1202 writes the exit record from inside the stub's exit callback, before the OS has exited the process or its parent has reaped it. A CLI that sends SIGTERM but 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 reaping
    • goal_fit - Acceptance red, including its reference to commands - cli/src/commands/scratch.ts:27-58 already 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 by plan-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 check
    • goal_fit - Research, Version; Acceptance goldens; parent Move the engine-native layer to Effect #290 goldens - The Git diff pipeline inspects only two files and drops all non-indented change lines. For example, changing the tracked mode of mutation.json leaves 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 compare mutation.json with 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 changes
  6. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 2, delta

    Plan-review: repair

    • research_gap - Research, Process service, Durability; Signals, Failure modes; Acceptance unit-process and signal-order - The two-second poll removes the unbounded zombie wait, but it does not establish that a surviving group member is a zombie. POSIX kill reports 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 execution
    • goal_fit - Research, Process service, Durability and Callers; Step process; 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-95 honors DOCKS_KIT_HOME, and cli/src/commands/update.ts:271-273,321-322 runs the selected checkout or installed package. Inference: if the selected checkout is on an older branch, the new updater sends SIGTERM only to that CLI; its old signalGuard.ts:44-58 exits immediately, and its unbounded omp child is not tracked by exec.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 group
    • security_risk - Research, Process service, Windows release and timeout; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 and ownership table - A recorded exit guard is not an identity guarantee across the helper launch. Microsoft documents that taskkill /PID /T selects 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 PID
    • goal_fit - Research, Process service, Durability and Callers; Step process; Do not touch - spawnHost uses Bun's synchronous capture, which defaults to a 1 MiB limit and reports ENOBUFS on overflow. The replacement retains the unbounded async capture contract. For example, git status --porcelain over the limit currently takes the git status failed branch in cli/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 cutover
    • goal_fit - Research, Logger, Durability; Step logger; Acceptance logger and unit-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-335 can submit the final ledger write while propagating a pipeline failure, so a delayed write error can miss settle. The terminal lease also writes during release (cli/src/engine-native/logger.ts:223-252), where Effect 4.1.7's acquireRelease cannot 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 exit
    • goal_fit - Steps store, logger, signals, and guidance; Acceptance gone - The poll comment is now covered, but cli/src/engine-native/DESIGN.md:148 still names acquireKitLock. The scan includes that file, and its edit is scheduled in guidance, after both logger and signals require the scan to pass. The signal-name exception in logger does not cover it - Move the obsolete reference removal to store, or put the complete gone checkpoint after guidance and limit the earlier checkpoints to their own removals - class: obsolete reference keeps the removal check red
    • goal_fit - Research, Version; Acceptance goldens; parent Move the engine-native layer to Effect #290 goldens - 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.json were added beside tree in a case: the replacer removes it and cli/test/golden-mutation.ts:374-381 does not read it. The exception authorizes only digest value changes inside cases.<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 changes

    Previous findings:

    • Round-1 finding on Process service Durability and unit-process/signal-order: resolved - The plan records terminal events from spawn and drives POSIX cleanup independently of the leader.
    • Round-1 finding on Process service Durability, Signals Failure modes, and signal-order: open - repeated above
    • Round-1 finding on Process service Durability and Callers, Step process: open - repeated above
    • Round-1 finding on Process service Pre-mortem and Callers, Step process: resolved - Shared POSIX children keep their controlling terminal, as the parent D2 amendment permits.
    • Round-1 finding on Windows release and timeout and windows: open - repeated above
    • Round-1 finding on Process service Refusal and Callers and parent D2: resolved - updateNudge now maps the refusal to the existing diagnostic and exit 2.
    • Round-1 finding on Bun bootstrap, Step process, and parent D2: resolved - The version probe and installers run interruptibly; only folder ownership and outcome publication stay protected.
    • Round-1 finding on Signals Durability, Step signals, and unit-signals/signal-order: resolved - The public teardown uses the recorded signal code independently of the final fiber cause.
    • Round-1 finding on Logger Durability and Pre-mortem and logger: resolved - The last-write race on a successful run is covered by waiting for write callbacks; other exit paths are reported above.
    • Round-1 finding on Kit store and Step store: resolved - withKitDb now uses acquireUseRelease and retains typed cache recovery.
    • Round-1 finding on Files for process/signals and guidance: resolved - The signal fixture is listed in both owning steps, and the toolchain skill is listed in guidance and its scan.
    • Round-1 finding on Steps store and logger and gone: open - repeated above
    • Round-1 finding on end-to-end coverage in unit-process, commands, and gate: resolved - update-cli and plan-scratch name the spawned scenarios and their observable results.
    • Round-1 finding on tidy-signal and 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.
    • Round-1 finding on red and its reference to commands: resolved - The row uses pre-implementation failing specs and excludes parity checks.
    • Round-1 finding on Version and the child and parent goldens rows: open - repeated above

    Manager response to round 1

    Repaired:

    • Direct-child exit conflated with tree shutdown (Redesigned): run records the state of the direct child from its spawn, error, and exit events when it spawns. The release of an "own" child works on the process group, whatever state the leader is in: it is done at ESRCH; otherwise it sends SIGTERM, waits out the grace period, sends SIGKILL, and then waits for the recorded exit. The reviewer is right: on b3b277fd, exec.ts spawnProcess only listens for close, and Node can emit exit before close. A new unit-process case covers a leader that exited before the interrupt while its grandchild holds the pipes.
    • Zombie counted as a live member (Redesigned): after SIGKILL, the poll is bounded by PROCESS_KILL_WAIT_MS (2000 ms). A member that is still visible after SIGKILL runs no code, because POSIX kill counts a zombie as a process. The plan now states the bound: a stop ends within 5 s plus the reap, inside the 10 s EXIT_BOUND_MS of the signal cases. unit-process asserts this bound.
    • Nested CLI of the chained sync escapes the supervised group (Redesigned): the children of update and of the nudge are "shared" children. They are not detached, so no group handoff is needed. On an interrupt the release sends SIGTERM to the direct child only and waits for its exit with no kill, as spawnSync waited before. The inner CLI therefore stops its own omp groups before the outer CLI sees its exit. This deviates from parent D2, and the Callers line of the decision records the deviation.
    • Terminal access inferred from stdin (Redesigned): the same "shared" design keeps the CLI's session and controlling terminal for git pull, the package managers, and the nudge fetch. Node's detached starts 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.
    • Windows tree cleanup relies on an unverified PID (Repaired): the release runs the absolute taskkill.exe /T /F only while the recorded state shows the direct child has not exited. This is the existing guard of killProcessTree (exec.ts lines 235-245). After taskkill, the release kills the direct child if it still runs. If taskkill fails, 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. The windows row now asserts the timeout tree case and a case where taskkill.exe is missing.
    • Typed refusal loses its exit 2 in the nudge (Repaired): updateNudge turns HostArgumentRefused into bail(message, 2), as spawnHost did. It keeps ignoring every other failure. unit-process checks this.
    • Live process call left inside the Bun mask (Redesigned): on the Move the toolchain passes to Effect #298 candidate c41d9d7d, bun.ts masks all of runBunBootstrap, deps.version("bun") included, and deps.ts captureOf has no time limit. The bootstrap now runs interruptibly. Only two things stay protected: the temporary folder, through acquireUseRelease (the removal is in its release), and the publication of the shared outcome, through uninterruptibleMask with the run restored. unit-process adds a waiting bun --version probe to the interrupt case.
    • Signal exit code depends on cleanup success (Repaired): reproduced against Runtime.ts defaultTeardown (130 only for an interrupt-only cause), signalEngineEntry.ts (the failing finalizer), and the syncSignals.test.ts case that expects 130. A new recordSignal(codes) records the first signal. main.ts and signalEngineEntry.ts give runMain a teardown that exits with the recorded code after every finalizer has run. unit-signals names the finalizer case.
    • settle races an asynchronous write failure (Repaired): each stream write passes a callback and counts as pending until the callback runs. settle waits until no write is pending, then fails with the first recorded error. unit-logger adds a case where the callback reports the error after the last write was submitted.
    • Fallible close in an infallible finalizer (Repaired): reproduced at Effect.ts line 14260, where the acquireRelease release type has never as its error. withKitDb now uses acquireUseRelease, whose release can fail, so a failed close stays a typed KitDbFailed. readCache and writeCache turn it into a miss or a no-op.
    • Affected paths missing from Files cells (Repaired): cli/test/lib/signalEngineEntry.ts is now in the Files of step process (its layers) and of step signals (its teardown). .agents/skills/toolchain-context/SKILL.md is in step guidance and in the first grep of the guidance row.
    • Obsolete acquireKitLock comment (Repaired): reproduced at syncDispatch.ts line 100. syncDispatch.ts is now in the Files of step store, and the Kit lock decision has that step update the comment without changing the three poll policies.
    • Changed CLI paths lack a named end-to-end check (Repaired): new rows update-cli (the spawned update --no-sync case of commandsReporting.test.ts) and plan-scratch (the non-UTF-8 case of plan/checkout-state.test.ts, which reaches PlanFiles.scratchFolder). The update refusal case now names its in-process HostProcess layer.
    • Shutdown marker does not prove reaping (Repaired): the tidy-signal row now holds the stub at a test barrier after it acknowledges SIGTERM, checks that the CLI is still alive while the stub waits, and asserts ESRCH for the stub's pid when the CLI's close event comes.
    • Red evidence demanded from parity checks (Repaired): the red row now follows the practices.md Red baseline. Spec cases are staged before the production code of each step that adds behavior (process, logger, signals), and Verification Results hold the Red baseline, step <id>: lines. Parity cases are outside the row.
    • Golden exception silently allows unrelated changes (Repaired, also the parent Move the engine-native layer to Effect #290 edit round 2 finding): the goldens row now runs git diff --exit-code over the whole cli/test/goldens folder except mutation.json, with --exit-code before --. It then compares the mutation.json modes, and compares the JSON of mutation.json with only the two digest keys removed from both sides. Each step is chained with &&, so a failed git operation fails the row. I checked the comparison: it exits 0 for release ecd6fefe and exits 1 for 47612aa5, which changed other entries.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  7. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 3, delta

    Plan-review: repair

    • security_risk - Research, Process service, Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 - The new service extends PID-based taskkill from bounded probes to every Windows child. The inherited guard in cli/src/engine-native/exec.ts:214-245 checks 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 and taskkill /PID /T targets a numeric PID. Inference: an interrupted, formerly unbounded omp wrapper 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 PID
    • goal_fit - Research, Process service, Durability and Callers; Acceptance windows; 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 says updateNudge ignores every typed failure except refusal and that Windows timeouts keep their old behavior. On a Windows git fetch timeout with no working taskkill.exe, either instruction can hide the cleanup failure. The public command then proceeds to engine(args) as it does after an ordinary nudge miss at cli/src/commands/sync.ts:59-67 - Distinguish an ordinary probe timeout from ProcessStopFailed and carry the cleanup diagnostic through the nudge without changing ordinary nudge failures or the recorded signal exit code - class: cleanup failure discarded by probe fallback
    • goal_fit - Research, Process service, Durability; Acceptance unit-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 successful git status with 600 KiB on each pipe takes the dirty-checkout branch today, but an aggregate cap takes the git status failed branch 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 cutover
    • goal_fit - Research, Logger, Durability; Signals, Durability; Acceptance unit-logger - Skipping settle on an interrupt-only exit does not protect the terminal bracket. Effect 4.1.7 makes acquireUseRelease acquisition 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 shutdown
    • goal_fit - Research, Process service, Durability; Acceptance unit-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); resolveVersion relies on that bound (cli/src/engine-native/deps.ts:215-236). Inference: if a version probe remains blocked in kernel I/O after SIGKILL, 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 wait

    Previous findings:

    • Round-2 finding on Process service Durability, Signals Failure modes, and unit-process/signal-order: resolved - The interrupt path no longer assumes a surviving member is a zombie. It holds the locks until ESRCH and drops the fixed shutdown bound.
    • Round-2 finding on Process service Durability and Callers, Step 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.
    • Round-2 finding on Windows release and timeout, windows, and parent Move the engine-native layer to Effect #290 D2: open - repeated above
    • Round-2 finding on Process service Durability and Callers, Step process, and Do not touch: open - repeated above
    • Round-2 finding on Logger Durability, Step logger, and logger/unit-logger: open - Ordinary failure settlement and typed erase failures are covered; the blocked-sink shutdown case is repeated above.
    • Round-2 finding on Steps store, logger, signals, and guidance, and Acceptance gone: resolved - store now owns removal of both the DESIGN.md and syncDispatch.ts references to acquireKitLock.
    • Round-2 finding on Version and the child and parent goldens rows: 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 beside tree fails.

    Manager response to round 2

    Repaired:

    • Surviving group member is not proven to be a zombie (Redesigned): the 2000 ms cap after SIGKILL is gone. The release keeps the locks and polls kill(-pgid, 0) until ESRCH, with no deadline. Three facts make the group empty: SIGKILL cannot be caught, uninterruptible sleep ends when its I/O ends, and POSIX _exit gives 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.
    • Updater cannot control the version that it chains (Repaired, a known limit equal to the base): the Callers line limits the guarantee to chained CLIs that implement Move the process layer, the file helpers, and the kit store to Effect #297. A chained entry older than Move the process layer, the file helpers, and the kit store to Effect #297 (an older checkout or package, reached through update.ts packageBinEntry or DOCKS_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 untracked omp child of that older CLI can outlive it. That is what the base spawnSync call in chainSync (update.ts line 37) did too: it waited only for the direct child. The parent D2 amendment text in plan-290-d2.txt says the same.
    • Windows PID identity across the helper launch (Repaired, the base guard kept): the release runs taskkill.exe under the unchanged exit guard of killProcessTree (exec.ts lines 235-245), as the base does today, and keeps the tree-first order. A missing or failing taskkill.exe is now a typed ProcessStopFailed (command, reason) that the run reports as a cleanup failure, not a finished stop. The windows row asserts that report for a SystemRoot without taskkill.exe. The window between the guard and the helper is the same one the base killProcessTree has.
    • Synchronous capture limit lost in the async cutover (Repaired): I reproduced it with Bun 1.4.5: spawnSync of a child that writes 2 MB of output gives ENOBUFS, status null, and 1114112 bytes of output. ProcessOptions.maxOutputBytes stops the child past the limit and returns the output so far with an ENOBUFS error. The former spawnHost callers that pipe output (update.ts and the nudge) pass SPAWN_SYNC_MAX_OUTPUT (1 MiB), so git status over the limit still takes the git status failed branch. unit-process asserts it.
    • Failure exits and the terminal lease release (Repaired): runEngineNative runs settle after 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 throwing finally did. The lease becomes withTerminal(message, use), an acquireUseRelease whose release (the progress erase) fails with LoggerWriteFailed. syncDispatch.ts runPipeline uses it and prints the ledger of a failed pipeline through Effect.catchCause. unit-logger covers both cases.
    • DESIGN.md still names acquireKitLock when the gone rows run (Repaired): cli/src/engine-native/DESIGN.md is now in the Files of step store, and the Kit lock decision has that step remove line 148. Step guidance keeps its other DESIGN.md edits. So gone passes at the logger and signals checkpoints.
    • JSON replacer drops the key names at every depth (Repaired, also parent Move the engine-native layer to Effect #290 round 3, finding 1): the goldens script now takes each digest value only at cases.<case>.tree[".docks-kit/omp-plugin/package.json"] and tree[".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: release ecd6fefe against its parent exits 0; 47612aa5 (other entries changed) exits 1; a test commit in a throwaway ovnfs checkout that adds the key beside tree exits 1. I discarded that checkout afterwards.
    • Parent Move the engine-native layer to Effect #290 round 3, finding 2 (shared-group rule not limited to POSIX) (Repaired in plan-290-d2.txt and 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, the npm.cmd shim of update included, keeps the tree-first taskkill /T /F stop.
    • Parent Move the engine-native layer to Effect #290 round 3, finding 3 (guarantee assumes the chained version) (Repaired): see the second bullet. The guarantee covers chained CLIs that implement Move the process layer, the file helpers, and the kit store to Effect #297, and an older chained entry behaves as before Move the process layer, the file helpers, and the kit store to Effect #297. Both plans now state this.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  8. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 4, delta

    Plan-review: repair

    • security_risk - Research, Process service and Windows tree stop, Durability; Acceptance 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), and spawnOmp supplies 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 unbounded omp wrapper can now make taskkill /PID /T terminate 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 PID
    • goal_fit - Research, Process callers, Process service Durability, and Windows tree stop Durability; Acceptance unit-process and windows - 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-second git fetch in cli/src/commands/sync.ts:19-22 reaches that contradiction if it ignores SIGTERM. The Windows deadline has a separate wait: the plan requires the result of taskkill.exe before choosing timedOut or ProcessStopFailed, 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 wait
    • goal_fit - Research, Version; Steps, deleted release row; Acceptance goldens; Do not touch; parent Move the engine-native layer to Effect #290 goldens - AGENTS.md:52-53 requires 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 bump

    Previous findings:

    • Round-3 finding on Research, Process service, Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2: open - repeated above
    • Round-3 finding on Research, Process service, Durability and Callers; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 amendment: resolved - A failed Windows timeout cleanup returns ProcessStopFailed, and the nudge warns before continuing instead of treating it as an ordinary timeout.
    • Round-3 finding on Research, Process service, Durability; Acceptance unit-process: resolved - The plan sets a per-pipe cap and checks that 600 KiB on each pipe takes the dirty-checkout branch.
    • Round-3 finding on Research, Logger, Durability; Signals, Durability; Acceptance unit-logger: resolved - Lease draw, erase, and exclusive flush submit writes without waiting for callbacks. Ordinary settlement waits interruptibly.
    • Round-3 finding on Research, Process service, Durability; Acceptance unit-process: open - repeated above

    Manager response to round 3

    Repaired:

    • Windows PID-based tree stop claims more ownership than the guard gives (Redesigned): a new decision, "Windows tree stop", has a full deliberation record. It keeps option (a): run taskkill.exe /T /F by PID only while the recorded state shows the direct child running (the unchanged exit guard of exec.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; taskkill with 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).
    • Nudge hides ProcessStopFailed (Repaired): in updateNudge, an ordinary failure or a probe timeout stays a silent nudge miss, and a refusal exits 2. A ProcessStopFailed is printed with logger.warn as its diagnostic, and then sync proceeds. A recorded signal keeps its exit code. A failed taskkill.exe on a timeout now gives ProcessStopFailed instead of timedOut, so the nudge sees it. unit-process covers the printed diagnostic.
    • Aggregate capture cap (Repaired): I reproduced it with Bun 1.4.5. spawnSync gives no error for 600 KiB on each pipe, and ENOBUFS with no status for 2 MB on one pipe. maxOutputBytes is now a budget for each captured pipe. The unit-process check asserts 1.1 MiB on stdout gives ENOBUFS and the git status failed branch, and 600 KiB on each pipe gives the dirty-checkout branch.
    • Callback waits inside uninterruptible logger regions (Repaired): only settle waits for write callbacks. It waits interruptibly, and runEngineNative runs 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-logger covers a signal while the lease draws on a stalled sink.
    • Probe timeout reaches the deadline-free group poll (Repaired): a timeout keeps the base completion rule on every host (exec.ts lines 185-200). It ends the tree once, destroys the pipe ends, unrefs the child, and resolves timedOut at the deadline, with no wait for the exit and no group poll. Only an interrupt uses the group poll. unit-process covers a probe whose child ignores its pipes and does not exit.
    • Release (Redesigned, by direction of Main): Move the process layer, the file helpers, and the kit store to Effect #297 makes no version bump, no CHANGELOG entry, no payload change, and no golden change. Step 6 is deleted, and so are the golden exception and its script. The goldens row 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.

  9. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 5, delta

    Plan-review: repair

    • security_risk - Research, Process service Durability and Callers; Windows stop Options, Evidence, and Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 - The repair removes PID-based termination on interrupt, but still calls taskkill /T for every Windows timeout. That newly includes the four-second update-nudge fetch, which currently uses spawnHost → spawnSync and never enters killProcessTree (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 before taskkill resolves it, the new path can terminate an unrelated process - Keep the nudge timeout handle-only. Limit PID-based tree cleanup to the existing spawnProcess probe path without weakening its ownership guard, and make windows distinguish the two timeout paths - class: destructive tree cleanup relies on an unverified PID
    • research_gap - Research, Process service Durability and Callers; Acceptance unit-process - The new shared POSIX timeout rule claims parity with spawnSync, but Bun 1.4.5 preserves the child's exit code after the deadline and sets ETIMEDOUT separately. If a Git wrapper handles SIGTERM and exits 0, the existing nudge checks only .status and still runs rev-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, and unit-process - class: timeout parity drops the child's exit status
    • goal_fit - Research, Version; Acceptance goldens and goldens-version; Do not touch; parent Move the engine-native layer to Effect #290 goldens - The new proof replaces the candidate's mutation.json before checking it, while goldens exempts that entire file from the diff. For example, an unrelated change to a committed case's command field passes both rows: compareCase ignores 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 snapshot

    Previous findings:

    • Round-4 finding on Research, Process service and Windows tree stop, Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2: open - repeated above
    • Round-4 finding on Research, Process callers, Process service Durability, and Windows tree stop Durability; Acceptance unit-process and windows: 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.
    • Round-4 finding on Research, Version; Steps, deleted release row; Acceptance goldens; Do not touch; parent Move the engine-native layer to Effect #290 goldens: 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 taskkill extended 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 /F runs only at the timeout of a bounded child, under the unchanged exit guard of exec.ts killProcessTree (lines 235-245), as the base does. That helper run is bounded to TASKKILL_WAIT_MS (5000 ms): a missing helper, a failing one, or one that runs past the bound gives ProcessStopFailed. The descendants of an interrupted Windows child can survive. That is a known limit equal to the base, which never stops them: spawnOmp and chainSync pass 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. The windows row checks three cases: an interrupt ends only the direct child and no taskkill.exe runs (a recording SystemRoot), the bounded tree timeout ends the child and its grandchild, and a missing or slow helper gives ProcessStopFailed.

    • Contradictory timeout rules and an unbounded Windows helper (Repaired): there is now one rule per path, in the Process service Durability.

      • A POSIX "own" bounded probe keeps the base rule: SIGKILL to the group once, destroy the pipe ends, unref, and resolve timedOut at the deadline, with no wait for the exit.
      • A POSIX "shared" child with a timeout (the 4 s nudge fetch) works as spawnSync with timeout: SIGTERM to the direct child, then a wait for its exit, then timedOut, which the nudge treats as a miss.
      • A Windows bounded child gets the base taskkill, bounded to 5000 ms.
      • Only an interrupt uses the group poll.

      unit-process checks the POSIX paths and windows checks the Windows ones.

    • Version bump missing for a user-visible change (Redesigned, by direction of Main): step 6 release is back. It bumps package.json to the next patch version after main's, adds a CHANGELOG.md entry 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 runs bun run golden:mutation --update-goldens. The digest filter is gone. The goldens row checks that no golden file other than mutation.json changed, was added, or was removed. The new goldens-version row unpacks the reviewed commit into a scratch folder (git archive, docks-kit scratch new and scratch remove), restores the goldens of origin/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 on b3b277fd with 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.

  10. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 6, delta

    Plan-review: repair

    • security_risk - Research, Windows stop Options and Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 - The nudge is now handle-only, but the remaining captureWithin path does not preserve the base ownership guard. The base checks the child and calls spawnSync without 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 before taskkill resolves 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 PID
    • research_gap - Research, Process service Durability and Callers; Acceptance unit-process - Durability and unit-process now say that a timed-out fetch that exits 0 reaches rev-list, but Callers still says that a timeout is a silent miss. The base checks only .status, so that fetch reaches rev-list and can print the update warning (cli/src/commands/sync.ts:19-32; Bun's exit status and timeout error are separate) - Make Callers explicit that timedOut alone does not skip rev-list; preserve the exit-status check already specified by Durability and unit-process - class: timeout parity drops the child's exit status
    • research_gap - Research, Windows stop Options and Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - Both decisions name capture in the base-bounded exception, and the child gives it a fallback for a failed taskkill. Only captureWithin supplies a timeout (cli/src/engine-native/exec.ts:256-281); the Bun and omp version readers deliberately use unbounded capture (cli/src/engine-native/deps.ts:184-205). A slow omp --version should still be allowed to finish. Applying the listed exception to capture would add a deadline and PID-based termination where neither existed - Name captureWithin as the only existing timed probe and distinguish its helper-failure mapping from interruption of unbounded capture - class: unbounded probe listed as a bounded cleanup caller

    Previous findings:

    • Round-5 finding on Research, Process service Durability and Callers; Windows stop Options, Evidence, and Durability; Acceptance 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.
    • Round-5 finding on Research, Process service Durability and Callers; Acceptance unit-process: open - repeated above
    • Round-5 finding on Research, Version; Acceptance goldens and goldens-version; Do not touch; parent Move the engine-native layer to Effect #290 goldens: resolved - goldens-version regenerates the snapshot from origin/main with the candidate's version and byte-compares it with HEAD:cli/test/goldens/mutation.json. goldens still rejects changes to any other golden file.

    Manager response to round 5

    Repaired:

    • PID-based taskkill reaches the nudge fetch (Redesigned, the "Windows stop" decision): taskkill.exe /T /F now runs only for the probes that the base bounded: capture and captureWithin with a timeout, which base spawnProcess and trackBoundedChild covered. It runs at their timeout, under the unchanged exit guard of killProcessTree, bounded to 5000 ms. The former spawnHost callers (the nudge fetch and the update children), 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 the trackBoundedChild exit 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. The windows row checks three cases with a recording taskkill.exe: a captureWithin timeout runs it, while an interrupt and a shared timeout do not run it.
    • Shared POSIX timeout loses the exit status (Repaired): the 4 s nudge fetch keeps spawnSync parity. The service sends SIGTERM to the direct child, waits for its exit, and gives the child's exit code with timedOut: true. The nudge keeps its .status check, so exit 0 goes on to rev-list. unit-process asserts this with a wrapper that handles SIGTERM and exits 0.
    • Version proof never inspects the candidate file (Redesigned): goldens-version now unpacks origin/main into a docks-kit scratch new folder and sets only its package.json version to the candidate's. It regenerates the payload and the talk bundle, runs bun run golden:mutation --update-goldens, and formats the file with bun fmt, because the golden writer does not match bun fmt output. It then compares the produced mutation.json with the candidate's committed file using cmp; exit 0 is required. The folder is removed with docks-kit scratch remove. I checked the procedure on origin/main: with its own version it reproduces its file byte for byte, and a version bump changes only the two plugin digest lines. The goldens row still requires that no other golden file changed, and step 6 now formats the updated file too.
    • Best-effort probe mapping (from parent round 6, Repaired): a ProcessStopFailed at a probe boundary maps back to the base outcome. captureWithin gives timed-out, so toolchain check still prints unknown, and capture gives an empty output. The nudge warns as decided. The windows row checks both outcomes.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  11. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 7, delta

    Plan-review: repair

    • goal_fit - Acceptance unit-process and windows; Research, Windows stop Durability - unit-process keeps every base case, but cli/test/unit/exec.test.ts:148–200 requires 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 behavior
    • goal_fit - Research, Windows stop Options and Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - A failed handle kill does not establish that the process exited (Microsoft TerminateProcess). If termination fails while the direct child is still stalled, the plan requires waiting for its exit before returning, so toolchain check can hang instead of printing unknown, 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 existing windows row without restoring PID-based termination or claiming the child was reaped - class: failed termination has no bounded outcome
    • goal_fit - Acceptance windows, recording taskkill.exe stub - The old code calls %SystemRoot%\System32\taskkill.exe by absolute path (cli/src/engine-native/exec.ts:235–245). A stub on PATH and directly in the fake SystemRoot misses 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 at System32\taskkill.exe under the fake SystemRoot, as well as on PATH - class: regression check misses the retired executable path
    • goal_fit - Research, Version; Step release; Acceptance goldens; parent Move the engine-native layer to Effect #290 Acceptance goldens - env -u removes inherited variables, but Bun loads .env files by default. An ignored checkout .env can leave Git status clean and restore GOLDEN_FILTER=sync, skipping the toolchain check golden (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 clear

    Previous findings:

    • Round-6 finding on Research, Windows stop Options and Durability; Acceptance 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.
    • Round-6 finding on Research, Process service Durability and Callers; Acceptance unit-process: resolved - All three now agree that a timed-out POSIX fetch that exits 0 reaches rev-list.
    • Round-6 finding on Research, Windows stop Options and Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - Both plans name captureWithin as the only timed probe and leave capture unbounded.

    Manager response to round 6

    Repaired:

    • Async taskkill helper loses the process identity (Redesigned, the "Windows stop" decision): no taskkill.exe runs 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-effort taskkill /T through spawnSync for captureWithin timeouts and in the trackBoundedChild exit 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. ProcessStopFailed now covers only a failed handle kill. The windows row checks with a recording taskkill.exe stub first on PATH and in SystemRoot: no case runs it, a captureWithin timeout reaps the direct child, and toolchain check prints unknown.
    • Callers says a timed-out fetch is a silent miss (Repaired): the Callers line now says the exit status decides, as in the base. A timed-out fetch that exits 0 still reaches rev-list, and timedOut alone skips nothing. This matches the Durability and unit-process.
    • capture listed as a timed probe (Repaired): captureWithin is named as the only timed probe, and capture stays unbounded (the bun and omp version readers in deps.ts). Only captureWithin maps ProcessStopFailed to timed-out, after the direct child is reaped or its handle reports it gone. The Research facts record this.
    • Golden proof order and environment (Repaired, from parent round 7): step 6, the Version decision, and goldens-version now build talk.js first, because it embeds the version, then generate the payload, because it embeds talk.js. Then they update the mutation golden, format it, and run cmp. Every golden suite in goldens and goldens-version runs with DOCKS_KIT_TEST_CLI_ENTRY and GOLDEN_FILTER unset (env -u).
    • Deployed-bytes exception (Repaired, from parent round 7): Do not touch again allows the version-derived deployed bytes of step 6 (the plugin manifest version stamp and the talk bundle), and mutation.json stays the only golden-file exception.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  12. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 8, delta

    Plan-review: repair

    • goal_fit - Acceptance 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 for exit or close. Microsoft documents that TerminateProcess can 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 for
    • goal_fit - Research, Windows stop Durability and Signals Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - Failing the child release does not keep the kit locks until process exit. cli/src/engine-native/syncDispatch.ts:178,266 and cli/src/commands/tidy.ts:118–134 register ordinary scope finalizers that release the locks as the failure unwinds. NodeRuntime.ts:62–68 calls 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. Report ProcessStopFailed without replacing the recorded signal exit code - class: lock released during unwind despite a process-exit guarantee
    • research_gap - Research, Windows stop Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - The confirmed-exit rule is described in terms of writers running under a kit lock, but toolchain ensure bun calls bunBootstrap without 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: runTidy runs 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 ownership
    • research_gap - Research, Windows stop Options and Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - The no-wait timeout preserves the base behavior of captureWithin, not the nudge. cli/src/commands/sync.ts:19–22 checks the status returned by spawnHost, which calls spawnSync (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 and git fetch stays 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 caller
    • goal_fit - Research, Version; Acceptance goldens and goldens-version; parent Move the engine-native layer to Effect #290 Acceptance goldens - --no-env-file protects the suite drivers, but cli/test/lib/goldenExecution.ts:40–43,188–199,233–239,267–271 launches fresh Bun CLI processes in the checkout without that flag. By Bun's default dotenv behavior, a locally ignored .env containing DRY_RUN=1 makes 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 clean origin/main archive 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 driver

    Previous findings:

    • Round-7 finding on Acceptance unit-process and windows, inherited tree assertion: resolved - unit-process now limits the grandchild assertion to POSIX. Windows checks the partial output and the direct child's exit, with the ordering defect noted above.
    • Round-7 finding on Research, Windows stop Options and Durability; Acceptance 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. captureWithin maps the failure to timed-out, and the nudge warns and proceeds.
    • Round-7 finding on Acceptance windows, recording taskkill.exe stub: resolved - The row now places the stub at <fake SystemRoot>\System32\taskkill.exe and first on PATH.
    • Round-7 finding on Research, Version; Step release; Acceptance goldens; parent Move the engine-native layer to Effect #290 Acceptance goldens: 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-process now keeps the tree assertion of the base timeout case of exec.test.ts on 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.

      • A best-effort probe (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 for exit or close. A failed kill of a live child gives ProcessStopFailed, which captureWithin maps to timed-out (so toolchain check prints unknown) and which the nudge prints before sync proceeds. That child can survive, a known limit.
      • The wait for a confirmed exit applies only on an interrupt of a writer child that runs under a kit lock (spawnOmp, the Bun installer, the tidy tool calls, the chained sync). There the service observes the direct child's exit apart from close, disposes of the pipes, and waits for that exit. A failed kill keeps the lock and fails the run with ProcessStopFailed; the CLI exits with that failure, and the process exit releases the lock, as on the base.

      The windows row covers both paths. Its base timeout case now uses a descendant that holds stdout.

    • Recording stub misses the retired path (Repaired): the windows row now puts the recording stub at <fake SystemRoot>\System32\taskkill.exe, the absolute path that the base killProcessTree used, and first on PATH.

    • Bun reloads the overrides from .env (Repaired): the goldens and goldens-version rows run every build and golden suite as bun --no-env-file <script>, calling the scripts directly instead of bun run, with DOCKS_KIT_TEST_CLI_ENTRY and GOLDEN_FILTER unset. The Version decision says the same for step 6, and the Research facts record that Bun loads .env by default.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  13. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 9, delta

    Plan-review: repair

    • security_risk - Acceptance goldens-version (line 127) - If the new dotenv guard fails, the shell skips D="$(docks-kit scratch new goldens-version)" but still runs docks-kit scratch remove "$D" after the semicolon. If D already names another user-owned temporary directory, cli/src/engine-native/scratch.ts:180–201 permits 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 create
    • goal_fit - Research, Version; step release; Acceptance goldens and goldens-version; parent Move the engine-native layer to Effect #290 Acceptance goldens - The new guard checks only ignored, untracked files. The repository's .gitignore does not ignore .env, goldens-version has no clean-status precondition, and Git documents that status.showUntrackedFiles=no can hide an untracked .env from the child goldens row's status check. Inference: an unignored .env with DRY_RUN=1 can 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 settings
    • goal_fit - Research, Windows stop Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - The revised no-wait path drops unref(). 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, public toolchain check can print unknown and 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 existing windows row 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 reference
    • research_gap - Research, Windows stop Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment - The operation list calls the nudge read-only and names only the chained sync among updater writers. The nudge's git fetch writes FETCH_HEAD and remote refs (cli/src/commands/sync.ts:19–22,59–60; Git fetch). The updater also runs git 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 for git fetch, separate from its interrupt policy and the read-only rev-list - class: mutating caller omitted from the Windows writer policy

    Previous findings:

    • Round-8 finding on Acceptance windows; Research, Windows stop Durability: resolved - The timeout result and partial output are asserted independently of the direct child's exit.
    • Round-8 finding on Research, Windows stop Durability and Signals Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - The child and parent now keep the writer's release pending until direct-child exit, even after a failed kill, so enclosing lock finalizers cannot run early.
    • Round-8 finding on Research, Windows stop Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - The stop policy now selects by operation and identifies the actual lock owners. Standalone Bun installation is covered even without a lock.
    • Round-8 finding on Research, Windows stop Options and Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - Both exports identify the nudge's deadline return as an intentional Windows change from spawnSync.
    • Round-8 finding on Research, Version; Acceptance goldens and goldens-version; parent Move the engine-native layer to Effect #290 Acceptance goldens: open - repeated above.

    Manager response to round 8

    Repaired:

    • Timeout assertion requires an exit that the timeout must not wait for (Repaired): the windows row now asserts the deadline result and the partial output on their own. It then observes the direct child's exit separately, while the descendant still holds stdout, and does not await close together with the result. TerminateProcess is recorded as asynchronous.
    • Lock released during unwind (Redesigned, the "Windows stop" decision states the policy once, by operation): a writer operation (spawnOmp, the Bun installer, the tidy apply tool calls, the chained sync CLI) waits for its direct child's exit with no deadline before its scope, and any lock scope above it, closes. A failed handle kill keeps waiting, so the lock finalizers of syncDispatch.ts and commands/tidy.ts cannot 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.
    • Stop policy relies on lock ownership (Redesigned): the confirmed-exit rule is now chosen by operation, and toolchain ensure bun is included through the Bun installer. The decision names which process holds each lock: the sync CLI holds the sync locks (for update, the chained CLI), tidy --apply holds the apply lock but not during its report, and the updater and toolchain ensure bun hold none. The default cleanup applies to every Windows child: a handle kill, disposal of the parent's pipe ends, and an exit observed apart from close. The read-only children (capture and captureWithin probes, tidy report reads, the nudge) resolve after that cleanup without waiting.
    • Nudge parity claim (Repaired): the nudge's deadline return on Windows is recorded as an intentional Windows change, because the base spawnSync waited for the direct process.
    • Dotenv isolation stops at the suite driver (Repaired): the goldens and goldens-version rows, 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 the git status --porcelain check. The baseline archive has no dotenv file by construction. --no-env-file and the unset overrides stay. The Research facts name DRY_RUN and the CLI children of goldenExecution.ts.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  14. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 10, delta

    Plan-review: repair

    • research_gap - Child Move the process layer, the file helpers, and the kit store to Effect #297 Research, Windows stop Durability (line 62); parent Move the engine-native layer to Effect #290 D2 (lines 62, 65) - The repair adds the updater's pull and installs, but applies the nudge git fetch no-wait exception on interrupt as well as at the four-second deadline. The fetch writes FETCH_HEAD and remote refs (cli/src/commands/sync.ts:19–22,59–60; Git fetch). The writer list also omits update's git 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 include git status in the writer list in both plans. Keep rev-list read-only - class: mutating caller omitted from the Windows writer policy
    • goal_fit - Child Move the process layer, the file helpers, and the kit store to Effect #297 Research, Version; step release; Acceptance goldens and both goldens-version guards; parent Move the engine-native layer to Effect #290 Acceptance goldens - test -z "$(find …)" checks stdout, not find's exit status. If directory enumeration fails before printing a match, test succeeds even under set -e -o pipefail, and verification proceeds without establishing that dotenv is absent. That also contradicts the goldens-version promise 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 scan

    Previous findings:

    • Round-9 finding on Acceptance goldens-version: resolved - Line 127 registers cleanup only after scratch new succeeds and assigns the new path.
    • Round-9 finding on Research, Version; step release; Acceptance goldens and goldens-version; parent Move the engine-native layer to Effect #290 Acceptance goldens: resolved - Both plans now check the filesystem independently of Git tracking and ignore settings. The separate scan-error defect is reported above.
    • Round-9 finding on Research, Windows stop Durability; Acceptance windows; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: resolved - Both plans require unref() on the no-wait paths, and the child windows row requires the public command to print unknown and exit while the failed-kill probe remains alive.
    • Round-9 finding on Research, Windows stop Durability; parent Move the engine-native layer to Effect #290 D2 Windows stop amendment: open - repeated above.

    Manager response to round 9

    Repaired:

    • Writer list per command (Repaired): the Windows stop decision now lists every writer that waits for a confirmed exit: spawnOmp, the Bun installer (also in toolchain ensure bun), the tidy apply tool calls, the chained sync CLI, and the update children git pull --ff-only, bun install --frozen-lockfile, and the global package install. The nudge git fetch writes refs, so it is named as the one delegated exception, with a deadline return. The nudge rev-list is read-only.
    • No-wait paths keep the CLI alive (Repaired): every Windows no-wait path (the read-only probes and the nudge) disposes of the pipes and calls 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. The windows row requires that a public toolchain check whose probe kill fails prints unknown and exits while the probe still lives.
    • Windows timeout test (Repaired): the base timeout case holds back the direct child's exit notification with a delayed fake while a descendant holds stdout. It asserts the deadline result and the partial output first, and only then observes exit.
    • Dotenv check on disk (Repaired): the goldens row, step 6, the Version decision, and goldens-version check each launch folder on disk with test -z "$(find . -maxdepth 1 -name '.env*' -print)", whatever Git tracks. goldens-version checks both the candidate checkout root and the unpacked baseline folder before regeneration.
    • goldens-version shell (Repaired): the row runs in a bash subshell with set -e -o pipefail. A failed guard ends it. The trap docks-kit scratch remove "$D" is registered only after docks-kit scratch new succeeded and assigned D inside the subshell, so it never removes an unset or inherited path. I ran the command on origin/main with its own version: exit 0, and the trap removed its folder.

    Rejected:

    None.

    Rejected: none.

    Redesigned: none.

  15. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 11, delta

    Plan-review: repair

    • goal_fit - Child Move the process layer, the file helpers, and the kit store to Effect #297 Research, Process service Callers (line 53) and Windows stop Durability (line 62); parent Move the engine-native layer to Effect #290 D2 (line 65) - The caller decision preserves the updater's argv, but the revised Windows policy treats git status as 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 surviving git status can still write the index - Make git -C <home> --no-optional-locks status --porcelain the explicit exception to argv preservation. Keep the other updater arguments, stdio, and working directory unchanged - class: safety requirement contradicts argv preservation

    Previous findings:

    Manager response to round 10

    Repaired:

    • Mutating caller omitted from the Windows writer policy (Repaired):
      • update's git status --porcelain now runs with --no-optional-locks, as tidy's git calls do (tidy.ts line 961), so it writes no index and stays a read-only child. update.ts is already in the Files of step process.
      • The nudge git fetch no-wait exception applies only at its 4 s deadline. On an interrupt the fetch follows the writer rule and waits for a confirmed exit. The windows row checks that an interrupted fetch is waited for.
      • rev-list stays read-only.
    • Reap promise in the Signals decision (Repaired): option (a) now says the service stops each child and reaps it, apart from the Windows no-wait children of the Windows stop decision. The windows failed-kill check requires toolchain check to exit 0 while the probe still lives.
    • Dotenv guard treats a failed scan as an empty scan (Repaired): every launch location now checks the scan's exit status before its output. The goldens row uses out="$(find . -maxdepth 1 -name '.env*' -print)" && test -z "$out". goldens-version uses out="$(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.

  16. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 12, delta

    Plan-review: pass

    None.

    Previous findings:

    Manager response to round 11

    Repaired:

    • Callers: the updater status check is the one exception to argv parity and becomes git -C <home> --no-optional-locks status --porcelain; the other updater arguments, stdio, and working directory stay.

    Rejected: none.

    Redesigned: none.

  17. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 1, lens correctness

    Code-review: pass

    Standards

    • [MEDIUM] Bug - cli/src/commands/sync.ts:26-32, cli/src/engine-native/exec.ts:282-291, cli/src/engine-native/exec.ts:304-306, cli/src/engine-native/exec.ts:326-331 - On Windows, interrupting docks-kit sync during the nudge's git fetch can let the CLI exit while Git still writes refs. The caller sets writer: false for the four-second deadline, but the interrupt path uses the same flag and skips waiting for exit too. 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 interruption
    • [MEDIUM] Bug - cli/src/engine-native/tidy.ts:1364-1367, cli/src/engine-native/tidy.ts:1482-1488 - If docker rm succeeds and SIGTERM arrives during the subsequent network cleanup, tidy --apply has 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-up
    • [LOW] Bug - cli/src/engine-native/logger.ts:214-218, cli/src/engine-native/logger.ts:349-355, cli/src/engine-native/syncDispatch.ts:290-302 - If an asynchronous stdout write fails during a sync while stderr still shows progress, the stored error makes lease.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 error
    • [LOW] Bug - cli/src/engine-native/logger.ts:143-145, cli/src/engine-native/logger.ts:160-164, cli/src/engine-native/logger.ts:205-211 - If stdout fails first and stderr fails before the next logger call or settle, 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 order
    • [LOW] Bug - cli/src/engine-native/kitDb.ts:150-157 - On POSIX, an interrupt can land after DatabaseSync creates kit.db but 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 repair
    • [LOW] Bug - cli/src/engine-native/kitDb.ts:80-91 - Unreached: if COMMIT fails without automatically rolling back, inTransaction returns 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 rollback
    • [LOW] Bug - cli/src/engine-native/bun.ts:139-149 - Unreached: an interrupt at a scheduler yield after ctx.bunRuntime is assigned but before the mask starts leaves the published Deferred incomplete. A later caller on the same context then waits indefinitely. ompSync and 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 guard
    • [LOW] Bug - cli/src/engine-native/logger.ts:167-170, cli/src/engine-native/logger.ts:291-304 - Unreached: if a stream throws synchronously while withExclusive erases progress, the acquire still opens the durable buffer before write() surfaces the error. No release runs, so later durable writes go into a buffer that nobody flushes. No production caller uses withExclusive; its fixtures cover flush failures, not this acquire failure. - Open the buffer only after the erase succeeds. - class: failed acquisition leaves buffered state
    • [LOW] Bug - cli/src/engine-native/logger.ts:391-404 - Unreached: if stdout is pending when settle starts, then stderr starts writing before stdout drains, settle can hang after both streams finish. The stdout callback sees stderr pending and returns, but stderr has no idle listener. runEngineNative settles after its producers finish, and the logger fixtures do not start a write on another stream during settle. - While waiting, subscribe to every stream the logger tracks and unsubscribe on completion or interruption. - class: drain waiter misses newly busy stream
    • [LOW] Performance - cli/src/commands/sync.ts:34-38, cli/src/engine-native/exec.ts:375-385 - Unreached: the nudge's git rev-list lost the former per-pipe spawnSync limit. If a Git wrapper emits a large stdout stream, sync now retains it all. The only call uses stock Git's --count output, and the nudge fixtures return small counts. - Pass SPAWN_SYNC_MAX_OUTPUT for the captured nudge call, as the update command does. - class: capture limit dropped during migration

    Spec

    None.

    Code review round 1, lens spec-and-tests

    Code-review: fixes-required

    Standards

    • [MEDIUM] Bug - cli/test/lib/signalEngineEntry.ts:82-90, cli/test/unit/syncSignals.test.ts:839-867, cli/src/main.ts:43-47,101 - The failing-finalizer test still passes if the production entry reverts to the default teardown. It launches a separate entry that implements the exit-code override itself. - Run the failing-finalizer case through the production public entry, or have the fixture use the same public runner and teardown. - class: duplicated production behavior in a test fixture
    • [MEDIUM] Bug - cli/test/unit/exec.test.ts:393-403 - The case for an already-exited group leader interrupts while the leader is still alive. The leader exits in response to the interrupt's SIGTERM, so a regression that skips group cleanup when the leader is already gone passes this test. - Wait for the leader's exit before interrupting, confirm the grandchild still holds a pipe, and assert that it receives the stop signal. - class: fixture does not reach the intended process state
    • [MEDIUM] Maintainability - cli/test/unit/logger.test.ts:486-502, cli/src/engine-native/index.ts:102-108 - The stalled-sink test interrupts withTerminal directly. 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 boundary

    Spec

    • [HIGH] Spec - cli/src/commands/sync.ts:26-32, cli/src/engine-native/exec.ts:282-295,304-306,327-331, cli/test/unit/syncUpdateNudge.test.ts:74-79 - Ctrl-C during the Windows nudge can end the CLI before the ref-writing git fetch exits. 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 sets writer: 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 for exit. - class: timeout exception applied to writer interruption
    • [MEDIUM] Spec - cli/src/commands/sync.ts:78-82, cli/src/commands/update.ts:222-227, cli/src/engine.ts:69-77, cli/src/main.ts:43-47,93-101 - A Windows read-only child whose kill fails during Ctrl-C can make public sync or update exit 1 instead of 130. The nudge runs before engine installs the recorder, and update never enters that scope. Inference: if the failed stop adds ProcessStopFailed to 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 work
    • [MEDIUM] Spec - cli/src/engine-native/bun.ts:135-149 - A bootstrap waiter can receive a Deferred that no fiber will complete. The plan says the claim and completion both happen “in Effect.uninterruptibleMask” (plan-297-cr1.md:86), but the code publishes the claim in Effect.suspend before 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 use restore for both the bootstrap work and the wait on an existing claim. - class: shared claim published before interruption protection
    • [MEDIUM] Spec - cli/src/engine-native/logger.ts:154-172,214-252,293-315 - A synchronous non-EPIPE error 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 entering withExclusive, the logger still opens bufferedWrites. 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 flow
    • [MEDIUM] Spec - cli/src/engine-native/logger.ts:133-165,175-192,205-212 - If stdout reports a non-EPIPE error first and stderr reports another before the next write or settle, the logger reports stderr's error because it scans stderr first. The plan promises “the first asynchronous non-EPIPE error” (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 order
    • [MEDIUM] Spec - cli/test/unit/exec.test.ts:179-233,245-273, cli/test/unit/syncUpdateNudge.test.ts:69-124, cli/test/unit/toolchain.test.ts:44-66 - The Windows shards do not exercise the stop-policy cases required by plan-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 recording taskkill.exe fixture, no public check that prints unknown after 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 coverage
    • [MEDIUM] Spec - cli/test/unit/syncSignals.test.ts:695-705,727-747 - The three-lock test probes SQLite directly. It would still pass if a competing sync chose different paths or failed to report contention. The signal-order row 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 acceptance
    • [LOW] Spec - cli/src/commands/sync.ts:34-43 - Unreached: the nudge's rev-list call has no capture limit, although the plan says “the former spawnHost callers that pipe output pass SPAWN_SYNC_MAX_OUTPUT” (plan-297-cr1.md:51). The checked caller uses stock git 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 migration
    • [LOW] Spec - cli/src/engine-native/kitDb.ts:80-92 - Unreached: a COMMIT failure skips explicit rollback, contrary to the promise that inTransaction “commits or rolls back and keeps the original failure” (plan-297-cr1.md:84). The checked migration and cache-write callers use withKitDb, 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. - Put COMMIT on the same failure path as the body and retain the original error if rollback fails. - class: commit failure bypasses rollback
    • [LOW] Spec - cli/src/engine-native/DESIGN.md:168-177, .agents/skills/host-platform-context/SKILL.md:52,78-79, .agents/skills/toolchain-context/SKILL.md:39-42 - The new guidance conflates a probe deadline with an interrupt and says a failed bounded stop surfaces as ProcessStopFailed. 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 becomes timed-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 the toolchain check result. - Document the two stop paths separately and distinguish HostProcess.run errors from captureWithin outcomes. - class: documented stop policy conflates distinct outcomes
    • [LOW] Spec - .agents/skills/host-platform-context/SKILL.md:84, .agents/skills/sync-orchestration-context/references/dispatch-flow.md:95-100 - Step 5 requires guidance for “the Effect forms of the file and store helpers” (plan-297-cr1.md:100). The atomic-write probe calls the lazy replaceFile Effect without running it and only checks that the original link still exists, so it prints true even if no replacement happens. The dispatch guide also lists home.ts as Effect code even though the plan says “home.ts stays” (plan-297-cr1.md:83) and engineHome still 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 list engineHome as a plain helper. - class: stale Effect migration guidance

    Code review round 1, lens text-and-safety

    Code-review: pass

    Standards

    • [MEDIUM] Security - cli/src/engine-native/exec.ts:218-271, cli/src/engine-native/exec.ts:305-312, cli/src/engine-native/exec.ts:339-365 - If the last member of a POSIX child group exits and its group ID is reused before the next signal, the service can signal the replacement group. The liveness probe does not pin the group between checks. Inference: rapid ID reuse is required; the current group fixtures do not exercise it. - Tie the stop to a stable group identity across signaling and polling, including when the original leader exits before its descendants. - class: reused process-group identity
    • [MEDIUM] Security - cli/src/engine-native/exec.ts:231-237, cli/src/engine-native/exec.ts:260-272, cli/src/engine-native/exec.ts:305-317, cli/src/engine-native/syncDispatch.ts:178, cli/src/commands/tidy.ts:119 - If a POSIX writer group contains a surviving member the CLI cannot signal, kill(..., 0) reports the group as live but EPERM from 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 shutdown
    • [MEDIUM] Bug - cli/src/commands/sync.ts:26-32, cli/src/engine-native/exec.ts:282-308, cli/src/engine-native/exec.ts:326-332 - On Windows, interrupting the nudge's git fetch can let the CLI exit before the ref-writing child exits. writer: false applies 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 interruption
    • [MEDIUM] Bug - cli/src/engine-native/exec.ts:119-123, cli/src/engine-native/exec.ts:353-365, cli/src/engine-native/exec.ts:450-460, cli/src/commands/update.ts:23-32, cli/src/commands/update.ts:226-228 - The output-budget contract promises an ENOBUFS result after the child is stopped. If an update child exceeds the budget and a descendant retains a captured pipe, overflow records the error but awaitChild still waits for close, even after the direct child exits. Inference: a checkout using a helper that retains the pipe can leave update waiting instead of reporting git status failed. - Make overflow a completion event that runs the appropriate stop policy, disposes of capture pipes, and returns the bounded output with ENOBUFS. - class: output-limit stop waits on inherited pipes
    • [MEDIUM] Maintainability - cli/src/main.ts:43-47, cli/test/lib/signalEngineEntry.ts:83-89 - The failing-finalizer signal fixture copies the public teardown instead of using it. Removing the recorded-code override from main.ts would 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 policy
    • [LOW] Bug - .agents/skills/host-platform-context/SKILL.md:44, .agents/skills/sync-orchestration-context/references/dispatch-flow.md:54-57, cli/src/commands/sync.ts:14-16, cli/src/engine-native/exec.ts:479-483, cli/src/engine-native/exec.ts:597-602 - With a relative Windows PATH entry, which can return a relative executable. An explicit current-directory entry can even yield a bare git.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 absolute
    • [LOW] Bug - cli/src/engine-native/DESIGN.md:175-176, .agents/skills/host-platform-context/SKILL.md:78-79, .agents/skills/toolchain-context/SKILL.md:38-42, cli/src/engine-native/deps.ts:10-12 - The guidance says a probe deadline uses the interrupt grace period and that a failed stop surfaces as ProcessStopFailed. In exec.ts:339-349,554-558, a POSIX owned probe requests SIGKILL immediately, and captureWithin maps a stop failure to timed-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 contract
    • [LOW] Bug - .agents/skills/omp-sync-context/SKILL.md:92-94, .agents/skills/sync-orchestration-context/SKILL.md:222-225,286-291, .agents/skills/sync-orchestration-context/references/dispatch-flow.md:106-113, .agents/skills/tidy-context/SKILL.md:147, cli/src/engine-native/ompSync.ts:59-64 - The interrupt guidance overstates or understates what the CLI waits for. Windows waits for the direct writer, not its group, and does not wait for read-only probes. POSIX owned children also require a stop-and-wait, not just a wait for started mutations. The tidy skill places du inside applyTidy, but du runs 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 boundary
    • [LOW] Bug - cli/src/commands/sync.ts:11-19, cli/src/engine-native/exec.ts:333-337 - The nudge comment says it never blocks or fails. On POSIX, the deadline sends SIGTERM and waits for git fetch to 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 guarantee
    • [LOW] Bug - cli/src/engine-native/DESIGN.md:162-166, .agents/skills/host-platform-context/SKILL.md:44,107, cli/src/agentDocs/services.ts:82, cli/src/plan/services.ts:68, cli/src/skills/kitGate.ts:227 - The guidance says every CLI child uses HostProcess and that a CLI-wide search for direct spawnSync calls prints nothing. Agent docs still calls spawnSync("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 guidance
    • [LOW] Bug - .agents/skills/host-platform-context/SKILL.md:84, cli/src/engine-native/atomicWrite.ts:164-199, cli/test/unit/atomicWrite.test.ts:138 - The documented symlink probe calls replaceFile without running its Effect. It prints true for 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 behavior
    • [LOW] Bug - .agents/skills/host-platform-context/SKILL.md:76,90,116, .agents/skills/sync-orchestration-context/SKILL.md:144, .agents/skills/sync-orchestration-context/references/dispatch-flow.md:84,95-100 - The migrated guides retain obsolete migration anchors: update.test.ts:646-660 does inspect the spawn options, commandLineRefusal replaced assertCommandLineValue, live service instances are built when the layer runs, runEngineNative requires HostProcess, runPipeline uses catchCause, and engineHome remains 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 guidance
    • [LOW] Bug - cli/src/engine-native/logger.ts:143-165,175-211 - If stdout records one asynchronous failure and stderr records another before the next logger call or settlement, recordedFailure returns 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 order
    • [LOW] Bug - cli/src/engine-native/logger.ts:214-220,349-354,366-383 - If a stream reports an asynchronous error while the terminal lease is held, the release short-circuits on the recorded error before clearing activeLease. A later acquisition on that logger then reports LeaseHeld, 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 success

    Spec

    None.

  18. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 2, delta

    Code-review: pass

    Previous findings

    • Round-1 correctness finding on cli/src/commands/sync.ts:26-32: fixed - The fetch uses waitAtDeadline: false and keeps the default writer policy on interrupt (cli/src/commands/sync.ts:31-36, cli/src/engine-native/exec.ts:319-322).
    • Round-1 correctness finding on 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.
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on 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).
    • Round-1 correctness finding on cli/src/commands/sync.ts:34-38: fixed - rev-list has the per-pipe capture budget (cli/src/commands/sync.ts:39-45).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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.
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on 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.
    • Round-1 spec-and-tests finding on 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).
    • Round-1 spec-and-tests finding on cli/src/engine-native/DESIGN.md:168-177, bounded stop: fixed - The design separates the deadline and interrupt policies and distinguishes run errors from captureWithin outcomes (cli/src/engine-native/DESIGN.md:173-198).
    • Round-1 spec-and-tests finding on .agents/skills/host-platform-context/SKILL.md:84, file helpers: open - The atomic-write probe and dispatch guide are fixed; the toolchain guide still calls engineHome effectful. See Spec.
    • Round-1 text-and-safety finding on 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.
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on cli/src/commands/sync.ts:26-32, fetch interruption: fixed - waitAtDeadline no longer controls the interrupt path (cli/src/engine-native/exec.ts:319-322,342-347).
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on cli/src/main.ts:43-47, duplicated teardown: fixed - The production and fixture entries share runPublicMain (cli/src/main.ts:91, cli/test/lib/signalEngineEntry.ts:91).
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on cli/src/engine-native/DESIGN.md:175-176, bounded-stop contract: fixed - The new text describes immediate POSIX group kill at the deadline and the timed-out probe result (cli/src/engine-native/DESIGN.md:183-198).
    • Round-1 text-and-safety finding on .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.
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on .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).
    • Round-1 text-and-safety finding on .agents/skills/host-platform-context/SKILL.md:76,90,116, stale guidance: open - The toolchain guide still describes calls into home.ts as Effects. See Spec.
    • Round-1 text-and-safety finding on 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).
    • Round-1 text-and-safety finding on 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

    • [MEDIUM] Bug - cli/src/engine-native/tidy.ts:1443-1460,1481-1489 - A signal during network cleanup for a merged worktree leaves its already-removed containers out of both the output and tidy.log. The standalone remove-containers repair records the result before cleanup, but remove-worktree records 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-up
    • [MEDIUM] Bug - cli/test/unit/syncSignals.test.ts:138-143,713-736,765-808, cli/src/engine-native/exec.ts:274-286 - A slow CI runner can let the three serial competitor launches consume the production stop grace period. Inference: the writer is then killed before the barrier opens, so a later competitor can acquire the lock and fail the test even though shutdown is correct. The test also accepts the same exit code if the writer is killed after all three refusals but before the barrier opens. An unbounded spawnSync can 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 escalation
    • [LOW] Security - cli/src/engine-native/exec.ts:228-250,274-286,356-365 - Unreached: if the last owned process exits and the operating system reuses its group ID before the next signal, the signal can reach an unrelated group. Inference: the liveness check and signal are separate operations; the ID is reserved only while a member remains. The spawnOmp and 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 identity
    • [LOW] Bug - cli/src/engine-native/exec.ts:616-624,638-647, cli/src/commands/update.ts:222-225 - A Windows checkout with the current directory first on PATH and an installed Git later can make update report that Git is missing. The resolver rejects the first hit after which has stopped searching, so it never sees the valid next entry. This depends on the user's PATH order; 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 search
    • [LOW] Bug - cli/src/engine-native/logger.ts:389-403 - Unreached: when stdout has an asynchronous failure and the progress erase throws synchronously, release clears the lease but reports only the erase error. The recorded failure check runs only if runWrites succeeds. 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 error
    • [LOW] Bug - CHANGELOG.md:5-17, cli/src/engine-native/exec.ts:296-310,319-331, cli/src/commands/update.ts:23-32 - An update user can read the release note as a promise that a stalled Git child gets a group SIGKILL after three seconds. The updater uses shared children on POSIX; it sends only SIGTERM to 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 boundary
    • [LOW] Bug - cli/test/unit/windowsStop.test.ts:99-110,228-282 - The writer and fetch tests would also pass if production waited for close instead of exit. 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 close
    • [LOW] Maintainability - cli/test/unit/exec.test.ts:352-382, cli/test/unit/windowsStop.test.ts:194-222 - When either regression test reaches the wait it is meant to catch, the descendant cleanup also waits. The POSIX test reads the PID only after the result, and the Windows test reaches its finally only 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 test
    • [LOW] Performance - cli/src/engine-native/exec.ts:426-430,468-478 - Every child now allocates an overflow deferred and races two fibers, including uncapped probes and inherited-output commands that cannot produce an overflow event. - Have close and overflow publish to a single completion deferred, or avoid the overflow race when there is no capture budget. - class: unconditional wait for an impossible event

    Spec

    • [MEDIUM] Spec - cli/src/commands/sync.ts:31-36,54-57, cli/src/engine-native/exec.ts:296-310,342-347,480-487,515-523 - On Windows, if the four-second fetch deadline cannot terminate Git, sync can wait indefinitely before entering the engine. stopOnWindows(..., false) returns ProcessStopFailed, 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 interruption
    • [MEDIUM] Spec - cli/test/unit/windowsStop.test.ts:286-314, cli/test/lib/engineRun.ts:24-36 - The failed-probe test can pass if a still-live probe keeps the public process running. It checks an in-process engine promise, not CLI exit, so removing the child unref() would not fail the test. The windows row requires a public toolchain check that prints unknown and 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 exit
    • [LOW] Spec - cli/test/unit/syncLock.test.ts:256-286, cli/test/unit/logger.test.ts:486-502 - The new engine-level test interrupts at the home lock using a write submitted before the run. It never draws a terminal lease. The separate lease test does not run the engine. The unit-logger row 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 state
    • [LOW] Spec - cli/src/commands/sync.ts:39-49, cli/src/engine-native/exec.ts:481-485, cli/test/unit/syncUpdateNudge.test.ts:111-121 - Unreached: a rev-list wrapper can exceed the limit and still exit 0. The result carries both ENOBUFS and 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 success
    • [LOW] Spec - .agents/skills/toolchain-context/SKILL.md:35-43, cli/src/engine-native/home.ts:9-15 - The toolchain guide still says calls into home.ts are Effects. The Files decision says “home.ts stays,” and Step 5 requires accurate guidance on the Effect forms of the helpers (plan-297-cr2.md:83,100). engineHome returns a string. - Separate the plain home resolver from the effectful toolchain dependencies in the guide. - class: synchronous helper documented as effectful

    Manager response to round 1

    Repaired (commit 01aa2623; Windows cases also in 1d5f197a):

    • Round 1, spec-and-tests HIGH, correctness and text-and-safety MEDIUM, Windows nudge interrupt (deadline exception applied to interruption): ProcessOptions.waitAtDeadline applies only to the Windows deadline stop; an interrupt stop always follows writer, so the nudge git fetch is waited for until its exit on interrupt. The nudge options test and a Windows interrupt case pin this.
    • Round 1, text-and-safety, fail-open writer shutdown on EPERM: an EPERM from the group signal no longer aborts; the stop keeps polling until ESRCH, so the lock stays held while the group lives.
    • Round 1, text-and-safety, output-limit stop waits on inherited pipes: an overflow ends the wait, runs the stop, closes the pipes, and returns the bounded output with ENOBUFS.
    • Round 1, spec-and-tests and correctness, nudge rev-list capture limit: it passes SPAWN_SYNC_MAX_OUTPUT; an overflow is a silent miss.
    • Round 1, spec-and-tests, signal recorder starts after interruptible work: cli/src/publicRun.ts records the signal around the whole public command run; the raw channel keeps 130 and 143.
    • Round 1, spec-and-tests and text-and-safety, duplicated teardown in the fixture: signalTeardown is one function in publicRun.ts that main.ts and signalEngineEntry.ts use.
    • Round 1, spec-and-tests and correctness, Bun claim before the mask: the check, the claim, and the completion are inside the mask; the bootstrap and the wait on an existing claim run under restore. No test: the interval between the claim and the mask cannot be reached deterministically.
    • Round 1, spec-and-tests and correctness, logger: a synchronous non-EPIPE sink error stops the call before later writes or state changes; withExclusive opens its buffer only after the erase; the earliest asynchronous failure across streams wins; the lease release clears ownership after a stored error; settle waits on every tracked stream.
    • Round 1, spec-and-tests and correctness, kitDb commit failure and the open-to-chmod interval: a failed COMMIT rolls back and keeps the commit error; the chmod is part of the acquire, and a failed chmod closes the handle.
    • Round 1, correctness, tidy docker removal recorded after the network cleanup: the removal line is recorded first.
    • Round 1, spec-and-tests, tests: the exited-leader case waits for the leader exit and checks that the grandchild got the stop; an engine-level case with a stalled sink ends without a wait; the three-lock case runs real competing syncs; windowsStop.test.ts covers the writer and nudge interrupt waits, a failed probe kill that prints unknown, no taskkill.exe, and the deadline result before a held-back exit.
    • Round 1, spec-and-tests and text-and-safety, guidance: DESIGN.md states the deadline stop and the interrupt stop separately and the platform guarantees once; captureWithin timed-out is separate from ProcessStopFailed; du runs in the report; the spawn rule is scoped to the engine and migrated commands; the symlink probe points to the atomicWrite test; stale anchors are updated; a Windows name found through a relative PATH entry becomes an absolute path, and a bare name found in the current directory is refused.

    Rejected:

    • Round 1, text-and-safety, reused process-group identity: POSIX does not reuse a process group ID while the group exists, and the stop sends no signal after kill(-pgid, 0) gives ESRCH. The window between the last member's exit and the next signal is the same for every kill(-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).

  19. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 3, delta

    Code-review: fixes-required

    Previous findings

    • Round-2 finding on 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).
    • Round-2 finding on cli/test/unit/syncSignals.test.ts:138-143,713-736,765-808: open - Parallel competitors and the .seen marker prevent the old false pass, but the production grace period can still cause a false failure. See Standards.
    • Round-2 finding on cli/src/engine-native/exec.ts:228-250,274-286,356-365: open - DESIGN.md:190-195 documents the limit; the signaling code still has it. See Standards.
    • Round-2 finding on 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).
    • Round-2 finding on 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).
    • Round-2 finding on CHANGELOG.md:5-17: fixed - The release note now distinguishes POSIX groups, shared POSIX children, and Windows writers and reads (CHANGELOG.md:9-20).
    • Round-2 finding on cli/test/unit/windowsStop.test.ts:99-110,228-282: fixed - Both interrupt cases release exit and assert completion before releasing close (cli/test/unit/windowsStop.test.ts:288-305,329-346).
    • Round-2 finding on cli/test/unit/exec.test.ts:352-382 and cli/test/unit/windowsStop.test.ts:194-222: open - The result waits have bounds, but there are still paths that skip fixture cleanup. See Standards.
    • Round-2 finding on 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).
    • Round-2 finding on cli/src/commands/sync.ts:31-36,54-57 and cli/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).
    • Round-2 finding on 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.
    • Round-2 finding on cli/test/unit/syncLock.test.ts:256-286 and cli/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.
    • Round-2 finding on cli/src/commands/sync.ts:39-49: fixed - The nudge checks res.error before 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).
    • Round-2 finding on .agents/skills/toolchain-context/SKILL.md:35-43: fixed - The guide now describes engineHome as a plain function (.agents/skills/toolchain-context/SKILL.md:38-41).

    Standards

    • [HIGH] Bug - cli/test/unit/syncLock.test.ts:269-282, cli/src/engine-native/bun.ts:192-193, cli/src/engine-native/ompPlugins.ts:334-340, .github/workflows/parity.yml:74-88,116-126 - On a runner with Bun installed but no omp on PATH, 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 missing omp skips the plugin pass, and no child completes started. Inference: this blocks the portable unit jobs on runners provisioned by the workflow, which installs Bun and package dependencies but does not install omp. - Use the file's existing dependency fixture to make Bun and omp present, gate on the intended fake omp call, and fail promptly if the engine ends before reaching that call. - class: test gate depends on an unprovisioned host executable
    • [MEDIUM] Bug - cli/test/unit/syncSignals.test.ts:717-721,848-881, cli/src/engine-native/exec.ts:282-294 - A slow runner can still fail the lock-order test with correct shutdown behavior. The readiness marker is written in a preload before the CLI entry runs. Inference: after the go file appears, CLI startup, the lock attempts, and all three child close events can still consume the three-second grace period. The new .seen assertion 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 escalation
    • [MEDIUM] Maintainability - cli/test/unit/syncSignals.test.ts:251-278,717-721,747-787,848-853 - If readiness fails before the go file is written, an already-started competitor keeps polling for the file after teardown removes the fixture root. The competitors and their tool stubs bypass the supervisor and ticket tracking that teardown relies on. Inference: on an early failure they can continue until the case deadline, and stubs started by a late competitor are not covered by the competitor's timer. - Register the competitors and their stubs with the fixture supervisor, and await their shutdown before removing the root. - class: spawned competitor bypasses fixture teardown
    • [LOW] Security - cli/src/engine-native/exec.ts:233-255,285-295,356-365, cli/src/engine-native/DESIGN.md:190-195 - Unreached: if the last owned process exits and its group ID is reused before the next signal, the signal can reach an unrelated group. Inference: POSIX reserves the ID only while the group exists, and the check and signal do not pin its identity. The spawnOmp and 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 identity
    • [LOW] Security - cli/src/engine-native/exec.ts:633-642,663-673 - Unreached: if a later Windows PATH entry 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 in updateCheckout and updateNudge, the host-resolution fixtures, and the documented relative-PATH example 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 alias
    • [LOW] Maintainability - cli/test/unit/exec.test.ts:385-415, cli/test/unit/windowsStop.test.ts:250-277,418-437 - The process fixtures can still miss cleanup on the failure paths they test. The overflow test can read an empty PID file between creation and write, leaving PID 0 and no descendant cleanup. The Windows deadline test bounds the result but not await 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 in finally before deleting the fixture. - class: fixture cleanup waits on the operation under test
    • [LOW] Maintainability - cli/test/unit/syncLock.test.ts:282-295, cli/test/unit/tidy.test.ts:1005-1031 - If the tidy apply skips the mocked network call, the readiness wait never returns and the console spy stays installed after Vitest times out. If the sync regression waits for a stalled callback, the assertion throws before those callbacks are released. - Bound readiness and interruption, and release fixture callbacks, unblock the fiber, and restore the spy in cleanup that runs even when an assertion fails. - class: fiber fixture lacks an independent cleanup path
    • [LOW] Bug - cli/src/engine-native/exec.ts:627-642,645-651, .agents/skills/host-platform-context/SKILL.md:44 - For the new PATH fallback case, exported which returns the current-folder hit but HostProcess.run selects the later entry. The guide still says run uses which, and the resolver docstring says the first hit produces an empty result. - Describe the filtered lookup used for spawning and distinguish it from plain which. - class: stale executable resolution guidance
    • [LOW] Bug - cli/src/commands/sync.ts:43-47, cli/test/unit/syncUpdateNudge.test.ts:111-125 - The budget comment says ENOBUFS cannot 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 comment

    Spec

    • [MEDIUM] Spec - cli/test/unit/windowsStop.test.ts:398-412,418-430, cli/src/main.ts:43-65 - The windows row requires “a public toolchain check whose probe kill fails” (plan-297-cr3.md:137). The test spreads the parent environment without clearing DOCKS_KIT_ENGINE. If it inherits native-raw, the child bypasses the public runner and explicitly exits 0. Inference: in that environment the test can pass even if removing unref() 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 entry
    • [LOW] Spec - cli/test/unit/windowsStop.test.ts:165-174,423-430 - The same row requires a probe “whose kill fails” (plan-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 failing kill replacement and assert that the deadline path attempted the kill. - class: fixture records setup instead of the required failure path

    Manager response to round 2

    Repaired (commit aff8842c):

    • Round 2, tidy.ts worktree removal: after docker rm succeeds, a pending line removed N container(s) of worktree <path> is logged and printed when the action stops before its worktree line; normal output is unchanged.
    • Round 2, syncSignals.test.ts barrier race: competitors start before the shutdown and wait for a go file, each bounded by a deadline, with no spawnSync; the stub writes barrier.seen, and the case asserts it.
    • Round 2, Windows nudge deadline failure: a failed deadline or budget stop marks the child settled, so the release does not stop it again with the writer policy; the nudge warns cannot stop git and returns while the fetch runs.
    • Round 2, Windows failed-probe case: the public CLI runs in a subprocess with a preload that makes the probe kill fail; the case checks exit 0, unknown, and a live probe, then ends the probe.
    • Round 2, group identity (LOW): DESIGN.md states 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.
    • Round 2, Windows resolver: a current-directory hit is skipped, and the search continues to the next PATH entry.
    • Round 2, lease release: the recorded asynchronous error is kept when the erase also fails.
    • Round 2, CHANGELOG: the 0.33.2 entry separates owned POSIX groups, shared POSIX children, and Windows writers and reads.
    • Round 2, exit versus close: the Windows fixture releases exit while close stays held, and the scope ends before close.
    • Round 2, fixture cleanup: the ENOBUFS and Windows deadline cases own their child and descendant before the wait, bound it, and stop them in finally.
    • Round 2, overflow race: close and overflow complete one deferred.
    • Round 2, engine-level lease: the case waits for the stalled Syncing omp... draw, interrupts, and asserts that the run ends within 5 s with the callback pending.
    • Round 2, nudge overflow with exit 0: the nudge returns before it reads the count when the result has an error; the case covers exit 0 and null.
    • Round 2, toolchain guide: engineHome is plain, separate from the effectful dependencies.

    Rejected: none.

    Redesigned: none.

  20. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 4, delta

    Code-review: pass

    Previous findings

    • Round-3 finding on 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).
    • Round-3 finding on 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.
    • Round-3 finding on 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).
    • Round-3 finding on 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.
    • Round-3 finding on 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.
    • Round-3 finding on cli/test/unit/exec.test.ts:385-415 and cli/test/unit/windowsStop.test.ts:250-277,418-437: open - A late PID record can still leave teardown without ownership. Repeated under Standards.
    • Round-3 finding on cli/test/unit/syncLock.test.ts:282-295 and cli/test/unit/tidy.test.ts:1005-1031: open - The waits have bounds, but the cleanup still cannot release every stalled operation. Repeated under Standards.
    • Round-3 finding on cli/src/engine-native/exec.ts:627-642,645-651 and .agents/skills/host-platform-context/SKILL.md:44: fixed - The resolver docstring and skill distinguish the filtered spawn lookup from plain which (cli/src/engine-native/exec.ts:644-651, .agents/skills/host-platform-context/SKILL.md:44).
    • Round-3 finding on 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).
    • Round-3 finding on cli/test/unit/windowsStop.test.ts:398-412,418-430: fixed - childEnv clears inherited spellings of DOCKS_KIT_ENGINE, so the spawned test uses the public entry (cli/test/unit/windowsStop.test.ts:405-420).
    • Round-3 finding on 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

    • [MEDIUM] Bug - cli/test/unit/syncSignals.test.ts:824-831,853-878, cli/test/unit/syncSignals.test.ts:258-301 - If a competitor fails an assertion before the barrier opens, the stopped omp stub still waits at that barrier. The test now gives it a 60-second grace period, but teardown waits only 10 seconds and does not open the barrier. Inference: the failure leaves the CLI holding its locks beyond teardown, which reports and keeps the fixture root. - Give fixture teardown ownership of the barrier and release it on failure or cancellation without opening it early on the passing path. - class: extended test barrier not released during teardown
    • [LOW] Security - cli/src/engine-native/exec.ts:259-280,298-309,378-385 - Unreached: if the last member exits and the OS reuses its process-group ID before the next signal, the stop can signal an unrelated group. The corrected comment and design now acknowledge this; they do not change the group lookup. The spawnOmp and 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 identity
    • [LOW] Security - cli/src/engine-native/exec.ts:653-670 - Unreached: if Windows can stat an executable but cannot canonicalize its containing directory, the fallback can accept a differently spelled PATH entry that aliases the working directory. Windows can reject normalized-path queries on SMB even when the file is accessible. Inference: comparing the fallback text treats an unknown directory identity as a safe match. The bare Git callers, junction fixture, and documented relative-PATH example do not exercise a failed canonical lookup. - Require a verified directory identity for bare-name candidates; keep explicit paths usable and continue past candidates whose identity cannot be verified. - class: lexical comparison misses a directory alias
    • [LOW] Maintainability - cli/test/unit/exec.test.ts:430-451, cli/test/unit/windowsStop.test.ts:263-284,427-457 - If readiness times out after a descendant starts but before its PID record becomes readable, teardown still has PID 0. It does not recover a late record or confirm that no descendant can start, and the Windows public test's hook can remove the release file before the probe sees it. Inference: a slow startup can leave the descendant alive until its fallback deadline. - Track descendant startup and shutdown independently of the assertion wait, and keep the fixture and release file until shutdown is confirmed. - class: fixture cleanup waits on the operation under test
    • [LOW] Maintainability - cli/test/unit/tidy.test.ts:1006-1012,1023-1041, cli/test/unit/syncLock.test.ts:261-268,297-318 - If tidy's mocked network call becomes uninterruptible, the fake's Effect.never gives 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 path

    Spec

    • [MEDIUM] Spec - cli/src/engine-native/exec.ts:35-49,298-309 - The Process service decision says the live stop polls “for up to PROCESS_STOP_GRACE_MS (3000 ms),” then sends SIGKILL (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 ignores SIGTERM, 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 shutdown

    Manager response to round 3

    Repaired (commit e253c168):

    • Round 3, syncLock.test.ts stalled-lease case without omp on PATH (HIGH): the case uses the file's dependency fixture (Bun, omp, and git present, no spawns), holds only the omp child, and fails at once when the run ends before that call or after 5 s. With omp off PATH, the new case passes and the old case hangs.
    • Round 3, lock-order barrier race: the test-only key DOCKS_KIT_TEST_STOP_GRACE_MS replaces 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.
    • Round 3, Windows public probe case: the child environment comes from childEnv with DOCKS_KIT_ENGINE: ""; the failing kill writes a marker that the case asserts; the probe pid is taken before the wait for the CLI.
    • Round 3, group identity source comment (LOW): the comment points to the limit in DESIGN.md and makes no categorical claim. The limit itself stays: POSIX gives no stable group handle.
    • Round 3, directory alias (LOW): the current-directory refusal compares real paths of the folders; a linked entry is skipped too.
    • Round 3, fixture cleanup (LOW): complete positive pid records before each wait, a bounded exited wait, and finally blocks that release callbacks, interrupt fibers, and restore spies.
    • Round 3, resolver guidance (LOW): the docstring, host-platform-context, and DESIGN.md describe the filtered spawn lookup, separate from plain which.
    • Round 3, stale ENOBUFS comment (LOW): removed.

    Rejected: none.

    Redesigned: none.

  21. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 5, delta

    Code-review: pass

    Previous findings

    • Round-4 finding on 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.
    • Round-4 finding on 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.
    • Round-4 finding on 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.
    • Round-4 finding on cli/test/unit/exec.test.ts:430-451 and cli/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.
    • Round-4 finding on cli/test/unit/tidy.test.ts:1006-1012,1023-1041 and cli/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.
    • Round-4 finding on 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

    • [LOW] Security - cli/src/engine-native/exec.ts:244-256,283-294,364-370 - Unreached: If the OS reuses a process-group ID after the last member exits but before the next stop signal, inference: that signal can hit an unrelated group. Stopping on ESRCH only 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
    • [LOW] Security - cli/src/engine-native/exec.ts:639-658 - Unreached: If the native lookup of . 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 alias
    • [LOW] Maintainability - cli/test/unit/exec.test.ts:279-342,415-419,448-454,517-539,626-674, cli/test/unit/windowsStop.test.ts:175-185,209-215,250-254,287-292,455-464 - If a launcher is stopped after spawning a descendant but before publishing its PID, inference: the final read still returns no PID and the descendant runs until its fallback deadline. The other exec fixtures likewise register cleanup ownership only after readiness succeeds. The Windows public-probe hook also removes the release file when the exit wait fails, even if the stub has not seen it. - Give teardown ownership independent of the readiness check, and retain release files until shutdown is confirmed or late startup is ruled out. - class: fixture cleanup waits on the operation under test
    • [LOW] Maintainability - cli/test/unit/syncLock.test.ts:274-279,319-324,695-701,731-735, cli/test/unit/bun.test.ts:70-78,119-127,544-598, cli/test/unit/logger.test.ts:487-503 - If a regression masks interruption, inference: the sync fake omp call and the Bun probe or installer fakes can stay in Effect.never after 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 path

    Spec

    • [MEDIUM] Spec - cli/test/unit/syncSignals.test.ts:138-146,188-197,921-930 - The signal-order row 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 forwards SIGKILL before the stub's next poll. The stub can die without writing barrier.seen or 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 termination

    Manager response to round 4

    Repaired (commit 8bf4afe8):

    • Round 4, Spec, test timing override in production: DOCKS_KIT_TEST_STOP_GRACE_MS is gone; the live stop polls for PROCESS_STOP_GRACE_MS and reads no environment. The barrier case holds the group SIGKILL through a test preload until its barrier file exists; the wrapper case keeps the real grace and escalation.
    • Round 4, barrier not released during teardown: stopAndRemove writes the barrier file of every launch before it stops the launches and waits for them.
    • Round 4, directory identity on Windows (LOW): a bare-name candidate whose folder has no real path is skipped, and the search goes on; explicit paths are unchanged.
    • Round 4, fixture cleanup (LOW): pid records are written whole by rename and read again in 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:

    • Round 4, reused process-group identity (LOW, Unreached, rounds 1 to 4): POSIX offers no handle that binds a signal to a process group across its lifetime, and Node exposes none. The stop sends no signal after the first ESRCH, and DESIGN.md records the remaining window as a known limit. No caller or fixture reaches rapid group-ID reuse.

    Redesigned: none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions