fix: Hook stdin reader hangs on parallel agent completions (#1021)#1027
Open
justinkatz94-glitch wants to merge 1 commit intodanielmiessler:mainfrom
Open
fix: Hook stdin reader hangs on parallel agent completions (#1021)#1027justinkatz94-glitch wants to merge 1 commit intodanielmiessler:mainfrom
justinkatz94-glitch wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
…ssler#1021) Three bugs in PAI hook stdin reading code cause intermittent hangs when multiple agents complete simultaneously (e.g., council debates): 1. hook-io.ts: Dangling Bun stdin reader after Promise.race timeout - Added reader.cancel() after timeout, increased timeout 500ms→2000ms 2. PRDSync.hook.ts: Synchronous readFileSync(0) blocks indefinitely - Converted to async Bun.stdin.stream() with 2s timeout + cancel 3. IntegrityCheck.hook.ts: Same dangling reader as hook-io.ts - Added reader.cancel() + timeout increase Closes danielmiessler#1021
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.
Summary
Fixes three bugs in PAI hook stdin reading that cause intermittent hangs when multiple agents complete simultaneously (e.g., council debates with 4+ parallel agents).
Bun.stdin.stream().getReader()afterPromise.racetimeout — addedreader.cancel(), increased timeout 500ms→2000msreadFileSync(0)blocks indefinitely under CPU contention — converted to asyncBun.stdin.stream()with timeout + cancelTest plan
Closes #1021
🤖 Generated with Claude Code