Repository navigation
Description
Goal
In runBounded, make accepting work and draining after a failure mutually exclusive. Preserve input-order results, bounded overlap, the first failing input by index, and the exact rejection value.
Yolo: the user delegated every decision except the merge to the agent.
Mode: plan-and-implement
Research
cli/src/engine-native/syncConcurrency.ts:19–41 stores stopped, nextIndex and every rejection independently. The first rejection stops admission. Already running workers may still reject. Only the reason from the smallest failing input index is observable. Failure can be undefined; its presence cannot be tested by truthiness. No worker needs a failure map or a final scan over every task.
runBounded has three production call sites in tidy.ts and tidyReport.ts. None needs a signature change. cli/test/unit/engine-di.test.ts already controls overlap and completion order with promises and checks two failures arriving in reverse input order. Add an independent case where one worker rejects with undefined, another remains active, and a queued task must never start.
Engineering standards
The pool step uses type-safety-discipline, code-clarity, test-coverage, and engine-native-context. commit-discipline and code-review apply to landing. Keep the next input index in the accepting state. Only the draining state can carry a failure; its reason stays unknown. Use the TypeScript narrowing handbook. The change adds no dependency, public type or new behavior.
Decision: use a local two-state model. Keeping the map permits contradictions and a post-drain search; a state-machine library adds a dependency for two transitions. Revert the local change without migrating a caller. The lowest-index rule and the undefined regression guard against future conflation of completion order and input order.
docks-kit agent-docs verify-skill detect reported verify skill: present. None of its six flows drives tidy. Use the read-only public tidy command directly; do not add a verify flow for this internal refactor. Never pass --apply. Release, configuration and generated data do not change.
Tools: Linux x64, Node.js 26.13.0, Bun 1.4.5, git 2.53.0 and GitHub CLI 2.103.3 (local version output); Vitest 5.1.2 and effect-tsgo 0.74.1 (root package pins). A2 and A4 need the supported Node runtime on PATH. Commands use the repository root and installed dependencies. A5 is a landing check after the draft pull request opens.
Verification-only prerequisites (local version output): Bubblewrap 0.11.1, Bash 5.3.0, uutils coreutils 0.10.0 (dirname, uname, du, tail), and standalone jq 1.8.1. Run A3 and the A5 gate procedure in Bash. A3 uses private temporary mounts and a private tool directory. Only Bun, git, dirname, uname and du reach the CLI through PATH; it cannot invoke Docker or npm. The checkout contains installed dependencies, so the launcher does not install any. None of these requirements changes the product dependencies.
Decision after review stall: use an allowlist rather than guessing which host utilities to exclude. An outer read-only mount alone still exposes programs and service sockets. Reject a new container image and registry dependency for this small proof. Test the actual fixture in the restricted environment, with the launcher and its two output assertions. Keep the command reproducible in this issue. The setup is temporary and disposable. If a later launcher requires another tool, the proof must fail until the prerequisite is verified and named.
Experiment: A3 on the original implementation with the final allowlist exited 0 and printed tidy kept the dirty worktree and measured the seeded cache. Repeat it on the candidate; the baseline alone is not proof of the change.
Steps
| # | Id | Task | Files | Depends | Effect | Status | Done when |
|---|---|---|---|---|---|---|---|
| 1 | pool | Replace independent stop and failure tracking with one state and prove drain behavior | cli/src/engine-native/syncConcurrency.ts, cli/test/unit/engine-di.test.ts |
- | local | done | Workers can claim inputs only in the accepting state. After all active work ends, a draining pool throws the lowest-index reason unchanged, even when undefined. |
Acceptance
| ID | Command | Expected |
|---|---|---|
| A1 | git diff origin/main -- cli/src/engine-native/syncConcurrency.ts |
Inspect the candidate diff, before or after the commit: one state owns admission and phase-specific data. No stop flag or failure collection remains. A partial conversion or no implementation diff fails. |
| A2 | bun run test:unit cli/test/unit/engine-di.test.ts cli/test/unit/tidy.test.ts cli/test/unit/tidyReport.test.ts |
Pass. Verify overlap, ordered results and failures in reverse order. With the other worker held, the pool stays pending; after release it rejects with exactly undefined. The queued task never starts. |
| A3 | Run the isolated public CLI command below on Linux. | It exits 0, names the dirty fixture worktree in a keep line, reports the seeded cache path, and leaves both in place. This exercises nonempty worker input. |
| A4 | bun run check:types |
Project types and Effect diagnostics pass locally. For the repository-wide bun run check gate, use the matching jobs on the reviewed candidate, not a duplicate local full-suite run. |
| A5 | gh pr checks --required and the commands in SoT/.omp/plugin/skills/ci-speed/references/github-actions.md, “Verify a gate result” |
GitHub accepts Full CI from the GitHub Actions app. The maintainer ready event, attempt 1, workflow, actors, all jobs, reviewed head, current base and tested merge parents match. A previous green run cannot pass. |
bwrap --ro-bind / / --dev /dev --proc /proc --tmpfs /tmp --tmpfs /var/tmp --setenv TMPDIR /tmp -- \
bun -e 'import {createGitSandbox} from "./cli/test/lib/gitSandbox.ts"; import {mkdirSync,existsSync,symlinkSync} from "node:fs"; const s=createGitSandbox(); try { const cache=s.home+"/.cache/ms-playwright", bin=s.base+"/bin"; mkdirSync(cache,{recursive:true}); mkdirSync(bin); for(const name of ["bun","git","dirname","uname","du"]) { const path=Bun.which(name); if(!path) throw new Error("missing "+name); symlinkSync(path,bin+"/"+name); } const p=Bun.spawnSync(["./docks-kit","tidy","--repo",s.main,"--report"],{env:{PATH:bin,HOME:s.home,LC_ALL:"C",GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:s.base+"/gitconfig"},stdout:"pipe",stderr:"pipe"}); const out=p.stdout.toString(); if(p.exitCode!==0 || !out.includes("keep worktree "+s.worktrees.dirty+":") || !out.includes(" "+cache+"\n") || !existsSync(s.worktrees.dirty) || !existsSync(cache)) throw new Error("tidy fixture proof failed"); console.log("tidy kept the dirty worktree and measured the seeded cache"); } finally { s.dispose(); }'Do not touch
Do not change the public runner API, tidy policy, concurrency limits, paths, fixtures or dependency versions. Do not clean user resources.
Open questions
Verification Results
Reviewed candidate b6569346053ff2ef633e9158dfd2d8c4f585aa2d against 26c90afd43cba7e385f4c52de97855c953630ff2.
- A1 passed: only the accepting state owns the next index; only the draining state owns the minimum failing index and its original rejection reason. No stop flag, failure map or post-drain search remains.
- A2 passed on Linux: 3 files, 61 passed, 1 skipped (Windows-only report). The tests cover reverse failure order, pending work, exact
undefinedrejection and a queued task that never starts. - A3 passed on the candidate:
tidy kept the dirty worktree and measured the seeded cache. The disposable fixture was removed. - A4 passed:
bun run check:types. Targeted Oxlint andbun fmt --checkalso passed on both changed files. - A5 runs after review and publication. The complete local
bun run checkwas not run; do not tick that local command based on a remote result.
Final candidate 37dfb4a0fe07a25b0f5a0251f1a74c700794dc69, same base. The repair changes only the test. A1 still holds. A2 again passed: 61 passed, the one Windows-only case skipped. The two cases now assert the exact lowest-index reason in both rejection orders. A3 again kept the dirty worktree and measured the cache. A4, targeted Oxlint and formatting passed on the final files.
Candidate bb9b23bdffba12ff42f186ebf36420074a0b077d supersedes the previous test-only repair. A1 is unchanged. A2: 61 passed, one Windows-only case skipped. A3: the isolated public CLI kept the dirty worktree and measured the seeded cache. A4, targeted Oxlint and formatting passed. Both failure-order tests now create rejections only when the pool starts a task.
A5 passed on bb9b23bdffba12ff42f186ebf36420074a0b077d. CI run 46540091201 passed all 10 jobs on attempt 1. The ready actor had push access. The tested merge cb6d96bf3bbce8ee3d75172dd351f64fa8965d5c has the reviewed base and head as its parents. GitHub accepted Full CI for #274.
Activity
DocksDocks commentedon Nov 30, 2026
Delegation grant: yolo: next up is a yolo issue for "scan this codebase for any implicit state machines and make it explicit"
Parent event: 7294751276
DocksDocks commentedon Nov 30, 2026
Plan review round 1
Plan-review: repair
pool- The Goal requires the pool to reject with exactlyundefinedafter the other worker drains. The existing test only checks anErrorrejection (cli/test/unit/engine-di.test.ts:74–94), and A2 names the wait but not the pool's final outcome. A refactor that stops admission, waits, then fulfills because it treatsundefinedas no failure could pass those checks. The current runner distinguishes failure presence from its value (cli/src/engine-native/syncConcurrency.ts:37–41). - Make A2 require that the pool is still pending while the other worker is held, then rejects with exactlyundefinedafter release, with the queued task never started. - class: missing terminal outcome assertiontidy --repo .can exit 0 and printNothing to tidy.without starting a worker:listWorktreeCandidatesdrops the main worktree, andrunBoundedstarts zero workers for an empty list (cli/src/engine-native/tidy.ts:620–629,905–911;cli/src/engine-native/syncConcurrency.ts:24). The command also bypasses both report callers because--reportdefaults off (cli/src/commands/tidy.ts:32–35,113–118;cli/src/engine-native/tidyReport.ts:115,201). - Make A3 drive the real CLI against a known linked worktree and a known report entry, and require their observable output without--apply. - class: end-to-end check can bypass the changed behaviorTools; Acceptance A2 and A4 - The tool record omits Node.js.package.json:31,38launches Vitest and effect-tsgo through Node shebangs, which Bun respects by default. The installed Vitest 5.1.2 declares supported Node versions innode_modules/vitest/package.json:114–115. A checkout with Bun and installed dependencies but only Node 18 onPATHmeets the stated prerequisites yet runs A2 on an unsupported runtime. - Record the supported Node version used by both commands and make it a local prerequisite. - class: missing acceptance runtime prerequisitegh pr checks --requiredreports required check status but does not establish which ready event, attempt, or base SHA produced it.AGENTS.md:81requires that proof, and.github/workflows/parity.yml:3–5,10–31,191–208records it. If the base advances while the PR head stays unchanged, a green head check alone does not show that the new base was tested. - Keep the remote gate and make A5 match the successful GitHub ActionsFull CIcheck to the maintainer's ready event, attempt 1, and the recorded head, base, and test-merge SHAs. - class: landing status without tested-candidate provenanceDocksDocks commentedon Nov 30, 2026
Plan review round 2, delta
Plan-review: repair
--reportstill measures directories under the host's/tmpand/var/tmpand includes the absolute/tmp/.pnpm-storein the cache check (cli/src/engine-native/tidyReport.ts:47,71,95–119,178–209,497–502). Inference: a large unrelated temp tree can make this small fixture check wait on a full directory walk, and if the host pnpm store disappears during measurement, the cache section can omit the seeded Playwright path even when the pool is correct. - Keep the real CLI and both output assertions, but run the fixture in a disposable Linux environment with private temp roots. - class: fixture verification reads unscoped host dataTools; Acceptance A3 and A5 - The Node prerequisite is fixed, but the new commands have two unrecorded requirements. WithoutduonPATH, A3 emits an unavailable cache section instead of the seeded path (cli/src/engine-native/tidyReport.ts:95–119,475–481,501). Without standalonejq, A5 skips the per-commit check lookups (SoT/.omp/plugin/skills/ci-speed/references/github-actions.md:75–83);SoT/toolchain.json:4explicitly makesjqoptional, and GitHub CLI's built-in--jqdoes not provide that executable. - Record theduversion in A3's environment and either record standalonejqas an A5 prerequisite or extract the SHAs withgh pr view --jq. - class: missing acceptance runtime prerequisitePrevious findings:
pool: resolved - A2 now requires a pending pool before release, rejection with exactlyundefinedafter release, and no queued work started.Tools; Acceptance A2 and A4: open - repeated above for A3 and A5. The Node.js version andPATHrequirement are now explicit.Manager response to round 1
Repaired:
Rejected: none.
Redesigned: none.
DocksDocks commentedon Nov 30, 2026
Plan review round 3, delta
Plan-review: repair
/tmpand/var/tmpwalks, but the read-only root still exposes host sockets. With a reachable local Docker daemon,tidywaits fordocker psanddocker system dfbefore emitting the report. It also scans the host's global npm directory ifnpm root -greturns one (cli/src/engine-native/tidy.ts:125–132,931–942;cli/src/engine-native/tidyReport.ts:269–279,451–455,496–506; Bubblewrap socket limitations). Inference: a slow daemon can stall A3 even when both fixture assertions would pass. - Keep the real CLI, private mounts, and both assertions, but run with a fixture-only tool PATH that excludes Docker and npm. - class: fixture verification reads unscoped host dataTools; Acceptance A3 and A5 - Research now records Bubblewrap,du, and standalonejq, but A3 still needs/bin/bash,dirname, andunameinside the sandbox (docks-kit:1–6,18). A5's Bash procedure needstail -n 1and a shell that accepts the<<<here-string (SoT/.omp/plugin/skills/ci-speed/references/github-actions.md:57–66,75–83). With only the listed tools, A3 can stop before runningtidy, and A5 can fail to identify the latest ready event or run the per-commit lookups. - Specify Bash for the gate procedure and record the Bash and coreutils versions actually used by A3 and A5. - class: missing acceptance runtime prerequisitePrevious findings:
Tools; Acceptance A3 and A5: open - repeated aboveManager response to round 2
Repaired:
Redesigned:
Rejected: none.
DocksDocks commentedon Nov 30, 2026
Plan review round 4, delta
Plan-review: pass
None.
Previous findings:
tidylauncher a fixture-only PATH that excludes Docker and npm. The recorded baseline run passed both output assertions; A3 still requires rerunning the command on the candidate.Tools; Acceptance A3 and A5: resolved - Research now specifies Bash for both procedures and records the versions of Bash,dirname,uname,du,tail, and standalonejq.Manager response to round 3
Repaired:
Redesigned:
Rejected: none.
DocksDocks commentedon Nov 30, 2026
Self-review
Candidate
b6569346053ff2ef633e9158dfd2d8c4f585aa2d.Correctness
No findings. Admission increments the index before awaiting the task. On rejection the worker reads the current pool state, so an earlier input that rejects later replaces the selected reason. All workers drain before the pool throws.
Spec and tests
No findings. The existing cases cover bounded overlap and reversed failures. The new case yields one event-loop turn with an active task held; the pool must still be pending. It then checks the exact rejection and that queued work never starts.
Text and safety
No findings. The index and reason exist only in the phase that uses them. The public signature and caller behavior do not change. The refactor removes the map and final search without a new dependency.
DocksDocks commentedon Nov 30, 2026
Code review round 1, lens correctness
Code-review: pass
Standards
None.
Spec
None.
Code review round 1, lens spec-and-tests
Code-review: pass
Standards
undefinedreason, the assertion insiderun.thenrejectssettledbefore the test awaits it. Inference: Vitest can report an unhandled rejection instead of a clean failure at the pending-state assertion. - Record settlement and its reason without asserting inside the handler. Release the held worker infinallyand assert the reason in the test body. - class: delayed handling of assertion rejectionSpec
None.
Code review round 1, lens text-and-safety
Code-review: pass
Standards
undefinedreason, the callback throws before recording settlement. Inference:settledcan emit an unhandled rejection duringnextTurn(), while the pending assertion still sees no events. - Record the settlement and reason without asserting in the callback. Check that the pool is pending before releasing the active task, then await and assert the recorded outcome. - class: assertion in a deferred rejection observerSpec
None.
DocksDocks commentedon Nov 30, 2026
Code review round 2, delta
Code-review: pass
Previous findings
cli/src/engine-native/syncConcurrency.ts:14-17,cli/test/unit/engine-di.test.ts:75-124: fixed -cli/test/unit/engine-di.test.ts:91-94,119-127asserts the exact lower-index reason in both rejection orders.cli/test/unit/engine-di.test.ts:112-124: fixed -cli/test/unit/engine-di.test.ts:112-127records settlement without asserting in the handler, releases the held task infinally, and checks the reason in the test body.cli/src/engine-native/syncConcurrency.ts:14-17,cli/test/unit/engine-di.test.ts:75-124: fixed -cli/test/unit/engine-di.test.ts:119-127checks that a later failure during drain does not replace the retainedundefinedreason.cli/test/unit/engine-di.test.ts:112-124: fixed -cli/test/unit/engine-di.test.ts:112-127records rejection before the pending-state check can fail and no longer throws an assertion from the rejection handler.Standards
finallyblock then rejects a fixture promise that no worker has observed. Inference: Vitest reports an extra unhandled rejection alongside the assertion failure. - Havefinallyresolve a release gate and make the second task throw after awaiting that gate. If the task never starts, cleanup creates no rejection. - class: rejecting an unobserved fixture promise during cleanupSpec
None.
Manager response to round 1
Repaired:
Rejected: none.
Redesigned: none.
DocksDocks commentedon Nov 30, 2026
Code review round 3, delta
Code-review: pass
Previous findings
cli/test/unit/engine-di.test.ts:100-105,119-124: fixed - Both failure-order tests now resolve gates. Only a task the pool starts can reject, so thefinallyblock cannot create an unhandled rejection if the second worker never starts (cli/test/unit/engine-di.test.ts:12-20,76-96,99-128).Standards
None.
Spec
None.
Manager response to round 2
Repaired:
Rejected: none.
Redesigned: none.
DocksDocks commentedon Nov 30, 2026
Archived with landing pull request #274