Skip to content

fix(cursor): reuse conversation checkpoints for incremental continuation - #1940

Draft
keepitmello wants to merge 1 commit into
lidge-jun:devfrom
keepitmello:fix/cursor-checkpoint-continuation
Draft

fix(cursor): reuse conversation checkpoints for incremental continuation#1940
keepitmello wants to merge 1 commit into
lidge-jun:devfrom
keepitmello:fix/cursor-checkpoint-continuation

Conversation

@keepitmello

@keepitmello keepitmello commented Aug 17, 2026

Copy link
Copy Markdown

Summary

  • Preserve Cursor's returned ConversationStateStructure after a successful no-tool turn and reuse that snapshot on the next validated linear continuation instead of rebuilding the full root history.
  • Tool-result turns reuse the last completed-turn checkpoint plus only the uncovered suffix when the covered message boundary is known.
  • Keep the existing full-replay path for compaction, helper/shadow isolation, account or model mismatch, missing/expired refs, decode failures, restart, and invalid_argument recovery.
  • Bind checkpoint snapshots to conversation id, credential identity scope, and model affinity. Persist only an opaque process-local checkpointRef on Responses continuation state, and pin referenced blobs for the checkpoint lifetime.
  • Do not treat OpenCodex usage or missing cache counters as a cache-hit rate. Cursor Connect still reports only usedTokens/maxTokens.

Refs #1527

Verification

What this change is supposed to prove is that a validated no-tool follow-up stops rebuilding old root history. Unit-test green is only the repo gate, not that proof.

Observed on this branch against the same Cursor account, after the local 2.24.2 process was running from this tree:

  • Offline 3-turn full-replay baseline grew rootBytes 58 → 40,175 → 80,292.
  • Live no-tool follow-up on this tip used continuationMode=checkpoint, same Cursor conversation id, rootBytes=0, and still answered from the prior turn (BETA-9).
  • Official cursor-agent control on the same account / cursor-grok-4.6-low: turn 1 cacheReadTokens: 0 / input 18937; resume turn 2 cacheReadTokens: 18816 / new input 331 / answer ALPHA-7. OpenCodex still cannot report that counter authoritatively, so this is comparison data only.

Not shown, and not claimed:

Repo gate only, so a reviewer can reproduce the mechanical checks:

  • bun run typecheck
  • bun test tests/cursor-request-builder.test.ts tests/cursor-blob.test.ts tests/cursor-adapter.test.ts tests/cursor-discovery.test.ts tests/cursor-protobuf-events.test.ts tests/cursor-live-transport.test.ts tests/cursor-tool-continuation.test.ts tests/responses-state.test.ts
  • bun run test
  • bun run privacy:scan

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Preserve Cursor's returned ConversationStateStructure after a successful
no-tool turn and reuse that snapshot on validated linear continuations
instead of rebuilding the full root history.

Tool-result turns reuse the last completed checkpoint plus only the
uncovered suffix. Compaction, helper/shadow isolation, account or model
mismatch, missing refs, decode failures, and invalid_argument recovery
keep the existing full-replay path.

Bind checkpoint snapshots to conversation, credential identity, and
model affinity. Keep an opaque process-local checkpointRef on Responses
continuation state, pin referenced blobs for the checkpoint lifetime,
and never treat OpenCodex usage as a cache-hit counter.

Refs lidge-jun#1527
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 96d8c435-e383-47c7-a5b2-b2a75e97f6e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (2/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 2/4).

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

2/4 boxes ticked.

This PR stays in draft until every box above is ticked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant