You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The report is encoded once with an incremental encoder, so encoder state (UTF-16, UTF-8-with-BOM) carries across lines and newlines use the stream's encoding. How it's written depends on the destination:
Pipes: records of at most PIPE_BUF, split at encoded-newline and character boundaries, one os.write each. Writes that size are atomic, so a record never interleaves with other stderr writers or splits a character. Writing stops on BlockingIOError.
Files and terminals: short writes are completed in a loop.
Live: uvicorn host.main:app with SM_ENVIRONMENT=development, stderr on a pre-filled 4 KiB blocking pipe that nobody reads, and uvicorn and app logging silenced so the diagnostics writer is the only stderr writer. The app booted (/health 200) and exited 0.3 s after SIGTERM. With uvicorn's own logging left on, the process blocks in uvicorn's main-thread logging; that's outside the framework's control.
Review: 3 passes.
Pass 1 found 2: a single large write could interleave with concurrent writers and split UTF-8; the Windows console leaked descriptors.
Pass 2 found 2: short writes on files and terminals lost output; per-line encoding broke UTF-16 and BOM.
All fixed with regression tests: concurrent Unicode through a real pipe, PTY short writes, UTF-16 and utf-8-sig, descriptor stability, and a bounded exit with a full blocking pipe. Pass 3 was clean.
Local CI: make lint ✓, make test-js 998 passed, make test-py 9507 passed.
/ship passed on 8818af5
Rounds: 1 of 3
Review: 3 passes; pass 1 found 2 (unbounded single write interleaved/split UTF-8; Windows console fd leak), pass 2 found 2 (short writes on files/ttys lost output; per-line encoding broke UTF-16/BOM), all fixed with regression tests; pass 3 clean.
QA: live dev app with stderr on a pre-filled never-read blocking pipe (uvicorn/app logging silenced): /health 200, exited 0.3 s after SIGTERM.
Local CI: make lint ✓, make test-js 998 passed, make test-py 9507 passed.
CI: PR checks SUCCESS
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
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
dup()'d stderr descriptor instead ofsys.stderr's text buffer. If the reader never drains a blocking pipe, the daemon writer blocks on its own descriptor whilesys.stderr's lock stays free, so the interpreter's final flush can't hang at exit. Closes Dev boot: a stderr whose reader never drains can delay interpreter exit #1031PIPE_BUF, split at encoded-newline and character boundaries, oneos.writeeach. Writes that size are atomic, so a record never interleaves with other stderr writers or splits a character. Writing stops onBlockingIOError.finally, with nofdopen, which fixes a Windows console descriptor leak. Capture paths with nofileno(CliRunner, capsys), doctor output and the once-per-process dedupe from Dev boot crashes with BlockingIOError when stderr is a non-blocking pipe #1024 are unchanged. The Dev boot crashes with BlockingIOError when stderr is a non-blocking pipe #1024 CHANGELOG note is updated.Verification
uvicorn host.main:appwithSM_ENVIRONMENT=development, stderr on a pre-filled 4 KiB blocking pipe that nobody reads, and uvicorn and app logging silenced so the diagnostics writer is the only stderr writer. The app booted (/health200) and exited 0.3 s after SIGTERM. With uvicorn's own logging left on, the process blocks in uvicorn's main-thread logging; that's outside the framework's control.make lint✓,make test-js998 passed,make test-py9507 passed.Test plan
https://claude.ai/code/session_01FXHA3Zj78w6GWaNKoovHq6