Skip to content

[WRONG BRANCH] fix(cursor): persist and enforce tool-suspended checkpoint snapshots - #358

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-suspended-checkpoint-issue
Draft

[WRONG BRANCH] fix(cursor): persist and enforce tool-suspended checkpoint snapshots#358
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-suspended-checkpoint-issue

Conversation

@luvs01

@luvs01 luvs01 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent ref-less prefix lookup from reusing a checkpoint that was suspended on a client tool call when the provider-continuation metadata is absent.
  • Ensure a checkpoint captured after an external-model client tool call carries an intrinsic restriction that only a trailing toolResult request may resume it.

Description

  • Add an optional toolSuspended?: boolean property to CursorCheckpointSnapshot and accept toolSuspended in commitCursorCheckpoint so the suspension marker is persisted with snapshots.
  • When committing checkpoints from the Cursor adapter, record toolSuspended for commits that follow an external-model client tool call.
  • Update checkpoint resolution in resolveCursorCheckpoint to reject snapshots whose toolSuspended is true unless the current request ends in a toolResult, while keeping the existing checkpointUsable compatibility check.
  • Extend the focused Cursor regression test to assert the persisted toolSuspended flag and validate that a ref-less ordinary retry is rejected (falls back to full-replay) while a proper trailing toolResult resumes the checkpoint.

Testing

  • Ran the focused Cursor regression test with bun test --isolate tests/cursor-tool-suspended-checkpoint.test.ts, which passed (3 tests, 0 failures).
  • Ran type checking with bun run typecheck, which succeeded.
  • Ran the repository privacy scan with bun run privacy:scan, which passed.
  • Ran the full test suite via bun run test; the focused Cursor tests passed but the repository-wide run surfaced unrelated existing failures/timeouts in other subsystems that are outside the scope of this change.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fea96963-c915-445c-bd83-1d5d5aa65af8


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

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 28, 2026
@github-actions github-actions Bot changed the title fix(cursor): persist and enforce tool-suspended checkpoint snapshots [WRONG BRANCH] fix(cursor): persist and enforce tool-suspended checkpoint snapshots Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 28, 2026 04:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2caeba60dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (parsed.context.messages.at(-1)?.role !== "toolResult" && cursorState?.checkpointUsable === false) {
if (
parsed.context.messages.at(-1)?.role !== "toolResult"
&& (snapshot.toolSuspended === true || cursorState?.checkpointUsable === false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retire rejected suspended snapshots after full replay

When provider-continuation metadata is absent and the same ordinary request is retried, this guard rejects the prefix-selected suspended snapshot but discards its ref. The adapter then completes a full replay and commits another snapshot for the identical prefix, while inheritedCheckpointRef remains undefined, so the rejected snapshot is never invalidated; getCursorCheckpointForPrefix subsequently sees multiple matching refs and returns undefined. Every later ref-less continuation from that prefix therefore falls back to full replay until the stale snapshot expires. Preserve the selected ref and invalidate it after a successful replay, or supersede matching lineage when committing the replacement snapshot.

AGENTS.md reference: src/AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

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

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant