Repository navigation
Conversation
Every Cursor run started a new conversation and flattened the whole Claude Code transcript into one user message. The prompt cache then matched only Cursor's own system prompt, so each new turn, and each request after a tool call recovered from the text channel, wrote the full context to the cache again. Keep the conversation of each Claude Code session, model, system prompt and tool set: the conversation id, the last checkpoint (kept byte for byte, since prost drops the fields this crate does not model) and the agent-store blobs. When the next request extends the transcript the run saw, send the checkpoint back with only the new messages. A run stopped on a text-channel tool call reads its turn to the end in the background so its final checkpoint holds the call; the next request waits for it. Any mismatch starts a new conversation as before. Log the upstream token counts of each run next to whether it continued, and add CCP_CURSOR_CONTINUATION=off to turn the behaviour off.
cursor_cli_logout_does_not_error called the real logout in process, so running the test suite deleted the developer's stored Cursor credentials. Cover cursor logout in the CLI test that already runs kimi logout in a subprocess with an empty config directory and home.
Claude Code adds a system-role message after each user turn when a hook or output style is active. Continuation required every message after the stored reply to be a user turn, so those sessions always started a new conversation. Accept any message except another assistant reply.
joboyx
marked this pull request as ready for review
November 26, 2026 03:49
This branch has not been deployed
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.
Summary
conversation_checkpoint_updatebytes and the agent-store blobs (the client now answersSetBlobandGetBlob).AgentRunRequest.conversation_statewith only the new messages. An edited transcript, a compaction or a changed tool list starts a new conversation with the full prompt, as before.<tool_use>ends the stream early, drain the Cursor run to the end of its turn in the background, so that the checkpoint holds the call. The next request waits up to 30 s for it.cursor_conversation(the outcome per request) andcursor_turn_usage(Cursor's input, output, cache-read and cache-write token counts).CCP_CURSOR_CONTINUATION=offrestores the old behaviour. The docs describe the switch; the old "Session continuation" text described a session mapping andcursor_chat_idmetadata that the code does not have.cursor_cli_logout_does_not_errorran the real logout and deleted the developer's Cursor sign-in. The logout test now runs against an isolated home.Why
Each request used a new conversation id and flattened the system prompt, the transcript and the tools into one user message. Cursor's prompt cache matches only at block boundaries, so every turn wrote the whole context to the cache again.
Validation
cargo test --allpassed (991 lib tests and all integration test files) with isolated configuration.cargo fmt --all -- --checkandcargo clippy --all-targets -- -D warningspassed.tests/cursor_native.rscover a continued next turn, a tool result after a text-protocol tool call, and a changed history.