fix: scope read stubs by session_id on hosts without conversation_id (#1004)#1006
Closed
andig wants to merge 2 commits into
Closed
fix: scope read stubs by session_id on hosts without conversation_id (#1004)#1006andig wants to merge 2 commits into
andig wants to merge 2 commits into
Conversation
…vgude#1004) ctx_read(mode=full) could serve an [unchanged] stub on the first read of a file in a new session, pointing the model at content that session never received. The conversation-scope gate already re-delivers full content to a different conversation, but only Cursor supplied a scope id (conversation_id). Claude Code / Codex / CodeBuddy send session_id and no conversation_id, so current_conversation_id() resolved None and the gate fell through to the legacy "allow stub" path — a new session inherited the prior one's stubs. Persist session_id into active_transcript.json and use it as the scope-id fallback (conversation_id.or(session_id)). This reuses the existing warm/cold/concurrency/subagent gate, so every tool that funnels through the shared read cache is covered. New session -> new id -> full re-read; resume -> same id -> stub valid; /clear -> new id -> re-read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
Superseded by and integrated into #1013, including the session-scoped read-stub fix plus end-to-end hardening and full cross-platform CI. The original commit/authorship remains preserved in the integrated history. Thank you for the careful fix. |
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.
Problem
Fixes #1004.
ctx_read(mode=full)could serve an[unchanged]stub on the first read of a file in a new session, pointing the model at content that session never received.Root cause
The conversation-scope gate (
core/conversation.rs) already re-delivers full content when a different conversation reads a file — but only Cursor supplied a scope id (conversation_id). Claude Code / Codex / CodeBuddy sendsession_idand noconversation_id, socurrent_conversation_id()resolved toNoneand the gate fell through to the legacy "allow stub" path. A new session therefore inherited the prior session's stubs.Fix
Establish session awareness for those hosts: persist
session_idintoactive_transcript.jsonand use it as the scope-id fallback (conversation_id.or(session_id)). This reuses the existing warm/cold/concurrency/subagent gate unchanged, so every tool that funnels through the shared read cache is covered.Session semantics fall out naturally:
/clear→ new id → re-readChanges
hook_handlers/observe.rs: extractsession_id, persist it, and returnconversation_id.or(session_id)fromload_active_transcriptcore/conversation.rs: module doc updatedTests
2 new round-trip tests; existing conversation / cache / stub-index / compaction-sync suites (26 tests) pass.
🤖 Generated with Claude Code