Repository navigation
fix(agent): a cut background job shows its whole run when it fits - #464
Merged
Merged
Conversation
Background job output is kept in memory as its last 64 KB, so a long run lost its head (the first error, the setup lines). The full output is on disk in the job's scratch log. When a job ends with its tail cut, the log is re-read and cleaned; if that fits in 64 KB (repeated and similar lines fold), it replaces the tail. A log that hit its own cap, or still does not fit, leaves the tail as before. bench_tokens.py request 6 now starts at the command's first line instead of "[earlier output dropped past 64 KB]" + case_1047, at the same size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Why
A background job keeps its last 64 KB of output in memory. A long run (e.g. a test suite printing 4,000 lines) lost its head: the model saw
[earlier output dropped past 64 KB; full log: read proc://bg-1]and thentest case_1047 ... ok. The first error or setup line was gone unless it read the log.What
The whole output is already on disk in
.whycodes/scratch/<id>.log. When a job ends with its tail cut:clean_terminal_output(which folds repeated and, since perf(sandbox): collapse runs of lines that differ only in numbers #461, numbers-only-differ lines);MAX_JOB_OUTPUT_BYTES, it replaces the tail.Unchanged: a log that reached
MAX_JOB_LOG_BYTES(its end is missing), a log still over 64 KB once cleaned, a missing log, a job that was never cut.Measured (
bench_tokens.py, release)Request 6 now starts at the command's first line (
test case_1 ... ok/[3998 similar lines…]/test case_4000 ... ok) instead of a dropped-head notice. Size is the same (16,199 → 16,176 tokens): this restores content, it does not add any.Checks
cargo test -p whycodes-agent --lib(770 pass; new test covers restored / never cut / no log / too big / at cap / missing)🤖 Generated with Claude Code