[codex] Cap persisted Claude tool-result reads - #1293
Open
alexkreidler wants to merge 1 commit into
Open
Conversation
roborev: Combined Review (
|
alexkreidler
marked this pull request as ready for review
July 28, 2026 20:38
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.
Closes #1292.
Claude Code can persist oversized tool output in a sidecar under a session's
tool-resultsdirectory. AgentsView previously loaded that sidecar withos.ReadFileand embedded the complete value into the reconstructed message. A multi-gigabyte sidecar therefore produced several multi-gigabyte allocations during parsing and JSON marshaling, eventually exceeded SQLite's value-size limit, left startup sync incomplete, and could trigger an operating-system SIGKILL during retry.This change reads persisted tool-result sidecars through a 16 MiB limit. Larger results retain their bounded prefix and gain an explicit truncation marker, keeping the archive searchable and the truncation visible without allowing one sidecar to exhaust process memory.
The regression test uses a sparse oversized sidecar and verifies both the cap and marker. I also validated the change against the original failure shape: the affected session synced in under a second with roughly 202 MiB maximum RSS instead of reaching roughly 26 GiB, and a full archive resync completed successfully.
Validation:
go test ./internal/parser -count=1.