Repository navigation
fix(runtime): pruned read_file stubs keep their window and name the re-read (AP2) - #233
Merged
lg2m merged 2 commits intoOct 2, 2026
Merged
Conversation
…e-read A pruned read_file result lost its header, because the header names the operation (`read`) while the stub looked for the tool name. The stub then said "call it again if needed", and a re-read that passed a remembered hash through if_changed_since came back `unchanged` with no body, for text that was no longer in context. The stub now keeps `read <path> L…/… [fields]`, drops the `h:` token, and says to re-read the needed lines without if_changed_since. Other tools' stubs are unchanged. Live and assembly pruning share one function, so both produce the same text. AP2 of docs/plans/autonomous-core.md (ADR-0054). Linear: ENG-988
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
A path segment shaped like h:<hex> is kept. The live-pruning test now asserts the same stub shape as assembly (review follow-up). Linear: ENG-988
This was referenced Oct 1, 2026
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.
Slice AP2 of
autonomous-core.md(ADR-0054 § Context) · Linear ENG-988 · Base: #232 (the plan revision).What changes for users
When a long session prunes an old
read_fileresult, the model used to see:That stub has no line window, so the model re-read the whole file. If it passed a hash it still remembered through
if_changed_since, the re-read came backunchangedwith no body, even though the text was no longer in context. In the session store, one child read the same file 47 times. The stub now reads:Design
header_linematches a header by tool name, butread_file's header starts withread. The pruning code now looks upreadforread_fileand splices out the trailingh:token (h:-too, for unhashed files). The window, line count and other fields are kept.searchandtree, which already kept their headers.prune_stale_tool_results, so they produce the same stub text. The replay invariant is unaffected.docs/design/tools.md§ Headers is amended to match.Verification
Regression
pruned_read_file_stubs_keep_the_window_drop_the_hash_and_name_the_rereadfailed on the base: it got the bare stub with no header. It passes now. It covers a windowed read, an unhashed (h:-) read, and a path that contains a hash-shaped segment. Only the trailing hash is spliced out.a_run_that_outgrows_the_window_stubs_its_stale_reads_instead_of_failingnow asserts that live pruning produces the same stub shape as assembly.Independent read-only review approved, with should-fixes that are all taken in
0329a8c.Four existing tests asserted that the stub starts with
[prunedor ends with the old hint. They now assert the new shape, including that the hash is absent.cargo test --workspace: 2008 passed (2012 with AP1 stacked), 0 failed.cargo clippy --workspace --all-targets --all-features -D warningsandcargo fmt --checkare clean.context_assemblybench: 500 iterations, 4 runs each, A/B on the same host. Assemble medians:The before and after ranges overlap, and IO pressure was 20–37 % during the runs, so the differences are within noise. The bench's fixture prunes
read_fileresults, so it exercises the new path. Raw output is intarget/qq-perf/ap2-2026-10-01/.Compatibility
No protocol, descriptor or store change. Old sessions replay with the new stub text, since stubs are computed at assembly and stored rows are untouched. A pruned stub is a few bytes longer, but still shorter than the result it replaces; otherwise it is not used.