Skip to content

Move the engine seam and the sync orchestration to Effect #294

Done

Description

@DocksDocks

Goal

Child of #290, the first one. Move the engine entry and the sync orchestration to Effect: cli/src/engine.ts, engine-native/index.ts, engineCtx.ts (the run context as Effect services), services.ts (Effect layers), logger.ts (the terminal lease as a scoped resource), parseArgs.ts and parseHelp.ts (an intended abort as a typed failure, not a thrown ExitError), failures.ts (the failure ledger), syncDispatch.ts engineSync, ompSync.ts, modes.ts, and cli/src/commands/sync.ts and toolchain.ts. Calls into code that a later child of #290 moves go through the bridge rule of the #290 Research. Keep the sync output, exit codes, locks, goldens, and idempotency unchanged.

Yolo: the user delegated every decision except the merge to the agent.

Mode: plan-and-implement

Research

Repository facts (base b53f04d6; parent #290 Research holds the shared facts, the File owners table, and the bridge rule):

  • cli/src/engine-native/index.ts runEngineNative(argv, services?, options?) returns Promise<number>. cli/src/main.ts awaits it in the raw golden channel and passes the code to process.exit, and prints docks-kit raw operation '<operation>' failed: <detail> with exit 1 on a rejection. cli/src/engine.ts engine wraps it in Effect.tryPromise and maps a rejection to CliError.UserError (engine operation '<args>' failed: <message>), and calls process.exit(code) for a nonzero code.
  • Intended aborts: parseArgs.ts throws ExitError(0) after -h/--help and ExitError(2) after Unknown arg: <word>; syncDispatch.ts throws ExitError(2) after DOCKS_KIT_SYNC_LOCK_WAIT_MS must be a non-negative safe integer; index.ts catches ExitError and returns its code.
  • engineCtx.ts makeCtx builds a plain Ctx (repoDir, home, dryRun, verbose, services, terminalLease, bunRuntime, nextStepTriggers, failures) that every engine module reads. Code that later children move (ompPlugins.ts, ompFileDeploy.ts, ompKitPlugin.ts, bun.ts, toolchain.ts) reads and writes it synchronously, so Ctx stays a plain value that the seam passes on.
  • failures.ts recordFailure(ctx, message) appends to ctx.failures and warns; its callers are ompSync.ts and ompPlugins.ts (Move the omp passes and the kit store to Effect #296).
  • logger.ts TerminalLease has update, withExclusive(action) (Promise queue), and release; syncDispatch.ts takes it with acquireTerminal("Syncing omp...") and releases it in finally. No production caller runs withExclusive.
  • Locks: engineSync uses the Promise withKitLocks over acquireKitLock and releases in finally; a held lock returns 1. homeAndFolderLocks (Handle empty OMP tier sections in the fast toggles #284) is the scoped Effect form with acquireRelease, KitLockHeld, LockWaitInvalid, and LockAcquireError, and commands/root.ts uses it.
  • ompSync.ts calls, in order: bunBootstrap (Promise), ensureDirectory, syncWholeFile (twice), syncMergedYaml with mergeOmpConfig, syncOmpRemovals, syncMergedYaml with mergeOmpModels, syncOmpModelRemovals, syncKitPlugin (synchronous), syncPlugins (Promise), and ompPaths again. A rejection prints the recorded failures and rethrows. modes.ts calls report, outdatedReport, present, bunBootstrap, installedVersion, field, and belowFloor.
  • Tests that call the seam: engine-di.test.ts, envGlobals.test.ts, and syncLock.test.ts await runEngineNative; logger.test.ts drives the lease.
  • Other facts: engineSync takes the home lock before ompWriteFolders probes the XDG data root, so a waiting sync picks the root after it holds the lock (syncDispatch.ts); syncDispatch.ts also runs mkdirSync, existsSync, and realpathSync.native for its lock folders. makeCtx calls kitHome(), which throws when an explicit DOCKS_KIT_HOME has no manifest (kitHome.ts); the public seam prints that message in its CliError.UserError. logger.ts rethrows a write error that is not EPIPE, rethrows the first error of a buffered flush, and throws on a second acquireTerminal and on a nested withExclusive (logger.test.ts checks that a nested call fails and the next call still runs). modes.ts returns 2 from four usage branches. engineCtx.ts bunRuntime holds the Promise memo that bun.ts (Move the toolchain passes to Effect #298) reads and writes. More callers await the seam's APIs: engine.test.ts (mocked Promise results), ompPluginInventory.test.ts, ompRemovals.test.ts (it runs ompSync), and toolchain.test.ts. .agents/skills/engine-native-context/SKILL.md requires cli/test/unit/goldenProveRed.test.ts.
  • Skill text to change: .agents/skills/engine-native-context/SKILL.md (the ExitError rule), .agents/skills/sync-orchestration-context/SKILL.md (the ExitError rules and "The lock goes in finally"), and its references/dispatch-flow.md (the Promise-era order, the finally release, and the anchor export async function ompSync); .agents/skills/tidy-context/SKILL.md (its lock row names acquireKitLock as the lock of sync); cli/src/engine-native/DESIGN.md (the parser re-export of ExitError).

Tool facts: as the parent #290 records (Bun 1.4.5, Node v26.13.0, Git 2.53.0, Vitest 5.1.2, effect 4.1.7, @effect/tsgo 0.74.1).

Decisions:

  • One bridge module (delegated, one line): cli/src/engine-native/bridge.ts exports bridgeSync(step, f) and bridgePromise(step, f), which are Effect.uninterruptible over Effect.try and Effect.tryPromise with a typed LegacyStepFailed (step, message, cause). Every bridge of this child uses them, so the bridge rule lives in one place with one test, and Move the process layer, the file helpers, and the kit store to Effect #297 deletes the file. Rejected: one inline Effect.uninterruptible(Effect.try(...)) per call, which repeats the rule in about 20 places.
  • The run context (delegated, one line): EngineContext is a Context.Service whose value is the plain Ctx; the Effect code reads it with yield*, and passes the same value to bridged code. Rejected: one service per Ctx field, which bridged code cannot read.
  • The ledger (delegated, one line): recordFailure stays a plain synchronous append, because ompPlugins.ts (Move the omp passes and the kit store to Effect #296) calls it; Effect code calls it through Effect.sync. Move the omp passes and the kit store to Effect #296 decides its final form with its last caller.
  • The terminal lease (delegated, one line): acquireTerminal becomes a scoped resource (Effect.acquireRelease), and withExclusive takes and returns an Effect, serialized with a one-permit Semaphore; update and release stay synchronous. Rejected: keeping the Promise queue, which the parent promises row forbids.
  • Intended aborts (parent D5): help, every usage refusal (Unknown arg and the four branches of modes.ts), and an invalid DOCKS_KIT_SYNC_LOCK_WAIT_MS are typed failures in the error channel (HelpShown with code 0, UsageRefused and LockWaitInvalid with code 2), and runEngineNative turns each into its exit code after the same text. ExitError is removed.
  • Known synchronous failures (delegated, one line): kitHome() (a bridge until Move the process layer, the file helpers, and the kit store to Effect #297 moves the resolver, parent File owners) and the other throwing calls that the seam owns run in Effect.try with a typed error (KitHomeInvalid) that keeps the original message; the seam prints the same detail as now for LegacyStepFailed, KitHomeInvalid, and a lock that cannot be opened (the message of its cause), and the root tier toggles keep their lock diagnostic. Rejected: Effect.sync, which makes them defects.
  • Logger failures (delegated): the logger stays a synchronous object over the Node streams, because every later child's code calls it, and a write error that is not EPIPE still throws at once, so no later work runs after it (for example the installer after a warning in bun.ts); EPIPE stays ignored. Move the process layer, the file helpers, and the kit store to Effect #297, which removes the last legacy caller, routes stream errors through the typed channel (parent File owners). The seam maps a defect of the run, such as that throw, to the same CliError.UserError text and raw failure line as the rejection did. A second acquireTerminal is a typed LeaseHeld failure of the scoped acquire, and a nested withExclusive fails with LeaseReentered before it waits for the permit, so the nested call cannot deadlock. Rejected: keeping the first error and failing at the seam, which lets work run after a failed write.
  • The run (delegated, one line): runEngineNative(argv, options) returns Effect<number, EngineFailure, LoggerService | DependencyManagerService | PlatformService | FileSystem>, where EngineFailure is LegacyStepFailed | LockAcquireError | KitHomeInvalid | LeaseHeld; the aborts are already exit codes. engine.ts yields it and maps each failure, and a defect, to the same CliError.UserError text as now (the original message of the failure or its cause); main.ts runs it in the raw channel with the live layers and BunServices.layer and prints the same raw failure line. Rejected: keeping a services parameter beside the layers, a second way to inject.
  • Locks (delegated, one line): syncDispatch.ts exposes the scoped home lock and the scoped folder locks that homeAndFolderLocks composes. engineSync takes the home lock, then resolves the folders with ompWriteFolders under it, then takes the folder locks, all in one scope, and passes the same folders to the pipeline; it keeps the dry-run skip and maps KitLockHeld to its current held line and exit 1. homeAndFolderLocks stays for the root toggles. The folder creation and the canonical paths of syncDispatch.ts move to FileSystem with the same nearest-existing-ancestor and mode rules: the existence probe of the ancestor walk keeps existsSync in Effect.sync, because FileSystem.exists uses fs.access, which keeps errors other than NotFound and, on Windows, checks a junction itself instead of its target; so the walk goes up as before; canonicalization keeps realpathSync.native behind Effect.try, because the realPath of FileSystem calls the non-native fs.realpath, which resolves .. and names its failures differently (a node: call that FileSystem lacks, parent bridges row); canonicalization and folder creation keep their own failures, and each prints the Node error message that the PlatformError carries as its cause, at the same step as now. The scoped poll takes the options that sync needs to keep its current contention outcome: one last attempt at the deadline, a home-lock deadline that starts before the lock folder is prepared, and the wall clock (Clock.currentTimeMillis, as Date.now() is now) for both sync waits, as acquireKitLock and withKitLocks do now; the folder locks of the root toggles and the root toggles keep their current monotonic poll. withKitLocks is removed; no call to acquireKitLock remains in this child's files.
  • Signals (delegated, from code review round 1 and plan round 8): an in-process interrupt waits until bridged legacy work settles, so no lock scope closes under it. A process signal that the runtime delivers to a listener (on Windows, a forced termination stays as it is) keeps the base behavior, because legacy children cannot be stopped from Effect code until Move the process layer, the file helpers, and the kit store to Effect #297: while an engine run is active, SIGINT or SIGTERM exits the process at once, with 130 or 143 in the raw channel (the current main.ts handlers) and 130 for both in the public channel (the current BunRuntime.runMain interrupt teardown). The public listeners exist only for the duration of the engine run, so other commands keep the normal interrupt. The SQLite locks end with the process, and a running child can outlive the parent, both as at the base; Move the process layer, the file helpers, and the kit store to Effect #297 adds the kill of children on interrupt (parent D2), and then signals can run through the fiber. Rejected: a second signal to exit, which leaves a single parent-only signal waiting on a stuck child; moving the child kill from Move the process layer, the file helpers, and the kit store to Effect #297 into this child, which changes exec.ts.
  • Signal test fixture (delegated, after the second code-review stall and the user's Continue yolo; redesigned in plan round 23): no fixture process sends a signal to a pid or a process group, because Bun reaps a child before its exit callback and a saved id can belong to another process by then. The signals under test come from inside the CLI process: a test-only Bun preload reads a request file and signals its own process, and the listener-order entry signals itself. Cleanup sends no signal: on a control-pipe close the supervisor writes SIGTERM into the request file of its CLI, the stubs exit when their parent is gone or after a relative 90 s limit and write a stub-exited marker on every exit path, and the supervisor writes shutdown-confirmed after the CLI exit and every stub marker. One fixture root per case holds the home, the caches, the stubs, and one launch folder per launch with its own request file, empty at start. Each launch records itself before its CLI starts, and each stub records its pid when it starts. Only the case's teardown removes the root. A stub first takes a ticket by an exclusive create of active/<id> (a unique invocation id) and exits at once without running its body when that fails; it removes its ticket as its last act on every exit path. Teardown closes registration with a non-recursive rmdir of active, retried within its budget, which succeeds only when the folder is empty, and after which no entry can be created in it, also through a path resolved earlier (POSIX rmdir). Teardown removes the root only after every launch of the case has shutdown-confirmed and that rmdir succeeded; an incomplete record counts as unconfirmed, and an unconfirmed root is kept, not left for a sweep. The root has a prefix (docks-kit-signal-fixture-) that no sweep of goldenResources.ts, old or new, matches. A stub that a CLI spawned and that starts only after the removal can only fail: its PATH holds only stubs, its HOME and working directory are inside the removed root, and the working directory has no .env, so no real tool or real configuration is reachable. Rejected: a process-wide working-directory scan, which cannot read every process of the same user (a non-dumpable agent such as ssh-agent) and so cannot prove absence. Teardown waits for confirmation only within its budget; at the deadline it reports the unconfirmed launch and keeps the root, with no signal; no sweep removes it. The CLI entry path is made absolute before the spawn, and every spawned process starts in a fixture-owned working directory with no .env file, because Bun loads a .env of the working directory by default; the CLI gets a PATH with only stubs. Rejected: kills of saved pids or group ids from the worker, the supervisor, or a stub.
  • Cleanup errors (delegated, one line): when a pass fails and a finalizer (terminal release, ledger write, buffered flush) then throws, the seams report the later cleanup error, as the base finally did.
  • Lock retries (delegated, one line): each retry of a sync lock opens and closes its SQLite connection, as the root toggles do since Handle empty OMP tier sections in the fast toggles #284; 2400 such cycles against a held lock took 74 ms with Bun 1.4.5 (a throwaway benchmark, 2026-12-01), about 0.06% of a two-minute wait. Rejected: a shared connection, which needs a new primitive in kitLock.ts (Move the process layer, the file helpers, and the kit store to Effect #297).
  • No version bump: the outputs and exit codes do not change (AGENTS.md, Version bumps).

Steps

# Id Task Files Depends Effect Status Done when
1 bridge Add bridge.ts with bridgeSync, bridgePromise, and LegacyStepFailed, with tests: an interrupt during a bridged Promise ends only after the Promise settles, and a rejection or throw becomes LegacyStepFailed with the step and message cli/src/engine-native/bridge.ts, cli/test/unit/bridge.test.ts - local done the bridge.test.ts cases pass
2 lease Move the lease as the Logger failures decision says: the scoped lease with LeaseHeld, and withExclusive as an Effect with a one-permit Semaphore and LeaseReentered before the wait; keep the immediate rethrow of a write error and the rethrow of the first error after a buffered flush drains; port logger.test.ts, the nested-call and flush regressions included cli/src/engine-native/logger.ts, cli/test/unit/logger.test.ts 1 local done the logger.test.ts cases pass
3 seam Move the seam in one step, with every caller: EngineContext and the engine layers (services.ts, cli/src/services.ts); the typed aborts (parseArgs.ts, parseHelp.ts, modes.ts); runEngineNative, engineSync (the lock order and FileSystem of the Locks decision), ompSync, and modeToolchain as Effects with every call into a later child's code through bridge.ts and the ledger through Effect.sync; KitHomeInvalid and the seam's failure text; engine.ts, main.ts, commands/sync.ts, and commands/toolchain.ts; and the tests that call these APIs, with a new case: an interrupt of a sync during a bridged pass keeps the home and folder locks until the pass settles; folderLockCreate.test.ts provides BunServices.layer cli/src/engine-native/engineCtx.ts, cli/test/unit/folderLockCreate.test.ts, cli/src/engine-native/services.ts, cli/src/services.ts, cli/src/engine-native/parseArgs.ts, cli/src/engine-native/parseHelp.ts, cli/src/engine-native/index.ts, cli/src/engine-native/syncDispatch.ts, cli/src/engine-native/ompSync.ts, cli/src/engine-native/modes.ts, cli/src/engine-native/failures.ts, cli/src/engine.ts, cli/src/main.ts, cli/src/commands/sync.ts, cli/src/commands/toolchain.ts, cli/test/unit/engine-di.test.ts, cli/test/unit/envGlobals.test.ts, cli/test/unit/syncLock.test.ts, cli/test/unit/services.test.ts, cli/test/unit/engine.test.ts, cli/test/unit/ompPluginInventory.test.ts, cli/test/unit/ompRemovals.test.ts, cli/test/unit/toolchain.test.ts, cli/test/lib/engineRun.ts, cli/test/unit/syncSignals.test.ts, cli/test/lib/signalSupervisor.ts, cli/test/lib/signalEngineEntry.ts, cli/test/lib/signalSelfPreload.ts, cli/test/lib/supervisedRun.ts, cli/test/lib/goldenResources.ts, cli/test/unit/syncPipelineFailure.test.ts 2 local done unit, toggles, red-dry, and red-mut pass, and bun run golden:dryrun && bun run golden:mutation print OK
4 guidance Update the guidance to the Effect seam: the ExitError, dispatch, and lock-release rules, the failure-path probe (it points to the Effect handler of a failed pipeline), the run signature and lock helpers, the ompSync anchor, the lock lines of sync in tidy-context and sync-orchestration-context, and the parser and service-wiring entries and the pipeline failure-output paragraph of DESIGN.md, the dispatch pointers of omp-sync-context, and the withExclusive line of host-platform-context (the lease API that this child changes) .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/host-platform-context/SKILL.md, cli/src/engine-native/DESIGN.md 3 local done guidance passes

Acceptance

ID Command Expected
deps bun install --frozen-lockfile in the linked worktree Exit 0
unit bun x --no-install vitest run --reporter=verbose cli/test/unit/bridge.test.ts cli/test/unit/logger.test.ts cli/test/unit/services.test.ts cli/test/unit/engine-di.test.ts cli/test/unit/envGlobals.test.ts cli/test/unit/syncLock.test.ts cli/test/unit/engine.test.ts cli/test/unit/ompPluginInventory.test.ts cli/test/unit/ompRemovals.test.ts cli/test/unit/toolchain.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/argv.test.ts cli/test/unit/goldenProveRed.test.ts cli/test/unit/syncPipelineFailure.test.ts Exit 0, with the interrupt cases of steps 1 and 3, the nested-call case of step 2, and goldenProveRed.test.ts, which shows that an invariant-only failure is not proof
goldens On the reviewed commit with git status --porcelain empty: bun run golden:dryrun && bun run golden:mutation && git diff --exit-code --merge-base origin/main HEAD -- cli/test/goldens Both suites OK; no golden changed
red-dry bun run golden:dryrun --prove-red Exit 1; prints prove-red OK: golden-dryrun
red-mut bun run golden:mutation --prove-red Exit 1; prints prove-red OK: golden-mutation
scan git grep -nE -e '^[[:space:]]*([^/*[:space:]].*)?Promise<' -e '^[[:space:]]*([^/*[:space:]].*)?async ' -e '^[[:space:]]*([^/*[:space:]].*)?ExitError' -e '^[[:space:]]*([^/*[:space:]].*)?Effect\.run' -e '^[[:space:]]*([^/*[:space:]].*)?\bthrow\b' -- cli/src/engine-native/index.ts cli/src/engine-native/engineCtx.ts cli/src/engine-native/logger.ts cli/src/engine-native/parseArgs.ts cli/src/engine-native/parseHelp.ts cli/src/engine-native/failures.ts cli/src/engine-native/syncDispatch.ts cli/src/engine-native/ompSync.ts cli/src/engine-native/modes.ts cli/src/engine.ts Matches only executable lines: the bunRuntime Promise memo in engineCtx.ts (#298), and in logger.ts the two rethrows of writeIgnoringEpipe and the rethrow after flushDurable drains (#297)
guidance git grep -n -e 'ExitError' -e 'goes in .finally' -e 'in finally' -e 'async function ompSync' -e 'early-exit error' -e 'withKitLocks' -e 'withSyncLock' -e 'withFolderLocks' -e 'runEngineNative(argv, services' -e 'runEngineNative(rawArgs, undefined' -e 'runEngineNative(args, services' -e 'makeCtx(services' -e 'default service factory returns a raw Logger' -e 'shared raw-Logger' -e 'skips .prepareArgv. and Effect' -e 'then rethrows it' -e 'prints the "--- Failures ---" ledger and' -e 'A rejected pipeline skips the summary' -e 'When the pipeline rejects' -- .agents/skills cli/src/engine-native/DESIGN.md; git grep -n -e 'acquireKitLock' -- .agents/skills/tidy-context/SKILL.md .agents/skills/sync-orchestration-context The first command exits 1; the second names acquireKitLock only as the lock of tidy --apply, not of sync; git grep -c 'ledger only when entries were recorded and the cause is not interrupt-only' -- cli/src/engine-native/DESIGN.md .agents/skills/sync-orchestration-context/SKILL.md .agents/skills/sync-orchestration-context/references/dispatch-flow.md names all three files, each with one match, so each passage states both conditions: a failed pipeline skips the summary, and prints the ledger only when entries were recorded and the cause is not interrupt-only
signals bun x --no-install vitest run --reporter=verbose cli/test/unit/syncSignals.test.ts Exit 0; on Linux and macOS, spawned CLI cases that wait until a stub omp or bun child of a sync runs, send one SIGTERM (and one SIGINT) to the CLI process only, and assert exit 130 in the public channel and 143 (130 for SIGINT) in the raw channel within a short bound, and that the next sync takes the lock; on Windows the cases skip, because Bun's ChildProcess.kill force-terminates instead of delivering the signal
toggles bun x --no-install vitest run --reporter=verbose cli/test/unit/rootFlags.test.ts cli/test/unit/ompFastMode.test.ts Exit 0, with the spawned --fast and --ultrafast cases, which change tier.openai and keep the other settings of config.yml
dry ./docks-kit sync --dry-run Exit 0
types bun run check:types Exit 0
ci-tools bun cli/scripts/verify-ci-tools.ts Exit 0
smoke bun run smoke:package Exit 0
gate bun run check Exit 0

Do not touch

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. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 1

    Plan-review: repair

    • goal_fit - Research Locks; step dispatch - syncDispatch.ts:117–121,272–286 currently takes the home lock before ompWriteFolders probes for the XDG data root. homeAndFolderLocks takes an already-computed folder array at syncDispatch.ts:252–264. Inference: passing the resolved folders to that helper as written lets a waiting sync select the old root before another process creates the XDG root. It can then run against the old root and report that the root moved, where the current sync would select the new root after acquiring the home lock - Defer folder discovery until the home lock is held and pass that same result to the pipeline. Preserve the root tier command's existing lock behavior at commands/root.ts:95–100 - class: scoped lock cutover moves path discovery before its lock
    • goal_fit - Research Locks and The run; step dispatch - Parent Move the engine-native layer to Effect #290 requires filesystem work through FileSystem. Reusing the current scoped helper leaves mkdirSync, existsSync, and realpathSync.native in Move the engine seam and the sync orchestration to Effect #294-owned syncDispatch.ts:67–75,123–145,220–224; D4 exempts the synchronous SQLite lock primitives, not these operations. The Effect FileSystem service provides the needed operations, and no later child owns this code - Move folder creation and canonicalization to FileSystem in this child, preserving the nearest-existing-ancestor and mode rules. Wire the service into the raw entry and affected tests - class: owned filesystem operations left outside the Effect migration
    • goal_fit - Research The run and Locks; steps lease and dispatch; Do not touch, outputs - The existing boundaries display the underlying error detail (engine.ts:24–45, main.ts:47–54). Routing the new LockAcquireError.message directly to them adds cannot take the lock … to a lock-open failure (syncDispatch.ts:196–201). Also, makeCtx calls kitHome(), which throws for a missing manifest under an explicit DOCKS_KIT_HOME (engineCtx.ts:43–49, kitHome.ts:16–42). If that call simply moves into Effect.sync, the Effect API makes it a defect, so typed-error mapping in the public command no longer produces the existing CliError.UserError. The logger's non-EPIPE throw paths (logger.ts:54–65,103–115,122–123) likewise have no assigned cutover to the parent's no-throws contract - Specify how known synchronous failures enter the error channel, preserve the existing raw and public details, and keep the tier command's lock diagnostic and the logger's EPIPE behavior - class: typed error cutover leaves existing failure paths or diagnostics unmapped
    • goal_fit - Research Intended aborts; steps aborts and dispatch - Parent Move the engine-native layer to Effect #290 D5 explicitly puts help, usage, and validation aborts in the typed error channel. The child instead makes help a success and names only two failures. In addition, modes.ts:19–37,59–62 has four usage-refusal branches that still return 2 as a successful value under the stated plan. Raw sync --help and toolchain check extra must keep their text and exit codes, but they would not take the typed abort path D5 requires - Carry help and every engine usage refusal through the typed channel, then translate them to the existing text and codes at the boundary - class: child abort mapping contradicts the parent decision
    • goal_fit - Research The terminal lease; step lease - logger.ts:134–137 rejects re-entry, and cli/test/unit/logger.test.ts:99–106 checks that a nested call fails and the next call still runs. The Semaphore API waits for a permit and returns it when the outer effect finishes. Inference: serializing with one permit alone deadlocks when the outer action awaits a nested action - Preserve the re-entry refusal before waiting for a permit and retain the existing regression when porting the test - class: semaphore replacement loses the re-entry guard
    • goal_fit - Research Tests that call the seam; step tests, Files; Acceptance unit - engine.test.ts:43,87–110 mocks Promise results and the old three-argument call. ompPluginInventory.test.ts:183–186, ompRemovals.test.ts:121–122, and toolchain.test.ts:202,226,268 directly await APIs this child turns into Effects. Leaving those files out means some tests compare an Effect with a number, while the removals test never runs the pipeline it intends to check - Include all four suites in the caller cutover and run their migrated cases in unit - class: caller left on a replaced API
    • goal_fit - Steps lease, aborts, dispatch, and tests; Acceptance unit - The earlier steps require unit to pass before the steps it needs can start. Removing the ExitError export in aborts leaves live imports in index.ts:15 and syncDispatch.ts:29 until dispatch; then dispatch changes the seam before tests updates the Promise calls in engine-di.test.ts:166,186. The declared dependencies prevent reaching a passing intermediate state - Group each breaking API change with its callers or make the shared unit check a completion condition only after the caller cutover - class: step completion check requires a dependent step
    • goal_fit - Acceptance scan; Research The run context - The scan requires no Promise< match in engineCtx.ts, but engineCtx.ts:20 holds the memoized Promise that Move the toolchain passes to Effect #298-owned bun.ts:63–67 reads and writes. A correct Move the engine seam and the sync orchestration to Effect #294 cutover returns a match; changing that field now breaks the parent split - Make scan reject legacy execution in Move the engine seam and the sync orchestration to Effect #294's converted paths while explicitly allowing the Bun memo field until Move the toolchain passes to Effect #298 removes it - class: acceptance rejects a legacy boundary the parent requires
    • goal_fit - Step dispatch, Done when; Acceptance goldens - Parent Move the engine-native layer to Effect #290 requires the no-golden-change comparison on the reviewed child commit. The child puts it in a step-completion check without that condition. Git's two-revision diff ignores working-tree changes, so regenerated but uncommitted goldens can make both suites pass while the HEAD comparison still reports no change - Keep the comparison in goldens and require it on the exact reviewed commit - class: acceptance compares a revision other than the candidate under test
    • goal_fit - Acceptance unit, red-dry, and red-mut - .agents/skills/engine-native-context/SKILL.md:60–66 requires the separate goldenProveRed.test.ts check that an invariant-only failure does not count as proof. Neither prove-red invocation checks that case. The full gate includes the test, but the plan contract requires the repository-mandated check and its expected result to be named in Acceptance - Include the existing test and its required result in unit - class: required repository verification not named in Acceptance
    • goal_fit - Research Skill text to change; step skills; Acceptance skills; Do not touch - The cutover leaves active guidance on the removed paths. .agents/skills/tidy-context/SKILL.md:73 still identifies acquireKitLock as sync's lock API, and cli/src/engine-native/DESIGN.md:175 still directs readers to the removed parser re-export. In the listed dispatch reference, line 80 finds the pipeline only if it is still declared export async function ompSync. The skills scan can pass with all three references stale - Include the narrow guidance changes in this cutover, leaving Move the process layer, the file helpers, and the kit store to Effect #297's remaining lock and design work in place, and make skills check the removed references it is meant to catch - class: active guidance still points to the replaced implementation
  4. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 2, delta

    Plan-review: repair

    • goal_fit - Research Locks and The run; step seam, Files; Acceptance unit - The shared lock helpers now need FileSystem, but the declared engine environment omits it. The raw branch runs before the public BunServices.layer is provided (cli/src/main.ts:38–54,66–75). Also, cli/test/unit/folderLockCreate.test.ts:56,78,101,135 runs homeAndFolderLocks directly without a filesystem provider. As written, the raw mutation run and direct lock tests cannot run the migrated helper with their stated dependencies - Declare FileSystem in the engine environment, provide it at the raw entry, and add folderLockCreate.test.ts to the seam cutover so it supplies the real filesystem layer - class: new service requirement not wired through existing callers
    • goal_fit - Research Logger failures; steps lease and seam; Do not touch, outputs - A synchronous non-EPIPE write failure currently escapes the logger (cli/src/engine-native/logger.ts:54–76). In cli/src/engine-native/bun.ts:94–103, the warning precedes temp-directory creation and the installer call. Under the recorded keep-and-report policy, that warning can fail and the installer can still run before the seam returns exit 1. Checking after each bridge does not fix this case because the warning and installation happen inside the same bridge - Preserve fail-before-mutation behavior at the affected legacy call sites rather than only reporting a saved failure at the seam - class: deferred error permits work that the old failure stopped
    • goal_fit - Research The run, Known synchronous failures, and Logger failures - The declared error channel allows only LegacyStepFailed | LockAcquireError, but the new decisions say KitHomeInvalid and OutputWriteFailed reach the boundary as typed failures. The scoped acquire also introduces LeaseHeld. For example, an invalid explicit kit home fails in cli/src/kitHome.ts:16–29, and cli/src/engine.ts:38–45 currently uses that failure to produce the public diagnostic. Effect's error type cannot carry these additional failures under the stated signature unless the plan explicitly translates them first - Reconcile the published error union with the failures that reach the CLI, and name any translations that preserve the original diagnostics - class: declared error channel excludes required failures
    • goal_fit - Research Locks; step seam; Do not touch, locks and exit codes - The existing scoped poll checks the deadline immediately after sleeping and returns held without retrying (cli/src/engine-native/syncDispatch.ts:229–239). The sync poll tries once more before checking the deadline (cli/src/engine-native/kitLock.ts:136–145). Inference: if the holder releases during the final sleep and the waiter wakes at the deadline, sync can acquire the lock today but returns 1 after the proposed shared-poll cutover - Preserve sync's last-attempt behavior in the scoped implementation without silently changing the root toggles' current behavior - class: scoped lock cutover changes the contention outcome
    • research_gap - Research Locks and Known synchronous failures - The two existence probes are not equivalent. canonicalFolder currently treats a false existsSync result as a reason to walk up (cli/src/engine-native/syncDispatch.ts:126–133). In Effect 4.1.7, FileSystem.make derives exists from access and turns only NotFound into false (node_modules/effect/src/FileSystem.ts:567–583); the installed provider maps ENOTDIR to BadResource (node_modules/@effect/platform-node-shared/src/internal/utils.ts:12–39). Inference: with a regular file where an ancestor directory should be, the old sync reaches the folder-creation error, while a direct FileSystem.exists substitution fails earlier with an access error - Specify the equivalent ancestor walk and preserve the original filesystem diagnostic when mapping the typed failure - class: filesystem substitution changes failure semantics
    • goal_fit - Research Known synchronous failures; parent Move the engine-native layer to Effect #290 Acceptance bridges - The new permanent Effect.try wraps kitHome(), a first-party resolver that reads and parses the kit manifest (cli/src/kitHome.ts:1–19,85–99). The parent's final scan allows runtime and third-party adapters, and no later child is assigned to remove or convert this wrapper. It would still match after Move the process layer, the file helpers, and the kit store to Effect #297 and fail the stated acceptance rule - Record this specific boundary adapter in the parent's allowed set, or assign ownership for a typed resolver that removes the wrapper - class: permanent adapter violates the parent's final acceptance rule
    • goal_fit - Step seam, Done when; step guidance, Depends; Acceptance goldens - The clean reviewed-commit comparison fixes the dirty-tree false pass, but seam now requires it before guidance may start. The plan-manager workflow requires step proofs before marking steps done and implementation to finish before candidate code review (SoT/.omp/plugin/skills/plan-manager/SKILL.md:112–144). The exact reviewed commit cannot include guidance while that step is waiting for proof on that commit - Use golden suite results as the step proof and keep the clean reviewed-commit comparison as separate acceptance evidence - class: step completion check requires a dependent step
    • goal_fit - Acceptance guidance; step guidance - The scan can pass after removing the named literals while leaving cli/src/engine-native/DESIGN.md:175 saying the parser re-exports the “early-exit error.” It can also leave the old runEngineNative signature and removed lock helpers in .agents/skills/sync-orchestration-context/SKILL.md:139,214–216,244–256 and references/dispatch-flow.md:29–34,51–66. None of those stale anchors matches the planned patterns - Make the existing row check the actual parser wording and the obsolete signatures and helper names in the files it covers - class: guidance check passes with obsolete instructions still present
    • goal_fit - Step guidance, Files; Do not touch; parent Move the engine-native layer to Effect #290 File owners - The repair assigns Move the engine seam and the sync orchestration to Effect #294 the parser row of DESIGN.md, the sync lock row of .agents/skills/tidy-context/SKILL.md, and the sync lock guidance that names acquireKitLock in .agents/skills/sync-orchestration-context/SKILL.md. The parent's Move the process layer, the file helpers, and the kit store to Effect #297 row still owns all three, while this child excludes later-owned work. Following the child step edits those lines; following the recorded split leaves the same-PR guidance cutover incomplete - Transfer those specific lines to Move the engine seam and the sync orchestration to Effect #294 in the parent and leave the remaining design and lock guidance with Move the process layer, the file helpers, and the kit store to Effect #297 - class: repair crosses the parent file-ownership split
    • goal_fit - Research Locks; step seam; Acceptance unit and goldens - The repaired plan changes the folder-lock code used by the public --fast and --ultrafast commands (cli/src/commands/root.ts:94–101). No row names an end-to-end result for either toggle. The direct lock tests do not start the CLI, and the generic gate only names exit 0 - Include the existing spawned cases in cli/test/unit/rootFlags.test.ts:87–111,146–173 in Acceptance and name the expected tier change and preservation of unrelated config - class: changed CLI path lacks an end-to-end acceptance result

    Previous findings:

    • Round-1 finding on Research Locks; step dispatch: resolved - Locks now puts ompWriteFolders after home-lock acquisition and passes the same folders to the pipeline.
    • Round-1 finding on Research Locks and The run; step dispatch: open - repeated above. The filesystem operations are assigned, but the provider cutover is incomplete.
    • Round-1 finding on Research The run and Locks; steps lease and dispatch; Do not touch, outputs: open - repeated above.
    • Round-1 finding on Research Intended aborts; steps aborts and dispatch: resolved - The decision puts help, all four modes.ts refusals, unknown args, and invalid lock wait in the typed channel before translating them to their original codes.
    • Round-1 finding on Research The terminal lease; step lease: resolved - Logger failures requires LeaseReentered before the semaphore wait, and lease retains the nested-call regression.
    • Round-1 finding on Research Tests that call the seam; step tests, Files; Acceptance unit: open - repeated above. All four originally named suites are included; the newly affected direct lock suite still has no edit.
    • Round-1 finding on steps lease, aborts, dispatch, and tests; Acceptance unit: open - repeated above. The original unit-proof ordering is repaired, but the reviewed-commit golden proof now depends on the next step.
    • Round-1 finding on Acceptance scan; Research The run context: resolved - scan explicitly expects the one bunRuntime Promise memo until Move the toolchain passes to Effect #298 removes it.
    • Round-1 finding on step dispatch, Done when; Acceptance goldens: resolved - The comparison now specifies a clean checkout of the reviewed commit.
    • Round-1 finding on Acceptance unit, red-dry, and red-mut: resolved - unit includes goldenProveRed.test.ts and names the invariant-only result.
    • Round-1 finding on Research Skill text to change; step skills; Acceptance skills; Do not touch: open - repeated above. The affected guidance is listed, but the scan can miss it and the parent ownership still conflicts.

    Manager response to round 1

    Repaired:

    • Lock order: the Locks decision now takes the home lock, then resolves the folders with ompWriteFolders under it, then takes the folder locks, in one scope; homeAndFolderLocks stays for the root toggles.
    • FileSystem: the folder creation and canonical paths of syncDispatch.ts move to FileSystem with the same nearest-existing-ancestor and mode rules.
    • Failure paths: a new decision keeps kitHome() and the other throwing calls in Effect.try with typed errors that keep their message, and the seam prints the same detail; a new Logger failures decision removes the logger throws (the kept first write error and OutputWriteFailed, LeaseHeld, LeaseReentered), with EPIPE still ignored.
    • Aborts: help, every usage refusal (the four modes.ts branches included), and the lock-wait refusal are typed failures, as parent D5 says.
    • Re-entry: withExclusive fails with LeaseReentered before it waits for the permit; the nested-call regression stays.
    • Callers: step 3 now holds engine.test.ts, ompPluginInventory.test.ts, ompRemovals.test.ts, and toolchain.test.ts, and unit runs them.
    • Steps: the breaking changes and their callers are one step (seam); bridge and lease each pass their own tests; guidance follows.
    • Bun memo: the scan row allows the one bunRuntime Promise field of engineCtx.ts, which Move the toolchain passes to Effect #298 removes.
    • Goldens: the row runs on the reviewed commit with a clean status.
    • Prove-red: unit runs goldenProveRed.test.ts.
    • Guidance: step 4 adds the tidy-context lock row, the DESIGN.md parser line, and the ompSync anchor of dispatch-flow.md, and the guidance row checks them.

    Rejected: none.

    Redesigned: none.

  5. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 3, delta

    Plan-review: repair

    • goal_fit - Move the engine seam and the sync orchestration to Effect #294 plan-review-294-round-3.md, Research Locks and The run; step seam; Acceptance unit - The round-3 export still omits the filesystem wiring named in the repair record. The raw branch runs before the public BunServices.layer is provided (cli/src/main.ts:38–54,66–75), and the direct homeAndFolderLocks calls have no provider (cli/test/unit/folderLockCreate.test.ts:56,78,101,135). The migrated helper cannot run on either path as written - Declare FileSystem in the engine environment, provide it at the raw entry, and include the direct lock test in the seam cutover with a real filesystem layer - class: new service requirement not wired through existing callers
    • goal_fit - Research Logger failures; steps lease and seam; Acceptance scan - The child still saves the first write error and reports it later. Today a synchronous non-EPIPE warning failure stops execution before the installer (cli/src/engine-native/logger.ts:54–66, cli/src/engine-native/bun.ts:94–103). Under the exported plan, installation can begin before the saved failure is reported. Parent Move the engine-native layer to Effect #290 round 6 throws now allows the immediate rethrow, but the child still calls it forbidden and its own scan rejects it - Keep the immediate rethrow, map it at the seam to the existing diagnostic, and update step lease and scan to match - class: deferred error permits work that the old failure stopped
    • goal_fit - Research The run, Known synchronous failures, and Logger failures - The declared Effect error channel allows only LegacyStepFailed | LockAcquireError. The child also requires typed KitHomeInvalid, LeaseHeld, and OutputWriteFailed without translating them. For example, an invalid explicit kit home must retain the error detail from cli/src/kitHome.ts:16–29 that cli/src/engine.ts:38–45 reports today - Include KitHomeInvalid and LeaseHeld in the boundary error union and remove OutputWriteFailed when restoring the immediate rethrow. Preserve the existing failure text - class: declared error channel excludes required failures
    • goal_fit - Research Locks; step seam; Do not touch, locks and exit codes - The scoped poll returns held immediately after waking at the deadline (cli/src/engine-native/syncDispatch.ts:229–239); the sync poll tries once more first (cli/src/engine-native/kitLock.ts:136–145). Inference: if the holder releases during the last sleep and the waiter wakes at the deadline, current sync can acquire the lock, but the proposed cutover can return 1 - Specify sync's final attempt in the scoped implementation without changing the existing root-toggle outcome - class: scoped lock cutover changes the contention outcome
    • research_gap - Research Locks and Known synchronous failures - canonicalFolder walks up when existsSync returns false (cli/src/engine-native/syncDispatch.ts:126–133), but the Effect filesystem only converts NotFound to false (node_modules/effect/src/FileSystem.ts:574–583). The pinned provider maps ENOTDIR to BadResource (node_modules/@effect/platform-node-shared/src/internal/utils.ts:12–39). Inference: a regular file in an ancestor position currently reaches the folder-creation error; a direct substitution fails earlier with an access error - Specify the equivalent ancestor walk and map filesystem failures to the original diagnostic - class: filesystem substitution changes failure semantics
    • goal_fit - Step seam, Done when; step guidance, Depends; Acceptance goldens - Step seam still requires the reviewed-commit goldens row before guidance can start. The workflow requires step proof before marking a step done and completes implementation before candidate review (SoT/.omp/plugin/skills/plan-manager/SKILL.md:112–144). The reviewed candidate therefore cannot contain guidance when that proof is due - Use the golden suite results as step proof and keep the clean reviewed-commit comparison as separate acceptance evidence - class: step completion check requires a dependent step
    • goal_fit - Step guidance; Acceptance guidance - Removing only the checked literals can leave the parser's “early-exit error” (cli/src/engine-native/DESIGN.md:175), the old run signature and lock helpers (.agents/skills/sync-orchestration-context/SKILL.md:139,192,214–216,244–256), and the old calls and finally release (.agents/skills/sync-orchestration-context/references/dispatch-flow.md:29–34,51–76). The row can still pass while those instructions point to removed APIs - Make the existing row check these stale anchors in the files the step updates - class: guidance check passes with obsolete instructions still present
    • goal_fit - Research Locks; step seam; Acceptance unit and goldens - The seam changes the lock path used by both public tier toggles (cli/src/commands/root.ts:94–101). The export still has no row that names an end-to-end result for either flag. Direct lock tests do not launch the CLI, and the generic gate only names exit 0 - Include the spawned --fast and --ultrafast cases in cli/test/unit/rootFlags.test.ts:87–111,146–173 and name the tier changes and preservation of unrelated config - class: changed CLI path lacks an end-to-end acceptance result

    Previous findings:

    • Round-2 finding on Research Locks and The run; step seam, Files; Acceptance unit: open - repeated above.
    • Round-2 finding on Research Logger failures; steps lease and seam; Do not touch, outputs: open - repeated above.
    • Round-2 finding on Research The run, Known synchronous failures, and Logger failures: open - repeated above.
    • Round-2 finding on Research Locks; step seam; Do not touch, locks and exit codes: open - repeated above.
    • Round-2 finding on Research Locks and Known synchronous failures: open - repeated above.
    • Round-2 finding on Research Known synchronous failures; parent Move the engine-native layer to Effect #290 Acceptance bridges: resolved - the supplied round-6 parent export explicitly allows the synchronous kitHome() adapter.
    • Round-2 finding on step seam, Done when; step guidance, Depends; Acceptance goldens: open - repeated above.
    • Round-2 finding on Acceptance guidance; step guidance: open - repeated above.
    • Round-2 finding on step guidance, Files; Do not touch; parent Move the engine-native layer to Effect #290 File owners: resolved - the supplied round-6 parent export assigns Move the engine seam and the sync orchestration to Effect #294 the parser line and the sync lock guidance in both skills, leaving the remaining design and tidy guidance with Move the process layer, the file helpers, and the kit store to Effect #297.
    • Round-2 finding on Research Locks; step seam; Acceptance unit and goldens: open - repeated above.

    Manager response to round 2

    Repaired:

    • FileSystem wiring: the run's environment names FileSystem; main.ts provides BunServices.layer in the raw channel, and folderLockCreate.test.ts joins step 3 with that layer.
    • Fail before later work: the logger keeps its throw on a write error that is not EPIPE, so no later work runs; the seam maps that defect to the same text. The parent throws row now names this adapter (parent edit, reviewed in parent round 6).
    • Error union: EngineFailure is LegacyStepFailed | LockAcquireError | KitHomeInvalid | LeaseHeld, and the seam maps each, and a defect, to the current text.
    • Last attempt: the scoped poll makes one last attempt at the deadline, as the sync poll does now; the root toggles get it too, which changes an outcome only when the holder ends within the last poll interval.
    • Ancestor walk: it goes up on NotFound and on ENOTDIR, as existsSync did, and a failure prints the Node error message that the PlatformError carries.
    • kitHome() adapter: the parent bridges row now allows Effect.try around the synchronous resolver kitHome() (parent edit).
    • Step proof: step 3 is done on unit, toggles, both prove-red rows, and both golden suites; the clean reviewed-commit comparison stays in goldens.
    • Guidance scan: the row now also checks early-exit error, withKitLocks, and the old runEngineNative(argv, services signature, and acquireKitLock in sync-orchestration-context.
    • Ownership: the parent File owners table now gives Move the engine seam and the sync orchestration to Effect #294 the sync lock lines of tidy-context and sync-orchestration-context and the parser line of DESIGN.md (parent edit).
    • Toggles: the new toggles row runs the spawned --fast and --ultrafast cases of rootFlags.test.ts and ompFastMode.test.ts.

    Rejected: none.

    Redesigned: none.

  6. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 4, delta

    Plan-review: repair

    • goal_fit - Research Locks; step seam; Do not touch, locks and exit codes - The final retry is fixed, but the shared poll still starts the home-lock timer at a different point. cli/src/engine-native/kitLock.ts:83–90,129–145 starts it before directory preparation and database open; cli/src/engine-native/syncDispatch.ts:221–239 starts it after preparation. Inference: if preparation uses up the wait bound and the first attempt is busy, current sync returns 1, but the proposed poll can wait again and succeed - For sync, start the home-lock deadline before preparation. Keep the existing start point for folder locks and root toggles - class: scoped lock cutover changes the contention outcome
    • research_gap - Research Locks and Known synchronous failures - Handling NotFound and ENOTDIR fixes the regular-file case, but does not preserve the old existence probe. cli/src/engine-native/syncDispatch.ts:126–133 walks up on a false result, and the pinned Bun implementation returns false on probe errors. The Effect probe preserves errors other than NotFound (node_modules/effect/src/FileSystem.ts:574–583), including ELOOP (node_modules/@effect/platform-node-shared/src/internal/utils.ts:24–37). Inference: with a symlink loop above the agent folder, current sync walks up and reports the failure from folder creation; the proposed walk stops at the access error. Printing its cause still reports a different operation - Preserve the old boolean behavior for the existence probe, and report errors from canonicalization or directory creation where they occurred before - class: filesystem substitution changes failure semantics
    • goal_fit - Step guidance; Acceptance guidance - The revised grep can still pass with the old withSyncLock and withFolderLocks calls and the claim that raw mode skips Effect (.agents/skills/sync-orchestration-context/SKILL.md:3,136,192,214,246,301). It also misses the three-argument raw and public examples and releaseKitLock of each lock in finally (.agents/skills/sync-orchestration-context/references/dispatch-flow.md:29–34,58–76). The new plain factory pattern matches neither service-wiring passage it is meant to check (cli/src/engine-native/DESIGN.md:165–168,190) - Make the existing row reject these actual obsolete forms in the guidance the step owns - class: guidance check passes with obsolete instructions still present
    • goal_fit - Research Logger failures and Other facts; step lease; Acceptance scan - The scan allows only the two writeIgnoringEpipe rethrows, but it also matches that function's synchronous throw comment (cli/src/engine-native/logger.ts:50–66) and the first-error rethrow after flushDurable drains the queue (logger.ts:104–116). The ported test requires later queued writes to drain and the original error to propagate (cli/test/unit/logger.test.ts:208–226). Keeping that behavior with the current flush rethrow fails the scan; dropping the rethrow without equivalent propagation fails the test - Match executable code only, and specify how the Effect lease propagates the first flush error after draining, or explicitly allow that rethrow - class: source scan rejects retained logger behavior

    Previous findings:

    • Round-3 finding on Move the engine seam and the sync orchestration to Effect #294 Research Locks and The run; step seam; Acceptance unit: resolved - plan-review-294-round-4.md adds FileSystem to the run environment, provides BunServices.layer in raw mode, and assigns the direct lock tests that layer.
    • Round-3 finding on Research Logger failures; steps lease and seam; Acceptance scan: resolved - The plan restores the immediate non-EPIPE rethrow and preserves the boundary diagnostic. The scan's separate flush mismatch is listed above.
    • Round-3 finding on Research The run, Known synchronous failures, and Logger failures: resolved - EngineFailure includes KitHomeInvalid and LeaseHeld, and the plan removes OutputWriteFailed.
    • Round-3 finding on Research Locks; step seam; Do not touch, locks and exit codes: open - repeated above. Sync gets its final attempt back, but the home-lock timer still starts later.
    • Round-3 finding on Research Locks and Known synchronous failures: open - repeated above. The ENOTDIR case is covered, but other false existence results can still change the diagnostic.
    • Round-3 finding on step seam, Done when; step guidance, Depends; Acceptance goldens: resolved - seam uses the golden suite results as step proof and leaves the reviewed-commit comparison in goldens.
    • Round-3 finding on step guidance; Acceptance guidance: open - repeated above.
    • Round-3 finding on Research Locks; step seam; Acceptance unit and goldens: resolved - toggles runs the spawned --fast and --ultrafast cases and names the tier change and preservation of unrelated config.

    Manager response to round 3

    Repaired:

    • The round-2 repairs did not reach the issue: the earlier edit was not published. This round publishes them, with these changes:
    • Logger: the immediate rethrow stays; Move the process layer, the file helpers, and the kit store to Effect #297 owns the final cutover (parent File owners); OutputWriteFailed is gone; step lease and the scan row allow the two rethrows of writeIgnoringEpipe.
    • Last attempt: the scoped poll takes an option for one last attempt at the deadline; sync sets it, and the root toggles keep their current poll.
    • kitHome(): a bridge until Move the process layer, the file helpers, and the kit store to Effect #297 moves the resolver.
    • Guidance: the step and the row now also cover the run signature, the lock helpers, and the service-wiring entry of DESIGN.md (plain factory).
    • The other round-2 repairs (the FileSystem wiring and folderLockCreate.test.ts, the error union, the ancestor walk, the step proof, and the toggles row) are now in the body.

    Rejected: none.

    Redesigned: none.

  7. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 5, delta

    Plan-review: repair

    • goal_fit - Research Locks; step seam; Do not touch, locks and exit codes - The repair fixes when the home-lock timer starts, but not which clock it uses. Both sync locks use Date.now() today (cli/src/engine-native/syncDispatch.ts:94–101, kitLock.ts:125–145); the shared scoped poll uses monotonic time (syncDispatch.ts:225–239). Inference: if the wall clock jumps forward while a lock is held, the old sync can exhaust its wait and exit 1 while the scoped sync keeps polling and acquires the lock - Use Clock.currentTimeMillis for both sync waits. Keep the root toggles' monotonic poll - class: scoped lock cutover changes the contention outcome
    • research_gap - Research Locks and Known synchronous failures; step seam - The existence probe is fixed, but the live FileSystem.realPath calls non-native fs.realpath on POSIX (node_modules/@effect/platform-node-shared/src/NodeFileSystem.ts:557–564), while cli/src/engine-native/syncDispatch.ts:126–133 uses realpathSync.native. Pinned Bun normalizes .. before non-native resolution and labels failures lstat instead of realpath. Inference: PI_CONFIG_DIR=link/../config reaches the resolver unchanged (ompPaths.ts:61–76); if link points outside HOME and both candidate folders exist, the cutover can lock the folder under HOME instead of the shared folder. A failed lookup also prints a different diagnostic even when the seam unwraps the cause - Preserve native realpath semantics and its original error through the lock filesystem adapter - class: filesystem substitution changes failure semantics
    • goal_fit - Step guidance; Acceptance guidance - The revised grep catches the obsolete helper names, call signatures, and service-wiring text, but it still accepts the claim that raw mode skips Effect (.agents/skills/sync-orchestration-context/SKILL.md:136) and the Promise rejection and rethrow instructions (SKILL.md:198–204, references/dispatch-flow.md:69–72). The row can pass with those passages unchanged even though the raw branch now runs an Effect and the pipeline propagates failures through it - Make the existing row reject those stale instructions. Raw mode bypasses CLI parsing, not Effect - class: guidance check passes with obsolete instructions still present

    Previous findings:

    • Round-4 finding on Research Locks; step seam; Do not touch, locks and exit codes: open - repeated above. The timer now starts before home-lock preparation, but the clock still differs.
    • Round-4 finding on Research Locks and Known synchronous failures: open - repeated above. The ancestor walk now treats probe failures as false, but the resolver still changes lock paths and diagnostics.
    • Round-4 finding on step guidance; Acceptance guidance: open - repeated above.
    • Round-4 finding on Research Logger failures and Other facts; step lease; Acceptance scan: resolved - lease retains the drain and first-error rethrow, and scan excludes the JSDoc match and allows that rethrow.

    Manager response to round 4

    Repaired:

    • Home-lock deadline: the scoped poll takes the options that keep sync's outcome: the last attempt at the deadline, and a home-lock deadline that starts before the lock folder is prepared; the folder locks and the root toggles keep their current poll.
    • Existence probe: the ancestor walk treats every failure of FileSystem.exists as false, as Bun's existsSync does; canonicalization and folder creation keep their own failures and steps.
    • Guidance scan: the row now rejects withSyncLock, withFolderLocks, in finally, the three-argument runEngineNative and makeCtx(services examples, and the two service-wiring sentences of DESIGN.md.
    • Logger scan: the row matches executable lines only, and allows the rethrow after flushDurable drains, which step lease keeps with its regression.

    Rejected: none.

    Redesigned: none.

  8. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 6, delta

    Plan-review: repair

    • research_gap - Research Locks; step seam; Do not touch, lock paths and output - Keeping realpathSync.native fixes the resolver, but not which path reaches it. FileSystem.exists uses fs.access(F_OK) (node_modules/effect/src/FileSystem.ts:574–581, node_modules/@effect/platform-node-shared/src/NodeFileSystem.ts:65–80). On Windows, pinned Bun's access checks the link's attributes, while existsSync follows the junction and checks its target. Inference: with PI_CODING_AGENT_DIR pointing to a dangling junction, today's ancestor walk climbs past it and reaches folder preparation. The planned probe reports it present and fails earlier in realpath. Treating probe errors as false cannot fix a probe that succeeds - Preserve existsSync semantics for the Windows lock ancestor walk as well as native realpath semantics - class: filesystem substitution changes failure semantics
    • goal_fit - Step guidance; Acceptance guidance - The new patterns catch the old raw-mode claim and rethrow phrases, but the scan still passes if it leaves the instruction to read the old catch arm and grep for A rejected pipeline skips the summary (.agents/skills/sync-orchestration-context/SKILL.md:203–205). That probe points to the Promise catch in cli/src/engine-native/syncDispatch.ts:302–305; after the Effect cutover removes that arm and its comment, the guidance check can pass while the documented probe finds nothing - Update the failure-path instruction to point to the Effect handler and make the existing scan reject the obsolete probe - class: guidance check passes with obsolete instructions still present

    Previous findings:

    • Round-5 finding on Research Locks; step seam; Do not touch, locks and exit codes: resolved - Both sync waits now use Clock.currentTimeMillis; root toggles keep their monotonic poll.
    • Round-5 finding on Research Locks and Known synchronous failures; step seam: open - Native realpath is restored, but the Windows ancestor probe still changes the failure path, as noted above.
    • Round-5 finding on step guidance; Acceptance guidance: open - The raw-mode claim and rethrow phrases are covered, but the old catch-arm probe is not.

    Manager response to round 5

    Repaired:

    • Clock: both sync waits use the wall clock (Clock.currentTimeMillis), as Date.now() is now; the root toggles keep their monotonic poll.
    • Native realpath: canonicalization keeps realpathSync.native behind Effect.try, a node: call that FileSystem lacks, so the resolved lock paths and their diagnostics stay the same.
    • Guidance: the row now also rejects the claim that raw mode skips Effect and the Promise rethrow instructions of SKILL.md and dispatch-flow.md.

    Rejected: none.

    Redesigned: none.

  9. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 7, delta

    Plan-review: pass

    None.

    Previous findings:

    • Round-6 finding on Research Locks; step seam; Do not touch, lock paths and output: resolved - Research retains both existsSync for the ancestor walk and realpathSync.native for canonicalization, preserving how the walk handles a dangling Windows junction.
    • Round-6 finding on step guidance; Acceptance guidance: resolved - The step points the probe to the Effect failure handler, and the acceptance scan rejects the old A rejected pipeline skips the summary probe.

    Manager response to round 6

    Repaired:

    • Windows probe: the ancestor walk keeps existsSync in Effect.sync, since FileSystem.exists uses fs.access, which on Windows checks a junction itself; with realpathSync.native the lock paths and failure steps stay the same, and folder creation uses FileSystem.
    • Failure-path probe: step guidance points the probe to the Effect handler of a failed pipeline, and the row rejects A rejected pipeline skips the summary.

    Rejected: none.

    Redesigned: none.

  10. 34 remaining items

  11. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 28, delta

    Plan-review: repair

    • goal_fit - Research, Signal test fixture (line 40), “keeps the root for the stale sweep” - The timeout policy contradicts the decision that an unconfirmed root is retained and only case teardown may remove it. The stale sweep skips docks-kit-signal-fixture- before checking age or owner liveness (cli/test/lib/goldenResources.ts:22–29,51–57), so a timed-out root remains after the next golden run. Making it eligible again would let the sweep remove it without shutdown confirmation. - State that teardown reports and retains the root on timeout. Do not assign cleanup to the stale sweep. - class: timeout delegates cleanup to an excluded sweep
    • goal_fit - Research, Signal test fixture (line 40), “every recorded stub has stub-exited” and “starts only after the removal” - The stub records its start before running its body (cli/test/lib/goldenResources.ts:427–440), while teardown reads the records and removes the root in separate operations (cli/test/lib/supervisedRun.ts:36–45,61–67; cli/test/unit/syncSignals.test.ts:160–169). [INFERENCE] A stub delayed past CLI exit can register after the last check but before removal. Teardown then deletes the root while a recorded stub is still running. The guarantee about stubs that start after removal does not cover this interval. - Close stub registration before the final check so any stub either registers in time to be counted or exits before running its body. - class: stub registration can race the final cleanup check
    • research_gap - Research, Signal test fixture (line 40), “each stub records its pid” and “every recorded stub has stub-exited” - The writer keys both markers by PID and the reader checks only whether the matching filename exists (cli/test/lib/goldenResources.ts:432–435; cli/test/lib/supervisedRun.ts:36–45). POSIX permits reuse after a process lifetime ends. [INFERENCE] If a later stub in the same launch gets an earlier stub's PID, the old exit marker confirms the new stub before it exits. - Pair start and exit markers by a unique stub invocation ID. Keep the PID only for diagnostics. - class: recycled PID can satisfy another stub's exit check

    Previous findings:

    • Round-27 finding on Research, Signal test fixture (line 40); Step 3, seam (line 51): resolved - The dedicated prefix puts signal roots outside the legacy sweep's allowlist. The contradictory timeout clause is reported above.
    • Round-27 finding on Research, Signal test fixture (line 40); Acceptance, signals (line 65): resolved - The plan drops the working-directory scan, so an unrelated non-dumpable process can no longer block teardown. The replacement marker checks have the defects reported above.

    Manager response to round 27

    Repaired:

    • Legacy sweep: the root has the prefix docks-kit-signal-fixture-, which no sweep of goldenResources.ts, old or new, matches; an unconfirmed root is kept, not left for a sweep.
    • Visibility: the working-directory scan is dropped, since it cannot read non-dumpable processes of the same user. Removal needs the markers of every launch and every recorded stub; a stub that starts after the removal can only fail, because its PATH, HOME, and working directory reach no real tool or configuration.

    Rejected: none.

    Redesigned: none.

  12. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 29, delta

    Plan-review: repair

    • goal_fit - Research, Signal test fixture (line 40), “a stub registers its start … then checks that marker” - The marker does not close registration. [INFERENCE] A delayed stub can write its start record after the final scan and pause before checking the marker. Teardown then removes the root without the exit record it requires, and the stub can no longer write that record. The writer, scan, and removal are separate operations (cli/test/lib/goldenResources.ts:435–441, cli/test/lib/supervisedRun.ts:36–45, cli/test/unit/syncSignals.test.ts:160–169). - Serialize stub registration with closure. A stub either registers before the final scan or exits without writing records or running its body. Keep registration closed throughout removal. - class: stub registration can race the final cleanup check

    Previous findings:

    • Round-28 finding on Research, Signal test fixture (line 40), “keeps the root for the stale sweep”: resolved - Teardown now reports the timeout and retains the root. No sweep removes it.
    • Round-28 finding on Research, Signal test fixture (line 40), “every recorded stub has stub-exited” and “starts only after the removal”: open - repeated above
    • Round-28 finding on Research, Signal test fixture (line 40), PID-keyed records: resolved - Start and exit records are paired by unique invocation ID. The PID is diagnostic only.

    Manager response to round 28

    Repaired:

    • Timeout: teardown reports the unconfirmed launch and keeps the root; no sweep removes it.
    • Registration race: teardown writes registration-closed first; a stub registers, then checks it and exits at once with its exit marker when it exists; the final check counts every registered invocation.
    • Pid reuse: start and exit markers use a unique invocation id; the pid is only a diagnostic.

    Rejected: none.

    Redesigned: none.

  13. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 30, delta

    Plan-review: repair

    • goal_fit - Research, Signal test fixture (line 40), “the set of start files is final” - The rename closes the old name, but it does not stop a create that already resolved registry. [INFERENCE] On Linux, a stub's exclusive open can resolve registry, pause, then create <id>.start in the renamed directory after teardown's final scan. The kernel's directory locking rules explain why: creation locks registry, but a same-parent rename locks its parent, not the source directory. Teardown can therefore remove the root before the stub writes its exit record, even though the plan requires that record before removal. - Keep active tickets in a dedicated directory. Each stub must acquire a ticket before writing records or running its body, and release it only after writing its exit record. Close registration with a successful nonrecursive rmdir, which requires an empty directory and prevents new entries even through a reference acquired before removal. - class: stub registration can race the final cleanup check

    Previous findings:

    • Round-29 finding on Research, Signal test fixture (line 40), “a stub registers its start … then checks that marker”: open - repeated above

    Manager response to round 29

    Repaired:

    • Registration closure: a stub registers by an exclusive create of registry/<id>.start; teardown closes registration by one atomic rename of registry to registry.closed. A create after the rename fails, and that stub exits without records or body; the set of start files is then final, and registration stays closed during removal.

    Rejected: none.

    Redesigned: none.

  14. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 31, delta

    Plan-review: pass

    None.

    Previous findings:

    • Round-30 finding on Research, Signal test fixture (line 40), “the set of start files is final”: resolved - Stubs now take a ticket before doing any fixture work and remove it only after writing their exit marker. Teardown must get every launch confirmation and successfully remove active with a nonrecursive rmdir, which requires an empty directory and prevents new tickets even through an earlier directory reference.

    Manager response to round 30

    Repaired:

    • Registration closure: stubs take a ticket in active/ before anything else and remove it as their last act; teardown closes registration with a non-recursive rmdir of active, which succeeds only when the folder is empty and blocks every later create, also through an earlier resolved path. Removal needs that rmdir and shutdown-confirmed for every launch.

    Rejected: none.

    Redesigned: none.

  15. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 7, delta

    Code-review: pass

    Previous findings

    • Round-6 finding on cli/test/unit/syncSignals.test.ts:63-83,304-316: fixed - cli/test/lib/signalSelfPreload.ts:15-20 and cli/test/lib/signalEngineEntry.ts:43-48 raise signals only on themselves. The stub uses only a signal-zero liveness probe at cli/test/unit/syncSignals.test.ts:89-96.
    • Round-6 finding on cli/test/lib/goldenResources.ts:275-296,307-310, cli/test/unit/syncSignals.test.ts:118-127,173-189,320-323, cli/src/engine-native/ompPlugins.ts:343-373: fixed - The CLI gets a stub-only PATH, and teardown requires launch confirmation and an empty ticket directory before removing the root (cli/test/unit/syncSignals.test.ts:160-190,244-254).
    • Round-6 finding on cli/test/lib/signalSupervisor.ts:30-44, cli/test/unit/syncSignals.test.ts:130-135: fixed - The supervisor writes a request file instead of signalling the process group (cli/test/lib/signalSupervisor.ts:73-81).
    • Round-6 finding on cli/test/lib/signalSupervisor.ts:30-39, cli/test/unit/syncSignals.test.ts:130-135,161-166,283-290: fixed - The supervisor no longer invokes ps (cli/test/lib/signalSupervisor.ts:26-36,95-109).
    • Round-6 finding on cli/test/lib/goldenResources.ts:22-29,48-57,265-296, cli/test/unit/syncSignals.test.ts:188-189,201-206: fixed - The reviewed redesign deliberately retains unconfirmed roots. All fixture resources now share one non-swept root (cli/test/unit/syncSignals.test.ts:207-222,236-256; cli/test/lib/goldenResources.ts:22-29,48-57).
    • Round-6 finding on cli/test/lib/goldenResources.ts:269-296, cli/test/unit/syncSignals.test.ts:118-125: fixed - cli/test/lib/goldenResources.ts:289-296 invokes every callback inside a promise, so a synchronous throw cannot bypass allSettled.
    • Round-6 finding on cli/test/lib/goldenResources.ts:258-296, cli/test/unit/syncSignals.test.ts:118-126: fixed - Step 3 now lists the shared helper and all signal fixture files (plan-review-294-round-31.md:51).

    Standards

    • [MEDIUM] Bug - cli/test/lib/signalSupervisor.ts:100-101, cli/test/unit/syncSignals.test.ts:85-104,354-365 - Inference: if the supervisor is descheduled after spawn(), the CLI can reach the waiting omp stub before cli.pid is written. The stub either throws on a missing file or treats an empty record as a vanished parent. Neither path writes the readiness marker, so a correct CLI can fail the signal test. - Publish the PID record before the CLI entry runs, or publish it atomically and have the stub wait for a valid record within its lifetime bound. - class: child reads startup record before publication
    • [MEDIUM] Bug - cli/test/unit/syncSignals.test.ts:157-188,202-205,236-244 - A fixture that cannot confirm shutdown remains in the global fixtures set after its hook reports failure. If the supervisor never starts, that record can never confirm. Every later case then spends its full 10-second cleanup budget and fails with the first case's error even if its own fixture shut down correctly. - Scope normal teardown to the current case and remove a reported retained root from active tracking without deleting it. - class: failed fixture contaminates subsequent teardown
    • [LOW] Bug - cli/test/lib/goldenResources.ts:435-443, cli/test/unit/syncSignals.test.ts:418-421, cli/src/engine-native/ompPlugins.ts:138-152,373-375 - If ticket creation fails during the follow-up sync, for example because of a transient quota error, the omp stub exits zero without running its body. The engine counts a skipped omp plugin link as successful, and the follow-up case checks only the CLI's exit code. - Exit nonzero when ticket creation fails; keep the stub body behind successful registration. - class: failed fixture registration reports success
    • [LOW] Bug - cli/test/lib/goldenResources.ts:439-446, cli/test/lib/signalSupervisor.ts:83-90 - If the exclusive create succeeds but writing the PID fails, for example with ENOSPC, the stub has not yet installed its exit handler. Its empty ticket survives, so the supervisor never confirms shutdown even after the stub and CLI have exited. - Register ticket removal immediately after the exclusive create, before writing or closing the descriptor. - class: resource acquired before cleanup registration
    • [LOW] Bug - cli/test/unit/syncSignals.test.ts:207-222 - If creating a fixture subdirectory fails after mkdtempSync succeeds, the root never enters fixtures. Neither teardown nor the stale sweep removes it, even though no process was launched. - Roll back the partial root on setup failure before rethrowing the error. - class: partial fixture setup escapes cleanup
    • [LOW] Bug - cli/test/lib/goldenResources.ts:427-446, cli/test/unit/commandsReporting.test.ts:36-43,63, cli/test/unit/removedNames.test.ts:29,38-56 - Unreached: the signal suite is the only fixture that sets GOLDEN_STUB_TICKETS; the golden drivers construct their own environment, and no checked fixture or documented invocation sets it for the reporting or removed-name suites. Those two suites inherit the shell environment, though. If the variable is inherited there, ordinary stubs can skip their bodies or create tickets in an unrelated directory. - Enable ticket code only when generating stubs for a supervised fixture. - class: fixture protocol enabled by ambient environment

    Spec

    • [LOW] Spec - cli/test/lib/goldenResources.ts:435-446, cli/test/lib/signalSupervisor.ts:83-86 - The signal fixture decision says stubs “write a stub-exited marker on every exit path” and confirmation follows “every stub marker” (plan-review-294-round-31.md:40). On an ordinary stub exit, the runner only unlinks the ticket; the supervisor checks directory emptiness without a completion record. - Record stub completion before releasing its ticket and include that evidence in confirmation without replacing the final rmdir guard. - class: required shutdown evidence omitted
    • [LOW] Spec - cli/test/unit/syncSignals.test.ts:179-205 - The signal fixture decision says that at the teardown deadline “it reports the unconfirmed launch and keeps the root” (plan-review-294-round-31.md:40). When the SIGINT or SIGTERM callback reaches its own deadline with an unconfirmed launch, it discards the diagnostic returned by stopAndRemove. - Print those diagnostics before the cancellation callback returns, without removing an unconfirmed root or changing the signal re-raise. - class: cancellation drops required teardown diagnostics

    Manager response to round 6

    Repaired:

    • MEDIUM (resources before shutdown): one fixture root per case holds the home, the caches, the stubs, the launch folders, and a working folder with no .env (Bun runs with --no-env-file); the CLI PATH holds only stubs; teardown removes the root only after every launch has shutdown-confirmed and a non-recursive rmdir of the stub ticket folder active/ succeeds; otherwise the root stays.
    • LOW, unreached (pipeline-led group): the supervisor no longer does anything group-wide, so the session check is gone.
    • LOW (/bin/ps): the ps dependency is gone with the group check.
    • LOW (recovery after a worker kill): the root uses the prefix docks-kit-signal-fixture-, which no sweep matches, and an unconfirmed root stays (plan Research, Signal test fixture).
    • LOW, unreached (synchronous callback throw): goldenResources.ts runs each stop callback inside Promise.resolve().then.
    • Spec LOW (Files): plan edit; step 3 lists goldenResources.ts, signalSelfPreload.ts, and supervisedRun.ts (plan rounds 22 to 31 passed).

    Rejected: none.

    Redesigned:

    • MEDIUM (process identity; returned after the round-4 and round-5 redesigns; second stall, user answer Continue yolo): redesigned. A test-only Bun preload inside the CLI raises the requested signal on its own process, and cleanup asks the CLI the same way through its request file; no fixture process signals another pid or group. Record: plan Research, Signal test fixture (reviewed in plan rounds 22 to 31).
  16. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 8, delta

    Code-review: pass

    Previous findings

    • Round-7 finding on cli/test/lib/signalSupervisor.ts:100-101, cli/test/unit/syncSignals.test.ts:85-104,354-365: fixed - The supervisor publishes the PID by rename, and the stub waits for it before checking its parent or writing readiness (cli/test/lib/signalSupervisor.ts:100-105, cli/test/unit/syncSignals.test.ts:89-117).
    • Round-7 finding on cli/test/unit/syncSignals.test.ts:157-188,202-205,236-244: fixed - Normal teardown only handles the current case's fixtures. Retained roots leave active tracking (cli/test/unit/syncSignals.test.ts:180-181,200-208,225-228).
    • Round-7 finding on cli/test/lib/goldenResources.ts:435-443, cli/test/unit/syncSignals.test.ts:418-421, cli/src/engine-native/ompPlugins.ts:138-152,373-375: fixed - A stub that cannot take a ticket exits 1 before running its body, so a skipped plugin link no longer counts as a success (cli/test/lib/goldenResources.ts:417-422).
    • Round-7 finding on cli/test/lib/goldenResources.ts:439-446, cli/test/lib/signalSupervisor.ts:83-90: fixed - The stub installs its exit handler before writing the PID or closing the ticket descriptor (cli/test/lib/goldenResources.ts:417-432).
    • Round-7 finding on cli/test/unit/syncSignals.test.ts:207-222: fixed - Fixture setup removes the partial root if a subfolder create fails, before any launch can start (cli/test/unit/syncSignals.test.ts:244-262).
    • Round-7 finding on cli/test/lib/goldenResources.ts:427-446, cli/test/unit/commandsReporting.test.ts:36-43,63, cli/test/unit/removedNames.test.ts:29,38-56: fixed - Only the explicit supervised option adds ticket code to a generated runner. An inherited environment variable cannot enable it (cli/test/lib/goldenResources.ts:445-473).
    • Round-7 finding on cli/test/lib/goldenResources.ts:435-446, cli/test/lib/signalSupervisor.ts:83-86: open - repeated under Spec.
    • Round-7 finding on cli/test/unit/syncSignals.test.ts:179-205: fixed - The cancellation callback writes the teardown diagnostics to stderr instead of discarding them (cli/test/unit/syncSignals.test.ts:221-224).

    Standards

    • [LOW] Bug - cli/test/lib/signalSupervisor.ts:100-112, cli/test/unit/syncSignals.test.ts:89-104 - Inference: if publishing cli.pid fails after a successful spawn, the supervisor exits before attaching the CLI handlers. If the CLI reaches the waiting stub, that stub polls for a record that can never arrive and does not check its parent until the 90-second timer expires. The failed case can leave its CLI holding the fixture lock for that interval. - Handle PID publication failure in the supervisor, report it, and use the existing request channel to ask the CLI to exit. Make the stub stop waiting for the PID if its parent disappears. - class: startup publication failure leaves child waiting
    • [LOW] Bug - cli/test/unit/syncSignals.test.ts:180-214,221-228 - Inference: if the worker receives SIGINT or SIGTERM while afterEach is polling, both teardown calls can snapshot the same root. If afterEach removes it first, cancellation retries rmdir on the missing directory, then falsely prints that a stub still holds a ticket and the root was kept. - Recheck whether the fixture is still tracked before retrying registration closure or reporting a retained root. - class: overlapping teardown reports stale state
    • [LOW] Bug - cli/test/lib/goldenResources.ts:399-404,423-432, cli/test/lib/supervisedRun.ts:10-14 - Both protocol comments put the PID or .started write after ticket removal. In every supervised stub, those writes happen at startup; only the exit marker and ticket removal happen during exit. That distinction matters because the supervisor uses .started to detect missing exit evidence. - Separate startup writes from exit-handler actions in both comments. - class: documented lifecycle order contradicts implementation

    Spec

    • [LOW] Spec - cli/test/lib/goldenResources.ts:423-432, cli/test/lib/supervisedRun.ts:55-65, cli/test/lib/signalSupervisor.ts:83-86, cli/test/unit/syncSignals.test.ts:183-191,211-214 - The fixture decision says stubs “write a stub-exited marker on every exit path” and confirmation follows “every stub marker” (plan-review-294-round-31.md:40). Inference: if cancellation leaves a delayed stub that takes a ticket after the supervisor has confirmed but before teardown closes registration, a failed exit-marker write still unlinks its ticket in finally. Teardown can then remove the root without that stub's exit evidence because it only rechecks ticket emptiness. - Make releasing a ticket publish its exit record atomically, for example by moving the ticket to the exit-record path. If publication fails, the ticket must still block removal. Keep the final non-recursive rmdir guard. - class: required shutdown evidence omitted

    Manager response to round 7

    Repaired:

    • MEDIUM (startup record): the supervisor publishes cli.pid by write-then-rename; the waiting stub polls for a valid record within its 90 s limit before it checks the parent and writes readiness.
    • MEDIUM (contaminated teardown): afterEach handles only the fixtures of the current case; a fixture leaves tracking once handled, removed or kept; the cancellation path handles every fixture still tracked.
    • LOW (failed registration): a stub whose ticket create fails writes the reason to stderr and exits 1; its body runs only with a ticket.
    • LOW (release order): the ticket release is armed right after the exclusive create, before the pid write.
    • LOW (partial setup): makeFixture removes the root when a subfolder create fails, then rethrows.
    • LOW, unreached (ambient variable): ticket code is generated only through makeStubDir option supervised; GOLDEN_STUB_TICKETS is gone.
    • Spec LOW (exit records): each stub writes <id>.started and, on every exit path before the ticket release, <id>.stub-exited; supervisor confirmation needs both, besides the empty ticket folder; teardown keeps the final non-recursive rmdir.
    • Spec LOW (cancellation diagnostics): the SIGINT and SIGTERM path writes the stopAndRemove lines to stderr before it returns.

    Rejected: none.

    Redesigned: none.

  17. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 9, delta

    Code-review: pass

    Previous findings

    • Round-8 finding on cli/test/lib/signalSupervisor.ts:100-112, cli/test/unit/syncSignals.test.ts:89-104: open - repeated under Standards.
    • Round-8 finding on cli/test/unit/syncSignals.test.ts:180-214,221-228: fixed - Both teardown paths recheck tracking before closing registration or reporting a retained root (cli/test/unit/syncSignals.test.ts:185-213).
    • Round-8 finding on cli/test/lib/goldenResources.ts:399-404,423-432, cli/test/lib/supervisedRun.ts:10-14: fixed - Both comments now put the PID and start-record writes before the stub body and describe ticket release separately (cli/test/lib/goldenResources.ts:399-437, cli/test/lib/supervisedRun.ts:8-20).
    • Round-8 finding on cli/test/lib/goldenResources.ts:423-432, cli/test/lib/supervisedRun.ts:55-65, cli/test/lib/signalSupervisor.ts:83-86, cli/test/unit/syncSignals.test.ts:183-191,211-214: fixed - One rename publishes the exit record and releases the ticket. If the rename fails, the ticket stays and blocks registration closure (cli/test/lib/goldenResources.ts:429-435, cli/test/unit/syncSignals.test.ts:195-204).

    Standards

    • [LOW] Bug - cli/test/lib/signalSupervisor.ts:76-82,116-127, cli/test/unit/syncSignals.test.ts:85-105,311-323 - If the launch directory stops accepting writes after the CLI spawns, inference: the same error that blocks cli.pid can block signal-request.pending, and the unhandled second error still exits the supervisor while the CLI runs. The launcher discards the publication diagnostic on stderr. Even when the request succeeds, a stub first scheduled after its CLI exits can capture the adoptive parent as startParent and wait 90 seconds for the missing record. - Gate CLI startup on PID publication with a bounded child-side failure path that needs no second write, and report publication errors through the launcher’s JSON event stream. - class: startup publication failure leaves child waiting
    • [LOW] Bug - cli/test/lib/signalSupervisor.ts:85-98,108-127, cli/test/unit/syncSignals.test.ts:190-207,340-347 - If the supervised CLI spawn fails or PID publication fails but the CLI exits, inference: closing stdin leaves the supervisor and its pipes open for the full 120-second shutdown bound. pidPublished cannot become true, so the poll cannot finish even after the CLI and stubs are gone. - Once the CLI and stubs are gone, exit unsuccessfully without a confirmation if the PID was never published. - class: shutdown polls for an impossible state
    • [LOW] Maintainability - cli/test/lib/goldenResources.ts:429-435, cli/test/unit/syncSignals.test.ts:445-518 - Unreached: the public/raw and listener-order fixtures, their teardown callers, and the documented signal cases do not exercise an exit-record publication failure. Those cases would still pass if a failed rename released its ticket, reintroducing the root-removal defect. - Add a focused case that makes exit-record publication fail and asserts that the ticket and root remain. - class: missing failure-path regression test

    Spec

    • [LOW] Spec - cli/test/unit/syncSignals.test.ts:188-225,233-268 - Unreached: fixture setup creates active/, and neither teardown caller nor any documented signal case moves it aside. If active/ is moved while a delayed stub holds a ticket and all launches are confirmed, inference: rmdirSync returns ENOENT, which teardown accepts as proof of closure before recursively removing the root. The fixture decision says removal waits until “that rmdir succeeded” (plan-review-294-round-31.md:40). - Share proof of a successful rmdir between the teardown paths, or finalize each root synchronously after successful closure. Do not treat an unexplained ENOENT as that proof. - class: missing directory accepted as closure proof

    Manager response to round 8

    Repaired:

    • LOW (pid publication failure): the CLI handlers are attached right after the spawn; a failed publication is reported on stderr, asks the CLI to end through its request file, and blocks shutdown-confirmed; the waiting stub exits when its parent changes while it waits.
    • LOW (overlapping teardown): stopAndRemove rechecks tracking before each rmdir retry and each report; ENOENT counts as closed; the final removal-and-report loop is synchronous.
    • LOW (comments): the stub prelude and the supervisedRun.ts header list startup steps and the exit action in their real order.
    • Spec LOW (atomic release): the exit action is one rename of active/<id> to stub-records/<id>.stub-exited; a failed rename keeps the ticket, so the root stays; stubsEnded needs stub-records/ and a .stub-exited for every .started; the final non-recursive rmdir stays.

    Rejected: none.

    Redesigned: none.

    Round 9 passed. Its four LOW findings in the test fixture are deferred to #300.

  18. DocksDocks commented on Dec 2, 2026

    @DocksDocks
    OwnerAuthor

    Archived with landing pull request #301

  19. added a commit that references this issue on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions