fix(cursor): persist and enforce tool-suspended checkpoint snapshots - #5133
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueNo actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe cursor checkpoint flow now records whether a checkpoint was captured during tool suspension. Checkpoint resolution invalidates such checkpoints until the trailing tool result exists. Tests cover invalidation and resumed checkpoint use. ChangesCursor checkpoint suspension
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. |
리뷰 · 우선순위 76 / 80모델이 도구를 부르면, 그때 저장한 체크포인트는 도구 답이 오기 전의 상태입니다. 그래서 다음 요청의 맨 끝 메시지가 이 PR은 커밋 순간에 경로 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
리뷰 · 우선순위 75 / 80이 PR은 Cursor가 클라이언트 툴을 내보낸 뒤에 저장한 체크포인트를, 다음 요청이 이어서 써도 되는지 스냅샷에 직접 적어 두는 고침입니다. 그 체크포인트는 바로 다음 요청의 끝이 고치는 곳은 세 군데입니다. 테스트는 기존 외부 모델 커밋 검사에 구멍을 직접 막는 어서션을 보탭니다. 저장된 스냅샷의 라인 src/adapters/cursor.ts 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
추가 리뷰 · 우선순위 76 / 80이전 글 뒤에 커밋이 하나 왔습니다. 이 PR이 막는 구멍은 그대로입니다. Cursor가 도구를 부른 직후에 저장한 체크포인트는, 다음 요청의 맨 끝이 도구 결과일 때만 이어 써도 됩니다. 그 표시는 요청이 들고 다니는 continuation에만 있었습니다. 저장본을 메시지 앞부분으로만 찾는 길에는 continuation이 없습니다. 그래서 도구 호출 중간에 직렬화된 바이트를, 끝이 도구 결과가 아닌 요청에도 붙일 수 있었습니다. 고침은 커밋할 때 베이스는 경로 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
A checkpoint committed after a client tool call is only safe to resume from a trailing toolResult request. The runtime guard already forced that via checkpointUsable on the provider continuation, but the flag never reached the stored snapshot, so a ref-less prefix lookup — which has no continuation state — could resume bytes upstream serialized mid-tool-call. Persist toolSuspended on the snapshot and let the guard fire on either source.
d2a6ded to
563516c
Compare
Motivation
A checkpoint committed after a client tool call is only safe to resume from a trailing
toolResultrequest. The existing guard enforces that throughcheckpointUsableon the provider continuation, but the flag never reaches the stored snapshot. A ref-less prefix lookup has no continuation state, so it could hand a suspended checkpoint to a request whose last message is not atoolResult— resuming bytes that upstream serialized mid-tool-call.Description
toolSuspendedonCursorCheckpointSnapshotat commit time (commitCursorCheckpointinput, stored field, and thetoolSuspendedCommitcall site).trailing_tool_resultguard now fires when either the continuation state or the snapshot itself marks the checkpoint suspended, covering the ref-less path.Tests
bun test tests/providers/cursor/cursor-tool-suspended-checkpoint.test.ts tests/providers/cursor/cursor-request-builder.test.ts tests/providers/cursor/cursor-adapter.test.ts— 99 pass.toolSuspended, that a non-toolResultref-less request falls back tofull-replaywithtrailing_tool_result, and that a trailingtoolResultcontinuation still resumes the checkpoint.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.
Summary by CodeRabbit
Bug Fixes
Tests