Skip to content

fix(runner): avoid stdin backpressure before output readers start - #110

Draft
Haloukaidi wants to merge 1 commit into
lbx154:mainfrom
Haloukaidi:fix/prompt-stdin-backpressure
Draft

fix(runner): avoid stdin backpressure before output readers start#110
Haloukaidi wants to merge 1 commit into
lbx154:mainfrom
Haloukaidi:fix/prompt-stdin-backpressure

Conversation

@Haloukaidi

Copy link
Copy Markdown

Prompt delivery currently writes synchronously to the child's stdin before stdout/stderr readers and watchdog checks start. A child that emits enough startup output before reading a long prompt can fill both pipe buffers and leave both processes waiting.

Provide the UTF-8 prompt through a seeked temporary file inherited as stdin. The parent does not write into a live child's pipe; newline/EOF behavior and prompt privacy are retained. The temporary parent handle is closed when spawning finishes, including spawn failure. Existing file-based prompt paths use closed input through DEVNULL.

Validation on Windows / Python 3.13:

  • 38 tests passed across new stdin backpressure cases, Claude prompt delivery, and stream callbacks.
  • Real subprocess cases cover large ASCII and Unicode prompts with large startup stdout/stderr, stop/hard-idle while the child never reads input, and temporary-input cleanup on spawn failure.
  • Ruff and git diff --check passed.

Draft pending cross-platform review and CI. This change is independent of Windows descendant ownership and output-reader cleanup.

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.

1 participant