fix(subagents): drain spawn hook stdout before exiting - #80
Open
thisisjun786 wants to merge 5 commits into
Open
Conversation
release: promote CodexClaw 0.2.18
docs: promote corrected hook lifecycle references
chore(release): promote v0.2.19 quiet peer coordination
chore(release): promote v0.2.20 native-stack opt-in policy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Large spawn-hook responses are truncated when stdout is a pipe on POSIX. The CLI calls
process.exit(0)immediately afterprocess.stdout.write(out), before the asynchronous write drains. This can discard the entireupdatedInputrewrite, including configured subagent model/effort and attached skill instructions.A real three-skill spawn produced 81,754 bytes, but the installed CLI emitted only 65,536 bytes and exited 0. Changing pipe capacity to 4 KiB or 8 KiB moved the truncation boundary accordingly.
Change
Allow pending stdout writes to finish by using
process.exitCode = 0and natural exit. Regenerate the shipped JavaScript and add real CLI regression coverage for large piped JSON, including model/effort and message preservation.Validation
npm test: 2,580 total, 2,509 passed, 0 failed, 71 skipped. Used an isolatedTMPDIRbecause this host has an unrelated/tmp/.gitmarker that affects the existing project-root tests.npm run build, inventory check with measured total 2,580, and repository gate: passed. README test badges were regenerated as required by CI.No role detection, configuration schema, or policy changes. Local live verification is Linux-only; the existing CI matrix covers macOS and Windows.