fix(codex): let clear-cooldown lift an avoidance the cooldown outlived - #4397
Conversation
clearCodexAccountCooldown returned before it looked at quotaAvoidUntil whenever cooldownUntil had already passed. The two durations have different lengths on purpose — the cooldown caps at fifteen minutes, the announced window runs up to six hours — so the moment an operator actually reaches for this escape hatch is usually after the cooldown lapsed and only the window is still keeping the account out of rotation. The call was a no-op there, and the dashboard reported cleared: false while selection kept passing the account over for hours. Treat a live avoidance window as its own reason to act, and keep the existing contract otherwise: failure counters and softAvoid still survive.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change updates ChangesCodex routing cooldown clearing
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change clears lingering quota avoidance after a cooldown expires and includes regression coverage for account reselection. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
리뷰 · 우선순위 73 / 80이 PR은 방금 지금 테스트는 그 장면을 그대로 재현한다. 429로 회피 창을 세운 뒤 16분이 지나 쿨다운은 이미 끝났고( 라인 1079 근처 clearCodexAccountCooldown JSDoc - 반환 설명을 “쿨다운도 회피 창도 없으면 false”로 고친 것은 맞다. 다만 함수 이름은 여전히 clearCodexAccountCooldown라서, 문서만 읽고 호출하는 쪽은 “쿨다운만 푼다”고 오해할 여지가 남는다. 라인 1083~1087 clear 헬퍼 - liveCooldown과 liveAvoidance를 각각 검사한 뒤 둘 다 없으면 null이다 흐름이 읽기 쉽다. 회피만 살아 있을 때도 cooldownGeneration을 올리고 lastProbeAt을 찍는 동작은 프로브 리스/세대 불변식과 맞춰 두었고, 쿨다운만 있을 때와 같은 경로라 분기 폭이 크지 않다. 경로 tests/codex-integration/codex-routing.test.ts “clearing a lapsed cooldown still lifts the avoidance it left behind” - 쿨다운 만료 확인 → 선택 회피 확인 → clear 성공 → 재선택까지 한 테스트에 묶여 있어 회귀 의도가 분명하다. softAvoid·실패 카운터가 남는지는 기존 “lifts a live cooldown but keeps failure history” 테스트가 계속 커버한다. 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd981dac93
ℹ️ 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".
| const avoidUntil = health.quotaAvoidUntil; | ||
| const liveAvoidance = typeof avoidUntil === "number" && Number.isFinite(avoidUntil) && avoidUntil > now; | ||
| if (!liveCooldown && !liveAvoidance) return null; |
There was a problem hiding this comment.
Update the owned routing docs with this behavior
This changes shared Codex routing and the operator-facing clear-cooldown contract: a live avoidance window now makes the operation succeed after the hard cooldown expires. However, none of the structure documents mapped to src/codex/ were updated, so documents such as structure/catalog.md and structure/gui-and-management-api.md still omit the new selection and management semantics; update the applicable owned documentation in this change.
AGENTS.md reference: src/AGENTS.md:L10-L11
Useful? React with 👍 / 👎.
lidge-jun#4397 made a live avoidance window its own reason for the clear-cooldown operation to act, which changes the operator-facing contract. structure/INDEX.md maps src/codex/ to this document, so the SSOT has to say that a lapsed cooldown with a live window still reports a clear, and that an account with neither still reports no change.
Product tree is dev at 7bfb2ad. Only package.json differs, carrying the stable channel version 2.52.0. This promotion follows a CI repair and a regression sweep: dev had drifted 79 commits past its last finished run and the one run allowed to complete had failed. lidge-jun#4390 fixed an integration test that never denied anything and had been red on dev since lidge-jun#4342; lidge-jun#4396/lidge-jun#4397/lidge-jun#4398 closed four gaps in the quota avoidance contract lidge-jun#4368 introduced; lidge-jun#4403 made a port fixture deterministic.
Summary
clearCodexAccountCooldownact on a live avoidance window when the cooldown it belonged to has already lapsed. The two durations differ by design — the cooldown caps at fifteen minutes, the window a refusal announces runs up to six hours — so the point where an operator reaches for this escape hatch is normally after the cooldown expired and only the window is still holding the account out of rotation. The call returned early there, reportedcleared: false, and left selection passing the account over for hours.Verification
softAvoidUntilstill survive, and an account with neither a live cooldown nor a live window still returnsfalse, so the route still cannot be used to tell whether an account exists.Checklist
Summary by CodeRabbit
Bug Fixes
Tests