[Feature]: Adaptive idle 5-hour quota staggering for N ChatGPT Plus accounts
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 12/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
This is a design proposal, not a scoped task. The payload names no source files or tests. Start with the maintainer update on #3376 and the existing per-account activation work in #2969 and #6018, and confirm which quota-history and reset-aware selection pieces already exist. A useful first step is agreeing with the maintainer on scope, since the request asks whether this should be an independent follow-up. Done would mean an accepted design and a split into smaller tasks.
索引モデルが issue の本文から書いたものです。
説明
Area
Authentication and account pool
What are you trying to accomplish?
I use multiple ChatGPT Plus accounts with Codex through the OpenCodex account pool. Each eligible account can have a five-hour quota window. My goal is to reduce the periods in which every account is simultaneously waiting for its short-window quota to refresh, especially after bursts of Codex work.
This request is for an opt-in, pool-level, idle-aware quota activation policy that works for any number N ≥ 2 of eligible Plus accounts, not just an A/B rotation. It should observe real upstream windows, start unused eligible windows at deliberately staggered times during idle periods, and gradually repair timing drift after real use changes their anchors.
The primary target is multi-account ChatGPT Plus, with extensibility to other account plans only when the provider's observed window semantics make it safe and meaningful.
This feature does not request more upstream quota, replacement of OpenCodex routing, or a hard requirement that users wait for a synthetic schedule.
What prevents this today?
OpenCodex already has bounded quota history, Codex reset-first selection and opted-in per-account scheduled activation (see #3376 / maintainer update). Those are useful primitives, but are not the same as coordinating the five-hour activation phases of an entire pool while idle.
Two failure modes of naive implementations:
- Independent per-account reactivation re-synchronizes windows. Even if A first starts at 00:00 and B at 02:30, independent auto-activation may start both at an inconvenient common boundary in a subsequent round.
- Static A → B → A rotation breaks under real usage. If A starts at 00:00 but exhausts early and real work reaches B at 01:00 (before B's planned 02:30 activation), B may now reset at about 06:00 instead of 07:30. A's next reset around 05:00 and B's around 06:00 are now clustered. A fixed repeating schedule does not repair that drift. Blocking the user's 01:00 request would be worse.
For N=3/4/5+, independently trying to hold fixed slots becomes even more fragile as accounts join/leave the eligible cohort, weekly quotas run out, and real work changes individual window anchors.
What should OpenCodex do?
A. Active mode — real work always wins
- Real user / agent traffic passes through immediately, retaining existing routing, affinity, priorities, threshold switching, cooldowns, and failover. Never delay, reject, or re-route otherwise valid real work solely to maintain phase spacing.
- Suspend/cancel conflicting pending synthetic idle-activation jobs. Treat a real request that starts a window as the authoritative event, not the previously scheduled warmup time.
- Observe actual 5-hour and weekly quota states/reset deadlines from the upstream account; preserve the observed state for later rescheduling. Provide manual pause for use through clients not visible to the proxy.
B. Idle mode — coordinated, best-effort staggered pre-activation
- Enter after there are no active proxied tasks/streams and a configurable quiet period (suggested default: 30 minutes). Reset the idle timer upon new real activity.
- A single pool-level coordinator owns background activation for accounts opting into this policy. Per-account scheduled auto-activation must not independently fire a conflicting warmup while pool-level staggering is enabled.
- Count only eligible, authenticated, healthy accounts with supported five-hour windows; exclude paused, unknown, unsupported, weekly-exhausted, or otherwise unusable accounts from the active five-hour cohort. Recompute N whenever eligibility changes.
- For the eligible homogeneous five-hour cohort, aim to distribute future verified reset/activation phases approximately evenly around the 300-minute cycle. Target adjacent phase gap: 300/N minutes (two accounts: 150 min; three: 100 min; four: 75 min; five: 60 min). This is an optimization target, not a fixed switching timer or a promise of guaranteed availability.
- Issue a minimal permitted activation request only for an unstarted / newly eligible window if its activation semantics are supported and verified. If a window is already active, do not send a redundant warmup.
C. Dynamic phase realignment after genuine usage
- When real traffic starts a window earlier/later than predicted, cancel stale warmups and recalculate from authoritative observed reset times, rather than assuming historical slot times still govern.
- If the pool's next reset boundaries bunch together, gradually defer only future idle-only activations to spread the phase gaps again, subject to a configurable maximum deferral (suggested initial cap: 60 minutes per proposed adjustment, adjustable/disableable). Do not attempt to move an already anchored upstream window.
- A real request during a deferral must proceed immediately; the pending synthetic job is cancelled and the next plan is recomputed. Missed jobs after a restart/sleep are evaluated afresh, not replayed in a burst.
- If the provider state is unknown, activation is unverified, the proposed change has no clear benefit, or the capacity cost of deferral exceeds its likely benefit, skip the adjustment. Best-effort/no-op is acceptable.
D. State, safety, and observability
- Distinguish
UNSTARTED,ACTIVE,EXHAUSTED,ELIGIBLE_AFTER_RESET, andUNKNOWN.used_percent=0is insufficient evidence that an idle rolling window is already anchored. - Persist a stable intended schedule, per-account window generation/activation marker, last verified reset observation and reasons for decisions. Do not repeatedly calculate a desired slot from
reset_at ≈ now + 300minon an unstarted window: that deadline may slide and starve nonzero slots forever (see codex-lb #1976). - Make requests idempotent per window generation, bounded in frequency/retries and safe on ambiguous 200/429/401 outcomes. Verify startup with upstream state; do not assume a local account switch starts a provider quota window.
- Enforce upstream five-hour and weekly limits. Do not let weekly-only or incompatible accounts occupy five-hour staggering slots.
- New behavior must be explicitly opt-in and disabled by default, and comply with provider-permitted operations. Expose any tokens/quota consumed by synthetic warmup; do not assume it is free.
- Dashboard/CLI should show active vs idle scheduler mode; number of eligible accounts N; observed account reset times; next planned background activation; last real-use interruption; and reasons for skipping/deferring.
Example usage or interface
Illustrative configuration only (not existing OpenCodex keys):
{
"providers": {
"codex": {
"accountPool": {
"idleQuotaStaggering": {
"enabled": true,
"targetPlan": "plus",
"idleAfterMinutes": 30,
"spacing": "adaptive-even",
"maxIdleDeferralMinutes": 60,
"realTrafficAlwaysWins": true
}
}
}
}
}
For N eligible Plus accounts:
| Eligible N | Ideal adjacent phase gap |
|---|---|
| 2 | 150 minutes |
| 3 | 100 minutes |
| 4 | 75 minutes |
| 5 | 60 minutes |
Two-account interference example (illustrative, assuming first-use-anchored windows):
| Time | Real event | Correct scheduling behavior |
|---|---|---|
| 00:00 | A's window starts (next reset ~05:00) | Record actual A window |
| 01:00 | A is exhausted, real Codex work reaches B before planned 02:30 warmup | Serve immediately; B's real window starts (next reset ~06:00); cancel the 02:30 synthetic job |
| 03:00 | Work ends | Start quiet-period countdown |
| ~05:00 | A is eligible for new window | If idle and policy permits, consider A activation |
| ~06:00 | B is eligible for new window | If idle, defer B's synthetic activation modestly when beneficial to restore spacing |
| 06:15 | User requests B during deferral (if this happens) | Serve immediately, cancel synthetic job and recalculate |
With three or more accounts, the same procedure computes gaps over the actual eligible cohort instead of assuming only A and B.
Alternatives or workarounds
- Independent automatic activation: simple but may repeatedly synchronize all accounts after later resets.
- Fixed five-hour A/B rotation: fails as soon as real requests start one account at a different time; not generalizable to N accounts.
- Pure reset-first routing: useful for choosing accounts for real work, but does not keep background activation phases distributed.
- Manual staggered warmups: operationally tedious, easily disrupted by real traffic and restarts.
- No synthetic activations: safest baseline, should remain the default; however, it cannot proactively establish useful staggered windows during idle time.
Acceptance criteria
- With 2, 3, and 5+ eligible Plus accounts, an idle pool plans distinguishable 5-hour slots without unnecessary simultaneous warmups; count N is dynamic.
- A real request starts account B before its planned slot: no request-path delay, B's synthetic job is cancelled, and the scheduler adapts to B's actual reset deadline.
- Across at least two later cycles, the scheduler does not unknowingly fall back into synchronized activation because of independently firing per-account workers.
- Active traffic during a scheduled/deferred warmup, or account eligibility change, triggers safe cancellation and replanning.
- No invalid slot calculation or indefinite starvation for an unstarted window with sliding reset timestamps; weekly-only accounts never distort the short-window cohort.
- Restart/sleep recovery, stale metadata, ambiguous activation success, 401/429, weekly exhaustion, and provider-unsupported behavior all fail safely without burst duplicate requests.
- Background warmups are opt-in, bounded, measurable (quota/token cost), and do not interfere with ongoing sessions.
- Evaluate against current behavior using cumulative time when all eligible accounts are unusable, ability to serve real requests, total warmup cost, and user-visible latency. Merely producing evenly spaced planned timestamps is not success; verify actual upstream windows.
- Existing automatic activation / routing behavior remains unchanged when the new mode is disabled.
Additional context
This is a separately trackable extension of the broader quota scheduling umbrella #3376, not a request to reimplement its existing primitives. An earlier detailed proposal/comment is at https://github.com/lidge-jun/opencodex/issues/3376#issuecomment-6197367914 .
Related OpenCodex issues: #2969 (per-account activation), #2874 and #4079 (reset-aware selection), #6018 (persisted activation deadlines). External design/bug references:
- https://github.com/Soju06/codex-lb/issues/433 — opt-in staggered idle warmup for 5-hour windows.
- https://github.com/Soju06/codex-lb/issues/1976 — sliding unused-window reset deadlines can make some stagger slots unreachable.
- https://github.com/ariel42/claude-window-timing — multi-account stagger/realignment ideas (provider-specific behavior must still be verified for Codex).
Maintainer question: Would an optional pool-level Adaptive Idle Quota Staggering policy be a good independently scoped follow-up to #3376, reusing the existing quota history, routing, and auto-refresh components?
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
- 主要言語
- TypeScript
- スター
- 16.9k
- フォーク
- 1.3k
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 814
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lidge-jun/opencodex のほかの issue
-
bug gui platform
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
lidge-jun/opencodex#9172 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Include provider, model and account label in the `upstream failure` service.log line対応中かも @EnesKartal が 4 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
lidge-jun/opencodex#9057 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offers対応中かも @sedoll が 6 日前に担当しました。 オープンcatalog provider provider-compatibility
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
lidge-jun/opencodex#9037 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug cli
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
lidge-jun/opencodex#9171 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
account-pool enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
lidge-jun/opencodex の issue をすべて見る
似ている issue
-
manually bump balena-preload to ^19.0.6対応中かも @shaunmulligan が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 66/100
balena-io/balena-cli#3200 ·
メンテナーはふだん 1 日以内に返信
-
`MaterializedChatMessage._text` is quadratic in the number of text chunks (`+=` followed by `endsWith`), driving the extension host to heap OOM対応中かも @olegius88 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
microsoft/vscode-prompt-tsx#205 ·
-
triage
難易度 1/5 1時間未満 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
melgarafael/DeskcommCRM#5340 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
ehmpathy/rhachet-roles-ehmpathy#1529 ·
メンテナーはふだん 1 日以内に返信