fix(ctx_read): never mint an [unchanged] stub in the full-read fallback - #1132
Closed
andig wants to merge 1 commit into
Closed
fix(ctx_read): never mint an [unchanged] stub in the full-read fallback#1132andig wants to merge 1 commit into
andig wants to merge 1 commit into
Conversation
…ck (yvgude#1128) The full-read path decided stubbing twice: once via the conversation-scoped gate try_stub_hit_readonly, then again inside handle_full_with_auto_delta off StoreResult.full_content_delivered. The second decision has no conversation context — the flag is carried over from the cache entry, so it answers 'some conversation received this content', which is exactly what yvgude#954 stopped trusting. A first read in a fresh conversation could therefore come back as a content-free stub. Drop the duplicate branch so the gate is the single decision point and the fallback always delivers content. render_unchanged_stub is now the only place that formats the stub.
Contributor
Author
|
Adjacent, deliberately out of scope here: cache-hit detection in 🤖 Generated with Claude Code |
Owner
|
Cherry-picked to main as 17cbfc7. Fix verified: full_read_fallback_never_mints_stub test passes, [unchanged] stubs no longer emitted for uncached files. Thank you! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Fixes #1128.
A
mode="full"read decided stubbing twice. First throughtry_stub_hit_readonly, the conversation-scoped gate from #954/#955 — which correctly withholds the stub when a different conversation received the content. Then again insidehandle_full_with_auto_delta, offstore_result.full_content_delivered, with no conversation context at all: that flag is copied from the cache entry (core/cache.rs:608), so it answers "some conversation got this content", which is the question the gate exists to stop trusting.Result: a first read of a file in a fresh conversation could come back as
[unchanged 143L · fresh=true to re-read]with no content — indistinguishable from a successful read, because the daemon outlives individual chats and an earlier session's delivery satisfied the flag.The fix removes the duplicate decision rather than adding a second gate to it. Stubbing is now decided in exactly one place, by the one function that has the conversation identity, and
handle_full_with_auto_deltais a pure content-deliverer — so a future caller cannot reintroduce an unscoped stub by reaching the fallback.render_unchanged_stubis now the only site that formats the[unchanged …]string.Same-conversation re-reads are unaffected: they collapse at the gate and never reach the fallback, so cache-hit savings stay as they were.
Test plan
cd rust && cargo test -- --test-threads=1— lib suite 8344 passed / 0 failed. One pre-existing failure intests/critical_module_integration.rs::pathjail_blocks_traversal, reproduced identically on unmodifiedorigin/mainin this environment.cd rust && cargo clippy --all-targets --all-features -- -D warnings— fails on two warnings that also fail on unmodifiedorigin/main(core/ocla/tracing.rs:225items-after-test-module,proxy/ocla_cache_bridge.rs:84Duration unit). Nothing new from this change.cd rust && cargo fmt --check— clean.full_read_fallback_never_serves_a_stubverified red before the change (asserts on the stub text) and green after.Notes for reviewers
handle_full_with_auto_deltawithout consultingtry_stub_hit_readonlyfirst —mod.rs:952is the only call site I found.🤖 Generated with Claude Code