Skip to content

feat(codex): prefer accounts near shared quota reset - #4369

Draft
lidge-jun wants to merge 4 commits into
devfrom
codex/260912-60plus-accounts-reset
Draft

feat(codex): prefer accounts near shared quota reset#4369
lidge-jun wants to merge 4 commits into
devfrom
codex/260912-60plus-accounts-reset

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

  • Add Codex-only reset-first account-pool ordering, carrying feat(codex): prefer accounts near quota reset #4080 at ecf6b4e48a4c2992c296fada2caf6a8132313eaa. Shared-quota assignments prefer the earliest future short/weekly reset after existing eligibility, priority and threshold rules; ties or missing deadlines retain usage/stable order.
  • Adapt the carry to the shared pool kernel and canonical /api/pool/settings write/read contract. Preserve legacy Codex routes, mixed seconds/milliseconds, current manual preference and cache-affinity behavior. Independent model quota scopes use existing quota ordering because their deadlines are not the shared windows.
  • Expose the option only for Codex in the GUI, with all locale hints and configuration guides synchronized. This is an independent dev PR; [Feature]: retain quota history and make reset windows a scheduling input (capacity estimation, reset ordering, automatic activation) #3376 remains open for history/capacity and broader ordering acceptance.

Verification

  • Local suites of every size, GUI tests, builds, typecheck and install: NOT RUN, per explicit maintainer instruction. Added regression sources run on hosted CI.
  • git diff --check and staged whitespace check passed (source-text checks only).
  • Independent design reflection and A re-audit: PASS. Implementation source review and final-head hosted CI pending.
  • GUI screenshot pending the hosted dashboard-preview artifact; draft until rendered evidence is attached.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Co-authored-by: Terry Tan tmy1995hflc@gmail.com

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

lidge-jun and others added 3 commits September 12, 2026 14:14
Adapt #4080 for the shared pool kernel, canonical settings API, cache-affinity policy, reset unit normalization and independent quota scopes.

Co-authored-by: Terry Tan <tmy1995hflc@gmail.com>
@lidge-jun
lidge-jun force-pushed the codex/260912-60plus-accounts-reset branch from 72972db to 5c648ea Compare September 12, 2026 05:14
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 12, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 56 / 80

이 PR은 Codex 계정 풀에 reset-first 배정 전략을 추가합니다. 공유 5시간·주간 쿼터가 있는 계정들 중에서, 사용량 임계값 아래에 있으면서 다음 리셋 시각이 가장 가까운 계정을 고릅니다. 원본은 #4080이고, 지금 dev(HEAD 81f6cd591)의 공유 풀 커널·캐논 /api/pool/settings·캐시 어피니티 정책에 맞춰 다시 이식한 초안입니다.

핵심 코드는 src/codex/routing.tspickResetFirstCodexAccountaccountPoolStrategyForScope입니다. 독립 모델 쿼타 스코프에서는 공유 리셋 시각을 쓰지 않고 기존 quota 순서로 떨어지게 해 두었습니다. 파서·정규화는 src/oauth/pool-kernel.ts에 Codex 전용 parseCodexAccountPoolStrategy / normalizeCodexAccountPoolStrategy로 두었고, GUI·CLI는 Codex일 때만 reset-first를 보이게 막았습니다. src/types/config.tsOcxAccountPoolRotationStrategy 유니온도 넓힙니다.

현재 dev와 비교하면 merge 상태는 CONFLICTING입니다. 방금 dev에 들어간 #4336+#4339 콤보 쿼타, #4340 Claude affinity, #4342 history 쪽과 routing.ts·풀 설정 경로가 겹칠 수 있습니다. 로컬 테스트는 본문에 NOT RUN으로 적혀 있고 hosted CI를 기다린다고 했습니다.

라인 / 심볼 - src/types/config.tsOcxAccountPoolRotationStrategy"reset-first" 까지 넓힘. 공용 타입에 Codex-only 값을 넣는 선택이라, 나중에 types/config 분리 캠페인과 맞물리면 rebase보다 close-후-재출이 안전할 수 있음
경로/심볼 - accountPoolStrategyForScope - 독립 스코프에서 reset-firstquota 폴백은 맞지만, DTO/설정 값은 여전히 reset-first로 보여서 운영자가 "왜 리셋 순서가 안 먹지?"라고 헷갈릴 수 있음. 문서·GUI 힌트에 effective fallback을 더 분명히 적을 필요
경로/심볼 - resetFirstAffinityReplacement - autoSwitchThreshold <= 0 이면 early return 하도록 고쳤다고 했는데, CONFLICTING 상태에서 이 가드가 tip에 그대로 남았는지 CI 전에 한 번 더 확인 필요
경로/심볼 - structure/·docs-site 다국어 providers.md 대량 수정 - 본 기능과 무관한 노이즈가 리뷰·충돌 비용을 키움
경로/심볼 - 로컬 suites NOT RUN - reset vs usage, cacheAffinity on/off, scoped fallback 회귀가 tip에서 초록인지 증거가 없음

메인테이너의 판단이 필요한 지점

  • CONFLICTING tip을 rebase할지, 아니면 충돌이 커지면 close 후 최신 dev에 얇게 다시 올릴지
  • OcxAccountPoolRotationStrategy 공용 유니온에 Codex-only reset-first를 둘지, Codex 전용 별도 타입으로 남길지
  • fix(codex): explain and enforce automatic plan exclusions #4361(plan exclusion)과 같이 accounts 트랙에 있으면 머지 순서를 exclusion → reset-first 로 잡을지

너의 추천
draft 유지. dev에 rebase로 충돌부터 풀고, tests/codex-integration/codex-pool-rotation.test.ts + account-pool-management-api + GUI strategy 테스트를 tip에서 돌려 증거를 붙인 뒤 ready로 올린다. types/config 분리에 Mil려 유니온 확장이 무효화되면 rebase하지 말고 close 후 재출한다.

이 댓글은 grok-bot이 작성했습니다

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • UI screenshot required.

What to do

  • Add a screenshot of the UI change to the PR description.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant