fix(bin/context-audit.sh): string Read offsets no longer crash; always exit 0 - #184
Merged
Merged
Conversation
…s exit 0 Older transcripts store Read offset/limit as strings, sometimes junk like '30, 90'; 'offset - 1' raised and stopped the run. Parse as int, fall back to the Read tool's defaults, and exit 0 with a 'partial' note if the reader ever dies. Field run: 1,300 sessions + 724 subagent runs on a Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
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.
What changed and why (one paragraph)
On a machine with older transcripts,
bin/context-audit.shcrashed inside its embedded reader: those transcripts store a Readoffset/limitas a string, sometimes junk like'30, 90', andoffset - 1raised a TypeError that stopped the whole run, although the header promises exit 0. Offset and limit are now parsed as integers and fall back to the Read tool's defaults (offset 1, limit 2000) when they do not parse. If the reader ever dies on a transcript shape nobody has seen, the shell wrapper prints that the numbers are partial and still exits 0.Field evidence
Run on a Mac holding 1,300 sessions and 724 subagent runs (2026-08-27 to 2026-09-30): the merged version crashed at the offset arithmetic; with the same fix applied by hand, the run completed. The parser was checked here on the reported values:
'30, 90'→ 1,'30'→ 30, missing → 2000,40→ 40.Checklist
test-context-audit.shfixture uses numeric offsets and is unaffected🤖 Generated with Claude Code
https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Generated by Claude Code