fix(cursor): size prior keeps provably-small bare resource_exhausted on the 429 class - #2342
Conversation
…lass Live probe evidence (devlog 260822_senpi_cursor_transfer/210, 260): a plan-gated model (claude-opus-4-7-low-fast without -fast entitlement) returns the SAME bare 0-token resource_exhausted shape on a ~20-token prompt that a real payload overflow produces. #2320's overflow mapping then makes Codex compact a tiny turn — the wrong remedy for an entitlement rejection, and the retry can never succeed. Add a size prior to classifyCursorError: when the caller can prove the request was small relative to the model's context window (estimate < 50% of window), a bare RE keeps the 429-class mapping; large or unknown sizes keep today's overflow mapping, so the prior only ever removes false overflows it can prove. The adapter supplies the estimate from the outgoing request text and the static context-window table at its single error-mapping seam. Explicit quota cues and size phrases are unaffected (they classify before the prior). senpi's T01 (#1009/#1036) shares this false-overflow bug; this is a beyond-parity refinement.
|
✅ Deterministic PR hygiene checks passed. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe Cursor adapter now computes request-size context and passes it to error classification. Bare ChangesCursor error classification
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CursorAdapter
participant TokenEstimator
participant CursorErrorFormatter
participant ErrorClassifier
CursorAdapter->>TokenEstimator: estimate input tokens and context window
CursorAdapter->>CursorErrorFormatter: format transport error with size context
CursorErrorFormatter->>ErrorClassifier: classifyCursorError with size context
ErrorClassifier-->>CursorErrorFormatter: return error category and message
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
Live-probe-driven refinement of the #2320 bare-
resource_exhaustedoverflow mapping (devlog 260, probe evidence in 210): a plan-gated model returns the same bare RE shape on a ~20-token prompt that a real overflow produces, so the pure message-shape classifier compacts turns that entitlement — not size — rejected.classifyCursorErrorgains an optional size prior: a bare RE with a provably small request (estimate < 50% of the model's context window) keeps the 429-class mapping; large or unknown sizes keep today's overflow mapping, so the prior only ever removes false overflows it can prove. The adapter supplies the estimate at its single error-mapping seam (safeCursorTransportError). Explicit quota cues and size phrases classify before the prior and are unaffected. senpi's T01 shares this false-overflow bug — this is a beyond-parity refinement.Verification
bun x tsc --noEmitclean.tests/cursor-errors.test.ts+5 cases (small→429, large→overflow, unknown→overflow unchanged, quota cue wins, size phrase wins) — 24 pass.Checklist
Summary by CodeRabbit
Bug Fixes
Tests