fix(codex): fence late WebSocket quota by credential generation - #3934
fix(codex): fence late WebSocket quota by credential generation#3934luvs01 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthrough
ChangesQuota generation validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change prevents stale WebSocket quota metadata from a replaced pool credential from restoring cleared quota state. The targeted behavior is covered by a regression test, with no active merge-blocking risk identified. Suggested reviewers: 🚥 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. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
리뷰 · 우선순위 70 / 80이 PR은 Codex 풀 계정에서 WebSocket으로 흘러 들어오는 늦은 쿼타 프레임이, 같은 로컬 account id로 자격 증명을 교체한 뒤에도 예전 연결의 쿼타를 다시 채워 넣던 구멍을 막습니다. 지금 새 설정·로그·GUI 없이 “서빙 중 자격이 교체되면 그 연결의 늦은 관측은 버린다”는 기존 소유 불변식만 복구합니다. 본문이 말하는 대로 configuration-generation 펜스와 main-pool writer 경로는 손대지 않았고, pool일 때만 credential generation 가드를 켭니다. 헬퍼 라인 src/server/responses/core.ts codexWsQuotaObserver - pool이면 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
Carried into the integration stack as PR #3937. Your commit An independent read-only audit examined the account-boundary questions this change raises. One accepted tradeoff worth naming: after an ordinary same-account refresh, quota frames from a stream that captured the older generation are now discarded, so quota can read stale until the next observation. That matches the existing WHAM quota path's rule, so it is a consistency choice rather than a regression. This PR will be closed once #3937 merges into |
…ebSocket quota (#3937) * docs(devlog): plan the B-track continuation/quota stack delivery Records the dependency-ordered branch chain for #3889 and #3934, the CI trigger contract that keeps the lower layer PR-free, and the original-author preservation requirement. * fix(responses): recover expired forward continuation over WebSocket A Codex WebSocket task stopped with a non-retryable 400 when its canonical ChatGPT forward replay entry expired or was missing. The proxy correctly refuses to forward a context-free delta, but reported invalid_request_error, which Codex treats as terminal. Return the existing previous_response_not_found classification instead, so Codex reconnects and resends its full retained input, including completed tool calls and their results. Rejection still happens before provider credential resolution, adapter construction, and upstream I/O; the cache TTL and capacity bounds are unchanged. HTTP clients must explicitly replay their full context. (cherry picked from commit e8d82a1) Co-authored-by: ykvv <229483879+y2ambition-ai@users.noreply.github.com> * fix(codex): fence late WebSocket quota by credential generation A streaming Codex request could keep receiving WebSocket quota metadata after its pool credential was replaced under the same local account ID. A late frame then repopulated the quota cleared for that replacement, making the new credential look exhausted. Capture the selected pool credential generation when the response's quota observer is created and ignore later observations once that generation is no longer live. Existing configuration-generation fencing and the main-pool writer are unchanged: main-pool carries no credential generation and keeps its own mainQuotaWriter identity check. (cherry picked from commit e5c01f4) Co-authored-by: luvs01 <luvs01@hanmail.net> --------- Co-authored-by: t <a@b.com> Co-authored-by: ykvv <229483879+y2ambition-ai@users.noreply.github.com> Co-authored-by: luvs01 <luvs01@hanmail.net>
|
Landed on Your change is in Cross-platform CI passed on the stack tip Closing as delivered, not rejected. Thank you. |
Summary
A streaming Codex request can keep receiving WebSocket quota metadata after its pool credential is replaced under the same local account ID. Previously, a late frame could repopulate the quota cleared for that replacement and make the new credential appear exhausted.
Capture the selected pool credential generation when creating the response's quota observer and ignore subsequent observations once that generation is no longer live. Existing configuration-generation fencing and the main-pool writer remain unchanged. The regression delivers quota 10, replaces the credential, clears quota, and then delivers quota 100 from the old connection.
This carries only the source change and regression from
a40f419fe0e1cf29faeb77599cd61bf535be7e5d, preserving its author. It restores the existing serving-account ownership invariant without adding configuration, logs, or a new user workflow.Verification
Head
e5c01f44e9736baba5b3a993c7f489f6b60d5ddd, based ondev2abf071e0a3e765195ea2997b962171c87151f06.bun test tests/responses/responses-account-label.test.ts tests/lab/core-lab-boundary.test.ts --timeout 60000passed 25 tests with 80 assertions. This includes existing pool/main-pool prelude and final quota behavior and the core import boundary.weeklyPercent: 100. The original source bytes and SHA-256 were restored afterwards.bun run typecheck,bun run privacy:scan, andgit diff HEAD^ HEAD --checkpassed.bun run test:changed --timeout 60000reached the wrapper's 900-second suite deadline and exited 124. It produced no completed selection summary, so this run is not a passing result. The scoped tests above passed separately; Full cross-platform CI initially finished with 24 successful jobs, amacos 2/2cancellation at its 20-minute job limit, and a failed aggregate. The specific timed-out job and its dependent aggregate then passed on the unchanged head: attempt 2 is complete with 26/26 jobs successful. CodeRabbit completed review of this head with no actionable findings and there are no unresolved review threads. Readiness is supported by this exact-head cross-platform CI; the separate local 900-second limit remains recorded above.Checklist
Review readiness checklist
Summary by CodeRabbit
Bug Fixes
Tests