Repository navigation
Description
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?)returnsPromise<number>.cli/src/main.tsawaits it in the raw golden channel and passes the code toprocess.exit, and printsdocks-kit raw operation '<operation>' failed: <detail>with exit 1 on a rejection.cli/src/engine.ts enginewraps it inEffect.tryPromiseand maps a rejection toCliError.UserError(engine operation '<args>' failed: <message>), and callsprocess.exit(code)for a nonzero code.- Intended aborts:
parseArgs.tsthrowsExitError(0)after-h/--helpandExitError(2)afterUnknown arg: <word>;syncDispatch.tsthrowsExitError(2)afterDOCKS_KIT_SYNC_LOCK_WAIT_MS must be a non-negative safe integer;index.tscatchesExitErrorand returns its code. engineCtx.ts makeCtxbuilds a plainCtx(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, soCtxstays a plain value that the seam passes on.failures.ts recordFailure(ctx, message)appends toctx.failuresand warns; its callers areompSync.tsandompPlugins.ts(Move the omp passes and the kit store to Effect #296).logger.tsTerminalLeasehasupdate,withExclusive(action)(Promise queue), andrelease;syncDispatch.tstakes it withacquireTerminal("Syncing omp...")and releases it infinally. No production caller runswithExclusive.- Locks:
engineSyncuses the PromisewithKitLocksoveracquireKitLockand releases infinally; a held lock returns 1.homeAndFolderLocks(Handle empty OMP tier sections in the fast toggles #284) is the scoped Effect form withacquireRelease,KitLockHeld,LockWaitInvalid, andLockAcquireError, andcommands/root.tsuses it. ompSync.tscalls, in order:bunBootstrap(Promise),ensureDirectory,syncWholeFile(twice),syncMergedYamlwithmergeOmpConfig,syncOmpRemovals,syncMergedYamlwithmergeOmpModels,syncOmpModelRemovals,syncKitPlugin(synchronous),syncPlugins(Promise), andompPathsagain. A rejection prints the recorded failures and rethrows.modes.tscallsreport,outdatedReport,present,bunBootstrap,installedVersion,field, andbelowFloor.- Tests that call the seam:
engine-di.test.ts,envGlobals.test.ts, andsyncLock.test.tsawaitrunEngineNative;logger.test.tsdrives the lease. - Other facts:
engineSynctakes the home lock beforeompWriteFoldersprobes the XDG data root, so a waiting sync picks the root after it holds the lock (syncDispatch.ts);syncDispatch.tsalso runsmkdirSync,existsSync, andrealpathSync.nativefor its lock folders.makeCtxcallskitHome(), which throws when an explicitDOCKS_KIT_HOMEhas no manifest (kitHome.ts); the public seam prints that message in itsCliError.UserError.logger.tsrethrows a write error that is notEPIPE, rethrows the first error of a buffered flush, and throws on a secondacquireTerminaland on a nestedwithExclusive(logger.test.tschecks that a nested call fails and the next call still runs).modes.tsreturns 2 from four usage branches.engineCtx.ts bunRuntimeholds the Promise memo thatbun.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 runsompSync), andtoolchain.test.ts..agents/skills/engine-native-context/SKILL.mdrequirescli/test/unit/goldenProveRed.test.ts. - Skill text to change:
.agents/skills/engine-native-context/SKILL.md(theExitErrorrule),.agents/skills/sync-orchestration-context/SKILL.md(theExitErrorrules and "The lock goes infinally"), and itsreferences/dispatch-flow.md(the Promise-era order, thefinallyrelease, and the anchorexport async function ompSync);.agents/skills/tidy-context/SKILL.md(its lock row namesacquireKitLockas the lock of sync);cli/src/engine-native/DESIGN.md(the parser re-export ofExitError).
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.tsexportsbridgeSync(step, f)andbridgePromise(step, f), which areEffect.uninterruptibleoverEffect.tryandEffect.tryPromisewith a typedLegacyStepFailed(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 inlineEffect.uninterruptible(Effect.try(...))per call, which repeats the rule in about 20 places. - The run context (delegated, one line):
EngineContextis aContext.Servicewhose value is the plainCtx; the Effect code reads it withyield*, and passes the same value to bridged code. Rejected: one service perCtxfield, which bridged code cannot read. - The ledger (delegated, one line):
recordFailurestays a plain synchronous append, becauseompPlugins.ts(Move the omp passes and the kit store to Effect #296) calls it; Effect code calls it throughEffect.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):
acquireTerminalbecomes a scoped resource (Effect.acquireRelease), andwithExclusivetakes and returns an Effect, serialized with a one-permitSemaphore;updateandreleasestay synchronous. Rejected: keeping the Promise queue, which the parentpromisesrow forbids. - Intended aborts (parent D5): help, every usage refusal (
Unknown argand the four branches ofmodes.ts), and an invalidDOCKS_KIT_SYNC_LOCK_WAIT_MSare typed failures in the error channel (HelpShownwith code 0,UsageRefusedandLockWaitInvalidwith code 2), andrunEngineNativeturns each into its exit code after the same text.ExitErroris 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 inEffect.trywith a typed error (KitHomeInvalid) that keeps the original message; the seam prints the same detail as now forLegacyStepFailed,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
EPIPEstill throws at once, so no later work runs after it (for example the installer after a warning inbun.ts);EPIPEstays 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 sameCliError.UserErrortext and raw failure line as the rejection did. A secondacquireTerminalis a typedLeaseHeldfailure of the scoped acquire, and a nestedwithExclusivefails withLeaseReenteredbefore 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)returnsEffect<number, EngineFailure, LoggerService | DependencyManagerService | PlatformService | FileSystem>, whereEngineFailureisLegacyStepFailed | LockAcquireError | KitHomeInvalid | LeaseHeld; the aborts are already exit codes.engine.tsyields it and maps each failure, and a defect, to the sameCliError.UserErrortext as now (the original message of the failure or its cause);main.tsruns it in the raw channel with the live layers andBunServices.layerand prints the same raw failure line. Rejected: keeping aservicesparameter beside the layers, a second way to inject. - Locks (delegated, one line):
syncDispatch.tsexposes the scoped home lock and the scoped folder locks thathomeAndFolderLockscomposes.engineSynctakes the home lock, then resolves the folders withompWriteFoldersunder 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 mapsKitLockHeldto its current held line and exit 1.homeAndFolderLocksstays for the root toggles. The folder creation and the canonical paths ofsyncDispatch.tsmove toFileSystemwith the same nearest-existing-ancestor and mode rules: the existence probe of the ancestor walk keepsexistsSyncinEffect.sync, becauseFileSystem.existsusesfs.access, which keeps errors other thanNotFoundand, on Windows, checks a junction itself instead of its target; so the walk goes up as before; canonicalization keepsrealpathSync.nativebehindEffect.try, because therealPathofFileSystemcalls the non-nativefs.realpath, which resolves..and names its failures differently (anode:call thatFileSystemlacks, parentbridgesrow); canonicalization and folder creation keep their own failures, and each prints the Node error message that thePlatformErrorcarries 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, asDate.now()is now) for both sync waits, asacquireKitLockandwithKitLocksdo now; the folder locks of the root toggles and the root toggles keep their current monotonic poll.withKitLocksis removed; no call toacquireKitLockremains 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,
SIGINTorSIGTERMexits the process at once, with 130 or 143 in the raw channel (the currentmain.tshandlers) and 130 for both in the public channel (the currentBunRuntime.runMaininterrupt 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 changesexec.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 writesSIGTERMinto the request file of its CLI, the stubs exit when their parent is gone or after a relative 90 s limit and write astub-exitedmarker on every exit path, and the supervisor writesshutdown-confirmedafter 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 ofactive/<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-recursivermdirofactive, 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 (POSIXrmdir). Teardown removes the root only after every launch of the case hasshutdown-confirmedand thatrmdirsucceeded; 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 ofgoldenResources.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 asssh-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.envfile, because Bun loads a.envof 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
finallydid. - 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
- The code that later children of Move the engine-native layer to Effect #290 own (the parent File owners table); this child only bridges it.
- The lock paths, the held-lock text, the outputs, and the exit codes.
Activity
DocksDocks commentedon Dec 1, 2026
Delegation grant: yolo: "now start #290 please, use yolo, also fix open findings in a follow up"
Parent event: 7326116204
DocksDocks commentedon Dec 1, 2026
Plan review round 1
Plan-review: repair
Locks; stepdispatch-syncDispatch.ts:117–121,272–286currently takes the home lock beforeompWriteFoldersprobes for the XDG data root.homeAndFolderLockstakes an already-computed folder array atsyncDispatch.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 atcommands/root.ts:95–100- class: scoped lock cutover moves path discovery before its lockLocksandThe run; stepdispatch- Parent Move the engine-native layer to Effect #290 requires filesystem work throughFileSystem. Reusing the current scoped helper leavesmkdirSync,existsSync, andrealpathSync.nativein Move the engine seam and the sync orchestration to Effect #294-ownedsyncDispatch.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 toFileSystemin 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 migrationThe runandLocks; stepsleaseanddispatch; Do not touch, outputs - The existing boundaries display the underlying error detail (engine.ts:24–45,main.ts:47–54). Routing the newLockAcquireError.messagedirectly to them addscannot take the lock …to a lock-open failure (syncDispatch.ts:196–201). Also,makeCtxcallskitHome(), which throws for a missing manifest under an explicitDOCKS_KIT_HOME(engineCtx.ts:43–49,kitHome.ts:16–42). If that call simply moves intoEffect.sync, the Effect API makes it a defect, so typed-error mapping in the public command no longer produces the existingCliError.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 unmappedIntended aborts; stepsabortsanddispatch- 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–62has four usage-refusal branches that still return2as a successful value under the stated plan. Rawsync --helpandtoolchain check extramust 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 decisionThe terminal lease; steplease-logger.ts:134–137rejects re-entry, andcli/test/unit/logger.test.ts:99–106checks 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 guardTests that call the seam; steptests, Files; Acceptanceunit-engine.test.ts:43,87–110mocks Promise results and the old three-argument call.ompPluginInventory.test.ts:183–186,ompRemovals.test.ts:121–122, andtoolchain.test.ts:202,226,268directly 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 inunit- class: caller left on a replaced APIlease,aborts,dispatch, andtests; Acceptanceunit- The earlier steps requireunitto pass before the steps it needs can start. Removing theExitErrorexport inabortsleaves live imports inindex.ts:15andsyncDispatch.ts:29untildispatch; thendispatchchanges the seam beforetestsupdates the Promise calls inengine-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 sharedunitcheck a completion condition only after the caller cutover - class: step completion check requires a dependent stepscan; ResearchThe run context- The scan requires noPromise<match inengineCtx.ts, butengineCtx.ts:20holds the memoized Promise that Move the toolchain passes to Effect #298-ownedbun.ts:63–67reads 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 - Makescanreject 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 requiresdispatch, Done when; Acceptancegoldens- 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 theHEADcomparison still reports no change - Keep the comparison ingoldensand require it on the exact reviewed commit - class: acceptance compares a revision other than the candidate under testunit,red-dry, andred-mut-.agents/skills/engine-native-context/SKILL.md:60–66requires the separategoldenProveRed.test.tscheck 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 inunit- class: required repository verification not named in AcceptanceSkill text to change; stepskills; Acceptanceskills; Do not touch - The cutover leaves active guidance on the removed paths..agents/skills/tidy-context/SKILL.md:73still identifiesacquireKitLockas sync's lock API, andcli/src/engine-native/DESIGN.md:175still directs readers to the removed parser re-export. In the listed dispatch reference, line 80 finds the pipeline only if it is still declaredexport async function ompSync. Theskillsscan 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 makeskillscheck the removed references it is meant to catch - class: active guidance still points to the replaced implementationDocksDocks commentedon Dec 1, 2026
Plan review round 2, delta
Plan-review: repair
LocksandThe run; stepseam, Files; Acceptanceunit- The shared lock helpers now needFileSystem, but the declared engine environment omits it. The raw branch runs before the publicBunServices.layeris provided (cli/src/main.ts:38–54,66–75). Also,cli/test/unit/folderLockCreate.test.ts:56,78,101,135runshomeAndFolderLocksdirectly without a filesystem provider. As written, the raw mutation run and direct lock tests cannot run the migrated helper with their stated dependencies - DeclareFileSystemin the engine environment, provide it at the raw entry, and addfolderLockCreate.test.tsto the seam cutover so it supplies the real filesystem layer - class: new service requirement not wired through existing callersLogger failures; stepsleaseandseam; Do not touch, outputs - A synchronous non-EPIPE write failure currently escapes the logger (cli/src/engine-native/logger.ts:54–76). Incli/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 stoppedThe run,Known synchronous failures, andLogger failures- The declared error channel allows onlyLegacyStepFailed | LockAcquireError, but the new decisions sayKitHomeInvalidandOutputWriteFailedreach the boundary as typed failures. The scoped acquire also introducesLeaseHeld. For example, an invalid explicit kit home fails incli/src/kitHome.ts:16–29, andcli/src/engine.ts:38–45currently 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 failuresLocks; stepseam; 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 outcomeLocksandKnown synchronous failures- The two existence probes are not equivalent.canonicalFoldercurrently treats a falseexistsSyncresult as a reason to walk up (cli/src/engine-native/syncDispatch.ts:126–133). In Effect 4.1.7,FileSystem.makederivesexistsfromaccessand turns onlyNotFoundinto false (node_modules/effect/src/FileSystem.ts:567–583); the installed provider mapsENOTDIRtoBadResource(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 directFileSystem.existssubstitution 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 semanticsKnown synchronous failures; parent Move the engine-native layer to Effect #290 Acceptancebridges- The new permanentEffect.trywrapskitHome(), 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 ruleseam, Done when; stepguidance, Depends; Acceptancegoldens- The clean reviewed-commit comparison fixes the dirty-tree false pass, butseamnow requires it beforeguidancemay 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 includeguidancewhile 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 stepguidance; stepguidance- The scan can pass after removing the named literals while leavingcli/src/engine-native/DESIGN.md:175saying the parser re-exports the “early-exit error.” It can also leave the oldrunEngineNativesignature and removed lock helpers in.agents/skills/sync-orchestration-context/SKILL.md:139,214–216,244–256andreferences/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 presentguidance, Files; Do not touch; parent Move the engine-native layer to Effect #290File owners- The repair assigns Move the engine seam and the sync orchestration to Effect #294 the parser row ofDESIGN.md, the sync lock row of.agents/skills/tidy-context/SKILL.md, and the sync lock guidance that namesacquireKitLockin.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 splitLocks; stepseam; Acceptanceunitandgoldens- The repaired plan changes the folder-lock code used by the public--fastand--ultrafastcommands (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 incli/test/unit/rootFlags.test.ts:87–111,146–173in Acceptance and name the expected tier change and preservation of unrelated config - class: changed CLI path lacks an end-to-end acceptance resultPrevious findings:
Locks; stepdispatch: resolved -Locksnow putsompWriteFoldersafter home-lock acquisition and passes the same folders to the pipeline.LocksandThe run; stepdispatch: open - repeated above. The filesystem operations are assigned, but the provider cutover is incomplete.The runandLocks; stepsleaseanddispatch; Do not touch, outputs: open - repeated above.Intended aborts; stepsabortsanddispatch: resolved - The decision puts help, all fourmodes.tsrefusals, unknown args, and invalid lock wait in the typed channel before translating them to their original codes.The terminal lease; steplease: resolved -Logger failuresrequiresLeaseReenteredbefore the semaphore wait, andleaseretains the nested-call regression.Tests that call the seam; steptests, Files; Acceptanceunit: open - repeated above. All four originally named suites are included; the newly affected direct lock suite still has no edit.lease,aborts,dispatch, andtests; Acceptanceunit: open - repeated above. The original unit-proof ordering is repaired, but the reviewed-commit golden proof now depends on the next step.scan; ResearchThe run context: resolved -scanexplicitly expects the onebunRuntimePromise memo until Move the toolchain passes to Effect #298 removes it.dispatch, Done when; Acceptancegoldens: resolved - The comparison now specifies a clean checkout of the reviewed commit.unit,red-dry, andred-mut: resolved -unitincludesgoldenProveRed.test.tsand names the invariant-only result.Skill text to change; stepskills; Acceptanceskills; 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:
ompWriteFoldersunder it, then takes the folder locks, in one scope;homeAndFolderLocksstays for the root toggles.FileSystem: the folder creation and canonical paths ofsyncDispatch.tsmove toFileSystemwith the same nearest-existing-ancestor and mode rules.kitHome()and the other throwing calls inEffect.trywith 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 andOutputWriteFailed,LeaseHeld,LeaseReentered), withEPIPEstill ignored.modes.tsbranches included), and the lock-wait refusal are typed failures, as parent D5 says.withExclusivefails withLeaseReenteredbefore it waits for the permit; the nested-call regression stays.engine.test.ts,ompPluginInventory.test.ts,ompRemovals.test.ts, andtoolchain.test.ts, andunitruns them.seam);bridgeandleaseeach pass their own tests;guidancefollows.scanrow allows the onebunRuntimePromise field ofengineCtx.ts, which Move the toolchain passes to Effect #298 removes.unitrunsgoldenProveRed.test.ts.tidy-contextlock row, theDESIGN.mdparser line, and theompSyncanchor ofdispatch-flow.md, and theguidancerow checks them.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 1, 2026
Plan review round 3, delta
Plan-review: repair
plan-review-294-round-3.md, ResearchLocksandThe run; stepseam; Acceptanceunit- The round-3 export still omits the filesystem wiring named in the repair record. The raw branch runs before the publicBunServices.layeris provided (cli/src/main.ts:38–54,66–75), and the directhomeAndFolderLockscalls have no provider (cli/test/unit/folderLockCreate.test.ts:56,78,101,135). The migrated helper cannot run on either path as written - DeclareFileSystemin 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 callersLogger failures; stepsleaseandseam; Acceptancescan- The child still saves the first write error and reports it later. Today a synchronous non-EPIPEwarning 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 6throwsnow 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 stepleaseandscanto match - class: deferred error permits work that the old failure stoppedThe run,Known synchronous failures, andLogger failures- The declared Effect error channel allows onlyLegacyStepFailed | LockAcquireError. The child also requires typedKitHomeInvalid,LeaseHeld, andOutputWriteFailedwithout translating them. For example, an invalid explicit kit home must retain the error detail fromcli/src/kitHome.ts:16–29thatcli/src/engine.ts:38–45reports today - IncludeKitHomeInvalidandLeaseHeldin the boundary error union and removeOutputWriteFailedwhen restoring the immediate rethrow. Preserve the existing failure text - class: declared error channel excludes required failuresLocks; stepseam; 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 outcomeLocksandKnown synchronous failures-canonicalFolderwalks up whenexistsSyncreturns false (cli/src/engine-native/syncDispatch.ts:126–133), but the Effect filesystem only convertsNotFoundto false (node_modules/effect/src/FileSystem.ts:574–583). The pinned provider mapsENOTDIRtoBadResource(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 semanticsseam, Done when; stepguidance, Depends; Acceptancegoldens- Stepseamstill requires the reviewed-commitgoldensrow beforeguidancecan 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 containguidancewhen 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 stepguidance; Acceptanceguidance- 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 andfinallyrelease (.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 presentLocks; stepseam; Acceptanceunitandgoldens- 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--fastand--ultrafastcases incli/test/unit/rootFlags.test.ts:87–111,146–173and name the tier changes and preservation of unrelated config - class: changed CLI path lacks an end-to-end acceptance resultPrevious findings:
LocksandThe run; stepseam, Files; Acceptanceunit: open - repeated above.Logger failures; stepsleaseandseam; Do not touch, outputs: open - repeated above.The run,Known synchronous failures, andLogger failures: open - repeated above.Locks; stepseam; Do not touch, locks and exit codes: open - repeated above.LocksandKnown synchronous failures: open - repeated above.Known synchronous failures; parent Move the engine-native layer to Effect #290 Acceptancebridges: resolved - the supplied round-6 parent export explicitly allows the synchronouskitHome()adapter.seam, Done when; stepguidance, Depends; Acceptancegoldens: open - repeated above.guidance; stepguidance: open - repeated above.guidance, Files; Do not touch; parent Move the engine-native layer to Effect #290File 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.Locks; stepseam; Acceptanceunitandgoldens: open - repeated above.Manager response to round 2
Repaired:
FileSystemwiring: the run's environment namesFileSystem;main.tsprovidesBunServices.layerin the raw channel, andfolderLockCreate.test.tsjoins step 3 with that layer.EPIPE, so no later work runs; the seam maps that defect to the same text. The parentthrowsrow now names this adapter (parent edit, reviewed in parent round 6).EngineFailureisLegacyStepFailed | LockAcquireError | KitHomeInvalid | LeaseHeld, and the seam maps each, and a defect, to the current text.NotFoundand onENOTDIR, asexistsSyncdid, and a failure prints the Node error message that thePlatformErrorcarries.kitHome()adapter: the parentbridgesrow now allowsEffect.tryaround the synchronous resolverkitHome()(parent edit).unit,toggles, both prove-red rows, and both golden suites; the clean reviewed-commit comparison stays ingoldens.early-exit error,withKitLocks, and the oldrunEngineNative(argv, servicessignature, andacquireKitLockinsync-orchestration-context.tidy-contextandsync-orchestration-contextand the parser line ofDESIGN.md(parent edit).togglesrow runs the spawned--fastand--ultrafastcases ofrootFlags.test.tsandompFastMode.test.ts.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 1, 2026
Plan review round 4, delta
Plan-review: repair
Locks; stepseam; 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–145starts it before directory preparation and database open;cli/src/engine-native/syncDispatch.ts:221–239starts 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 outcomeLocksandKnown synchronous failures- HandlingNotFoundandENOTDIRfixes the regular-file case, but does not preserve the old existence probe.cli/src/engine-native/syncDispatch.ts:126–133walks up on a false result, and the pinned Bun implementation returns false on probe errors. The Effect probe preserves errors other thanNotFound(node_modules/effect/src/FileSystem.ts:574–583), includingELOOP(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 semanticsguidance; Acceptanceguidance- The revised grep can still pass with the oldwithSyncLockandwithFolderLockscalls 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 andreleaseKitLock of each lock in finally(.agents/skills/sync-orchestration-context/references/dispatch-flow.md:29–34,58–76). The newplain factorypattern 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 presentLogger failuresandOther facts; steplease; Acceptancescan- The scan allows only the twowriteIgnoringEpiperethrows, but it also matches that function'ssynchronous throwcomment (cli/src/engine-native/logger.ts:50–66) and the first-error rethrow afterflushDurabledrains 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 behaviorPrevious findings:
LocksandThe run; stepseam; Acceptanceunit: resolved -plan-review-294-round-4.mdaddsFileSystemto the run environment, providesBunServices.layerin raw mode, and assigns the direct lock tests that layer.Logger failures; stepsleaseandseam; Acceptancescan: resolved - The plan restores the immediate non-EPIPErethrow and preserves the boundary diagnostic. The scan's separate flush mismatch is listed above.The run,Known synchronous failures, andLogger failures: resolved -EngineFailureincludesKitHomeInvalidandLeaseHeld, and the plan removesOutputWriteFailed.Locks; stepseam; Do not touch, locks and exit codes: open - repeated above. Sync gets its final attempt back, but the home-lock timer still starts later.LocksandKnown synchronous failures: open - repeated above. TheENOTDIRcase is covered, but other false existence results can still change the diagnostic.seam, Done when; stepguidance, Depends; Acceptancegoldens: resolved -seamuses the golden suite results as step proof and leaves the reviewed-commit comparison ingoldens.guidance; Acceptanceguidance: open - repeated above.Locks; stepseam; Acceptanceunitandgoldens: resolved -togglesruns the spawned--fastand--ultrafastcases and names the tier change and preservation of unrelated config.Manager response to round 3
Repaired:
OutputWriteFailedis gone; stepleaseand thescanrow allow the two rethrows ofwriteIgnoringEpipe.kitHome(): a bridge until Move the process layer, the file helpers, and the kit store to Effect #297 moves the resolver.DESIGN.md(plain factory).FileSystemwiring andfolderLockCreate.test.ts, the error union, the ancestor walk, the step proof, and thetogglesrow) are now in the body.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 1, 2026
Plan review round 5, delta
Plan-review: repair
Locks; stepseam; 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 useDate.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 - UseClock.currentTimeMillisfor both sync waits. Keep the root toggles' monotonic poll - class: scoped lock cutover changes the contention outcomeLocksandKnown synchronous failures; stepseam- The existence probe is fixed, but the liveFileSystem.realPathcalls non-nativefs.realpathon POSIX (node_modules/@effect/platform-node-shared/src/NodeFileSystem.ts:557–564), whilecli/src/engine-native/syncDispatch.ts:126–133usesrealpathSync.native. Pinned Bun normalizes..before non-native resolution and labels failureslstatinstead ofrealpath. Inference:PI_CONFIG_DIR=link/../configreaches the resolver unchanged (ompPaths.ts:61–76); iflinkpoints 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 semanticsguidance; Acceptanceguidance- 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 presentPrevious findings:
Locks; stepseam; Do not touch, locks and exit codes: open - repeated above. The timer now starts before home-lock preparation, but the clock still differs.LocksandKnown synchronous failures: open - repeated above. The ancestor walk now treats probe failures as false, but the resolver still changes lock paths and diagnostics.guidance; Acceptanceguidance: open - repeated above.Logger failuresandOther facts; steplease; Acceptancescan: resolved -leaseretains the drain and first-error rethrow, andscanexcludes the JSDoc match and allows that rethrow.Manager response to round 4
Repaired:
FileSystem.existsas false, as Bun'sexistsSyncdoes; canonicalization and folder creation keep their own failures and steps.withSyncLock,withFolderLocks,in finally, the three-argumentrunEngineNativeandmakeCtx(servicesexamples, and the two service-wiring sentences ofDESIGN.md.flushDurabledrains, which stepleasekeeps with its regression.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 1, 2026
Plan review round 6, delta
Plan-review: repair
Locks; stepseam; Do not touch, lock paths and output - KeepingrealpathSync.nativefixes the resolver, but not which path reaches it.FileSystem.existsusesfs.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: withPI_CODING_AGENT_DIRpointing to a dangling junction, today's ancestor walk climbs past it and reaches folder preparation. The planned probe reports it present and fails earlier inrealpath. Treating probe errors as false cannot fix a probe that succeeds - PreserveexistsSyncsemantics for the Windows lock ancestor walk as well as native realpath semantics - class: filesystem substitution changes failure semanticsguidance; Acceptanceguidance- 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 oldcatcharm and grep forA rejected pipeline skips the summary(.agents/skills/sync-orchestration-context/SKILL.md:203–205). That probe points to the Promise catch incli/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 presentPrevious findings:
Locks; stepseam; Do not touch, locks and exit codes: resolved - Both sync waits now useClock.currentTimeMillis; root toggles keep their monotonic poll.LocksandKnown synchronous failures; stepseam: open - Native realpath is restored, but the Windows ancestor probe still changes the failure path, as noted above.guidance; Acceptanceguidance: 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.currentTimeMillis), asDate.now()is now; the root toggles keep their monotonic poll.realpathSync.nativebehindEffect.try, anode:call thatFileSystemlacks, so the resolved lock paths and their diagnostics stay the same.SKILL.mdanddispatch-flow.md.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 1, 2026
Plan review round 7, delta
Plan-review: pass
None.
Previous findings:
Locks; stepseam; Do not touch, lock paths and output: resolved - Research retains bothexistsSyncfor the ancestor walk andrealpathSync.nativefor canonicalization, preserving how the walk handles a dangling Windows junction.guidance; Acceptanceguidance: resolved - The step points the probe to the Effect failure handler, and the acceptance scan rejects the oldA rejected pipeline skips the summaryprobe.Manager response to round 6
Repaired:
existsSyncinEffect.sync, sinceFileSystem.existsusesfs.access, which on Windows checks a junction itself; withrealpathSync.nativethe lock paths and failure steps stay the same, and folder creation usesFileSystem.guidancepoints the probe to the Effect handler of a failed pipeline, and the row rejectsA rejected pipeline skips the summary.Rejected: none.
Redesigned: none.
34 remaining items
DocksDocks commentedon Dec 2, 2026
Plan review round 28, delta
Plan-review: repair
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 skipsdocks-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 sweepSignal test fixture(line 40), “every recorded stub hasstub-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 checkSignal test fixture(line 40), “each stub records its pid” and “every recorded stub hasstub-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 checkPrevious findings:
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.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:
docks-kit-signal-fixture-, which no sweep ofgoldenResources.ts, old or new, matches; an unconfirmed root is kept, not left for a sweep.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 29, delta
Plan-review: repair
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 checkPrevious findings:
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.Signal test fixture(line 40), “every recorded stub hasstub-exited” and “starts only after the removal”: open - repeated aboveSignal 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:
registration-closedfirst; a stub registers, then checks it and exits at once with its exit marker when it exists; the final check counts every registered invocation.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Plan review round 30, delta
Plan-review: repair
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 resolvedregistry. [INFERENCE] On Linux, a stub's exclusive open can resolveregistry, pause, then create<id>.startin the renamed directory after teardown's final scan. The kernel's directory locking rules explain why: creation locksregistry, 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 nonrecursivermdir, which requires an empty directory and prevents new entries even through a reference acquired before removal. - class: stub registration can race the final cleanup checkPrevious findings:
Signal test fixture(line 40), “a stub registers its start … then checks that marker”: open - repeated aboveManager response to round 29
Repaired:
registry/<id>.start; teardown closes registration by one atomic rename ofregistrytoregistry.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.
DocksDocks commentedon Dec 2, 2026
Plan review round 31, delta
Plan-review: pass
None.
Previous findings:
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 removeactivewith a nonrecursivermdir, which requires an empty directory and prevents new tickets even through an earlier directory reference.Manager response to round 30
Repaired:
active/before anything else and remove it as their last act; teardown closes registration with a non-recursivermdirofactive, which succeeds only when the folder is empty and blocks every later create, also through an earlier resolved path. Removal needs thatrmdirandshutdown-confirmedfor every launch.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 7, delta
Code-review: pass
Previous findings
cli/test/lib/signalSelfPreload.ts:15-20andcli/test/lib/signalEngineEntry.ts:43-48raise signals only on themselves. The stub uses only a signal-zero liveness probe atcli/test/unit/syncSignals.test.ts:89-96.cli/test/unit/syncSignals.test.ts:160-190,244-254).cli/test/lib/signalSupervisor.ts:73-81).ps(cli/test/lib/signalSupervisor.ts:26-36,95-109).cli/test/unit/syncSignals.test.ts:207-222,236-256;cli/test/lib/goldenResources.ts:22-29,48-57).cli/test/lib/goldenResources.ts:289-296invokes every callback inside a promise, so a synchronous throw cannot bypassallSettled.plan-review-294-round-31.md:51).Standards
spawn(), the CLI can reach the waitingompstub beforecli.pidis 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 publicationfixturesset 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 teardownompstub exits zero without running its body. The engine counts a skippedomp plugin linkas 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 successENOSPC, 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 registrationmkdtempSyncsucceeds, the root never entersfixtures. 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 cleanupGOLDEN_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 environmentSpec
stub-exitedmarker 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 finalrmdirguard. - class: required shutdown evidence omittedplan-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 bystopAndRemove. - Print those diagnostics before the cancellation callback returns, without removing an unconfirmed root or changing the signal re-raise. - class: cancellation drops required teardown diagnosticsManager response to round 6
Repaired:
.env(Bun runs with--no-env-file); the CLI PATH holds only stubs; teardown removes the root only after every launch hasshutdown-confirmedand a non-recursivermdirof the stub ticket folderactive/succeeds; otherwise the root stays./bin/ps): thepsdependency is gone with the group check.docks-kit-signal-fixture-, which no sweep matches, and an unconfirmed root stays (plan Research, Signal test fixture).goldenResources.tsruns each stop callback insidePromise.resolve().then.goldenResources.ts,signalSelfPreload.ts, andsupervisedRun.ts(plan rounds 22 to 31 passed).Rejected: none.
Redesigned:
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).DocksDocks commentedon Dec 2, 2026
Code review round 8, delta
Code-review: pass
Previous findings
cli/test/lib/signalSupervisor.ts:100-105,cli/test/unit/syncSignals.test.ts:89-117).cli/test/unit/syncSignals.test.ts:180-181,200-208,225-228).cli/test/lib/goldenResources.ts:417-422).cli/test/lib/goldenResources.ts:417-432).cli/test/unit/syncSignals.test.ts:244-262).supervisedoption adds ticket code to a generated runner. An inherited environment variable cannot enable it (cli/test/lib/goldenResources.ts:445-473).cli/test/unit/syncSignals.test.ts:221-224).Standards
cli.pidfails 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 waitingafterEachis polling, both teardown calls can snapshot the same root. IfafterEachremoves it first, cancellation retriesrmdiron 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.startedwrite 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.startedto detect missing exit evidence. - Separate startup writes from exit-handler actions in both comments. - class: documented lifecycle order contradicts implementationSpec
stub-exitedmarker 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 infinally. 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-recursivermdirguard. - class: required shutdown evidence omittedManager response to round 7
Repaired:
cli.pidby write-then-rename; the waiting stub polls for a valid record within its 90 s limit before it checks the parent and writes readiness.afterEachhandles only the fixtures of the current case; a fixture leaves tracking once handled, removed or kept; the cancellation path handles every fixture still tracked.makeFixtureremoves the root when a subfolder create fails, then rethrows.makeStubDiroptionsupervised;GOLDEN_STUB_TICKETSis gone.<id>.startedand, 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-recursivermdir.stopAndRemovelines to stderr before it returns.Rejected: none.
Redesigned: none.
DocksDocks commentedon Dec 2, 2026
Code review round 9, delta
Code-review: pass
Previous findings
Standards
cli.pidcan blocksignal-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 asstartParentand 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 waitingpidPublishedcannot 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 stateSpec
active/, and neither teardown caller nor any documented signal case moves it aside. Ifactive/is moved while a delayed stub holds a ticket and all launches are confirmed, inference:rmdirSyncreturnsENOENT, which teardown accepts as proof of closure before recursively removing the root. The fixture decision says removal waits until “thatrmdirsucceeded” (plan-review-294-round-31.md:40). - Share proof of a successfulrmdirbetween the teardown paths, or finalize each root synchronously after successful closure. Do not treat an unexplainedENOENTas that proof. - class: missing directory accepted as closure proofManager response to round 8
Repaired:
shutdown-confirmed; the waiting stub exits when its parent changes while it waits.stopAndRemoverechecks tracking before eachrmdirretry and each report;ENOENTcounts as closed; the final removal-and-report loop is synchronous.supervisedRun.tsheader list startup steps and the exit action in their real order.active/<id>tostub-records/<id>.stub-exited; a failed rename keeps the ticket, so the root stays;stubsEndedneedsstub-records/and a.stub-exitedfor every.started; the final non-recursivermdirstays.Rejected: none.
Redesigned: none.
Round 9 passed. Its four LOW findings in the test fixture are deferred to #300.
Make the signal test fixture signal-free outside the process under test
Harden the signal fixture records and per-case teardown
Publish stub exit records atomically in the signal fixture
DocksDocks commentedon Dec 2, 2026
Archived with landing pull request #301
Move the omp passes to Effect