Save each checkpoint's own stdout and stderr after a crash or retry - #37
Open
robo-carver wants to merge 2 commits into
Open
robo-carver wants to merge 2 commits into
robo-carver wants to merge 2 commits into
Conversation
robo-carver
force-pushed
the
claude-code-stdout-keeps-stream
branch
3 times, most recently
from
September 19, 2026 01:27
f69f506 to
813c66f
Compare
robo-carver
marked this pull request as ready for review
September 19, 2026 01:36
robo-carver
force-pushed
the
claude-code-stdout-keeps-stream
branch
from
September 19, 2026 01:39
813c66f to
9e0f522
Compare
Two cases. A checkpoint whose _run() raises mid-stream should save the lines it streamed before the crash, and no stderr.log. A process that times out and is retried should save both attempts' stdout and stderr in order. Both fail until the next commit. The crashed checkpoint saves the previous checkpoint's stdout, and the retry saves only its own attempt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LneU62tU8gzRdn2GCE8arW
_write_artifacts() wrote stdout.jsonl and stderr.log from final_result, which only a finished _run() sets and nothing clears. When _run() raised mid-stream, the checkpoint saved the previous checkpoint's stdout and stderr, and the lines that caused the crash were lost. A retry also replaced the output of the attempt it retried. Record each stdout line as _run() parses it and write stdout.jsonl from those lines. A crash now leaves its partial stream, and a retry appends to the attempt before it. Collect each finished process's stderr the same way. That was final_result's last use, so remove it, and run() clears both lists. A crashed checkpoint writes no stderr.log instead of another checkpoint's. A process that printed nothing to a stream writes no file for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LneU62tU8gzRdn2GCE8arW
robo-carver
force-pushed
the
claude-code-stdout-keeps-stream
branch
from
September 19, 2026 01:41
9e0f522 to
3d2ac94
Compare
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.
Fixes #36.
_write_artifacts()writesstdout.jsonlandstderr.logfromfinal_result, which only a finished_run()sets and nothing clears. When_run()raises mid-stream, the checkpoint saves the previous checkpoint's output and the lines that caused the crash are lost. A retry also replaces the output of the attempt it retried. Details are in the issue.Two commits. The first adds
TestStreamTranscriptArtifactsand fails on main, 2 of 2. The second records each stdout line as_run()parses it and writesstdout.jsonlfrom those lines, so a crash leaves its partial stream and a retry appends to the attempt before it. It collects each finished process's stderr the same way, sostderr.logkeeps every attempt too. That was the last use offinal_result, so the field is gone. A crashed checkpoint writes nostderr.logwhere it used to write another checkpoint's. 24 lines inagent.py.One behavior change. A process that prints nothing to stdout or stderr now writes no file for that stream, where main writes an empty one. Nothing in
src/reads either file.🤖 Generated with Claude Code
https://claude.ai/code/session_01LneU62tU8gzRdn2GCE8arW