fix(server): bind Cursor retry replay to the admitted OAuth account on 429 failover - #4954
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
✨ 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. |
⏳ DRAFT
What to do
Review readiness checklist
3/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
bddb945 to
ddd630d
Compare
|
Rebased this branch onto current
Verified after the rebase: no file in the baseline exceeds its cap in this tree. CI re-approved at the new head. |
|
Re-running the failed job rather than widening the budget. |
Summary
applyFailoverSnapshotcommits throughcommitResolvedOAuthSelection, which can admit a DIFFERENT account than the proposed one when a newer manual selection wins the proposal race. The helper already re-stampsroute.provider,sentOAuthSnapshot, andreplayOAuthCredentialSnapshotfrom the committed snapshot — but the runTurn preflight 429 rotation inrun-turn-execution.tsstill passed the REJECTED proposal's{ accountId, generation }tobindRouteReasoningReplayScope, binding Cursor's credential-scoped replay/checkpoint identity to an account that never served the retry.OAuthAccessSnapshot(ornull) fromapplyFailoverSnapshotso the caller binds the replay scope to the same account the retry actually uses.Verification
10cb5f6e93ae16170694292295e86c471b71afcfon dev6467235a85df0f649a588c601532316d6ae0fce9(merged 2026-09-18; clean ort merge, no conflicts).bun x tsc --noEmit— clean.bun run structure:check,bun run privacy:scan,bun scripts/file-size-ratchet.ts— passed.bun test tests/oauth/adapter-event-oauth-failover.test.ts— 12 pass / 0 fail. The new assertions fail against the unfixed source: the replay attempt's continuation-owner credential identity matched the rejected proposal, not the admitted account.bun test tests/oauth/generic-oauth-failover.test.ts tests/lib/reasoning-replay-scope-source.test.ts— 45 pass / 0 fail.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. Local gates passed on this head (tsc, structure:check, privacy:scan, focused tests on the merged head).
I pushed my PR to the latest dev commit. The branch carries dev
4c0124acb.I resolved all correct Codex and CodeRabbit findings. No unresolved review threads on this head.
My PR is ready for review.
Summary by CodeRabbit