Skip to content

Make terminal and child-process lifetimes explicit - #275

Merged
DocksDocks merged 7 commits into
mainfrom
269-make-cli-terminal-and-child-process-lifetimes-explicit
Dec 1, 2026
Merged

DocksDocks merged 7 commits into
mainfrom
269-make-cli-terminal-and-child-process-lifetimes-explicit

Conversation

@DocksDocks

@DocksDocks DocksDocks commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Plan run: #269 Make CLI terminal and child-process lifetimes explicit

Pull request: #275. All 10 jobs passed in Full CI run 46547968375 on reviewed head d168ea0a1d6dbb254dac355aafbd69d206c7928d.

What changed

  • Make the current terminal lease the authority for coordinator writes. Keep durable buffering separate from progress display and the queue of admitted actions.
  • Assign completion to whichever arrives first: the child close event or its deadline. Preserve the existing returned values and output streams.

Decisions and corrections

  • Keep admission and scheduling per lease, including work admitted before release. The current production pipeline does not enter withExclusive; tests exercise that API.

Delegated decisions

Reviews

The plan passed in round 2. Code review passed on the final candidate in round 6. No findings remain open.

Verification

  • A1: reviewed the terminal authority, write buffer, listener retirement and timeout result type.
  • A2: all 138 tests passed in seven suites. One synchronized real-process test covers both partial streams and termination of the child tree. Other cases cover real spawn failure and reentrant sink failure.
  • A3 and A6: public sync dry run and toolchain check matched their goldens. The isolated public tidy command kept the dirty worktree and reported the seeded cache.
  • A4: bun run check:types, targeted Oxlint and Bun formatting passed.
  • A5: the first run found a stale skill range. The fix passed skillMetadata.test.ts. The next run could not acquire a macOS runner. The final run passed all 10 jobs on the same repaired head, including the required Full CI check.

Limits and failures

The complete bun run check command did not run locally; the required remote gate covers the full suite.

Kept resources

If left open: #269, its linked branch, and this pull request. Parent #267 and the remaining child issues stay open.

After merge

Archive #269 and mark the engine row done in #267. No deployment or release.

Checklist

  • bun run check passes locally: not run in full.
  • bun run check:types passes.
  • Tested locally end to end (A3 and A6).
  • Required Full CI passes on the reviewed head against current main.
  • Code review passes on the candidate.

Closes #269

Keep the write buffer active only while an exclusive action owns output.

Verified: bun run test:unit cli/test/unit/logger.test.ts; bun run check:types; bun run lint cli/src/engine-native/logger.ts cli/test/unit/logger.test.ts; bun fmt --no-script --check cli/src/engine-native/logger.ts cli/test/unit/logger.test.ts
Let only the winning deadline or close event perform terminal cleanup.

Verified: bun run test:unit cli/test/unit/exec.test.ts; bun run check:types; bun run lint cli/src/engine-native/exec.ts cli/test/unit/exec.test.ts; bun fmt --no-script --check cli/src/engine-native/exec.ts cli/test/unit/exec.test.ts
Document lease handoff and check sink failures, missing executables and both partial output streams.

Verified: bun run test:unit cli/test/unit/{logger,exec,syncLock,bun,deps,tidy,toolchain}.test.ts; bun run check:types; bun run golden:dryrun (public sync and toolchain); isolated public tidy; targeted lint and format
Use a controlled deadline with a real child and real pipes. Assert the timeout result and wait for the child to close.

Verified: bun run test:unit cli/test/unit/{logger,exec,syncLock,bun,deps,tidy,toolchain}.test.ts; bun run check:types; public sync and toolchain goldens; isolated public tidy; targeted lint and format
Wait for complete lines on both pipes before expiring one deadline. Derive the fixture watchdog and cleanup reserve from the platform ceiling.

Verified: bun run test:unit cli/test/unit/{logger,exec,syncLock,bun,deps,tidy,toolchain}.test.ts; bun run check:types; public sync and toolchain goldens; public tidy; targeted lint and format
Remember the grandchild as soon as its complete PID arrives. Restore the clock before cleanup and tolerate an already exited process.

Verified: 138 focused tests; bun run check:types; public sync and toolchain goldens; public tidy; targeted lint and format
@DocksDocks DocksDocks linked an issue Dec 1, 2026 that may be closed by this pull request
@DocksDocks
DocksDocks marked this pull request as ready for review December 1, 2026 00:22
Update the source extents for the logger and process runner. The portable CI gate caught the stale logger extent.

Verified: skillMetadata.test.ts; 138 behavior tests; bun run check:types; targeted lint and formatting; both public goldens and the public tidy proof
@DocksDocks
DocksDocks marked this pull request as draft December 1, 2026 00:30
@DocksDocks
DocksDocks marked this pull request as ready for review December 1, 2026 00:30
@DocksDocks
DocksDocks marked this pull request as draft December 1, 2026 00:46
@DocksDocks
DocksDocks marked this pull request as ready for review December 1, 2026 00:46
@DocksDocks
DocksDocks merged commit 2120ef6 into main Dec 1, 2026
18 of 20 checks passed
@DocksDocks
DocksDocks deleted the 269-make-cli-terminal-and-child-process-lifetimes-explicit branch December 1, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make CLI terminal and child-process lifetimes explicit

1 participant