[WRONG BRANCH] fix(cursor): persist and enforce tool-suspended checkpoint snapshots - #358
[WRONG BRANCH] fix(cursor): persist and enforce tool-suspended checkpoint snapshots#358luvs01 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
toolResultrequest may resume it.Description
toolSuspended?: booleanproperty toCursorCheckpointSnapshotand accepttoolSuspendedincommitCursorCheckpointso the suspension marker is persisted with snapshots.toolSuspendedfor commits that follow an external-model client tool call.resolveCursorCheckpointto reject snapshots whosetoolSuspendedis true unless the current request ends in atoolResult, while keeping the existingcheckpointUsablecompatibility check.toolSuspendedflag and validate that a ref-less ordinary retry is rejected (falls back tofull-replay) while a proper trailingtoolResultresumes the checkpoint.Testing
bun test --isolate tests/cursor-tool-suspended-checkpoint.test.ts, which passed (3 tests, 0 failures).bun run typecheck, which succeeded.bun run privacy:scan, which passed.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