Repository navigation
Description
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 [WRONG BRANCH] Promote dev to main: alert-precision record #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 #3376 (comment) .
Related OpenCodex issues: #2969 (per-account activation), #2874 and #4079 (reset-aware selection), #6018 (persisted activation deadlines). External design/bug references:
- Add optional staggered idle warmup for rolling 5h account windows Soju06/codex-lb#433 — opt-in staggered idle warmup for 5-hour windows.
- bug(warmup): staggered idle slots can be unreachable for sliding reset_at Soju06/codex-lb#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.
Activity
Ingwannu commentedon Oct 16, 2026
This is a distinct follow-up to #3376, so it should remain independently trackable rather than be closed as a duplicate. Current
dev@4ae49360b7has per-account activation and quota observations; those primitives do not by themselves implement a pool-level idle phase coordinator.The next step is a bounded design proposal, before runtime or GUI changes: define the observed evidence for an unstarted window, stable window-generation identity, how one coordinator excludes per-account workers, cancellation when real traffic arrives, restart recovery, and the maximum synthetic quota cost. Preserve the existing routing/affinity and weekly eligibility rules, and keep the policy off by default.
The 300/N spacing is an optimization target, not evidence that upstream reset times can be moved. Acceptance should compare actual all-accounts-unusable time, foreground latency and warmup cost over multiple cycles. A deterministic offline scheduler model can establish the state transitions; provider-permitted activation semantics still need separate evidence.
Labeling needs-design. This is not approval to send synthetic requests, consume account credits, or start implementing an unspecified scheduling policy.
xmzzzw commentedon Oct 16, 2026
RFC submission in response to @Ingwannu's
needs-designreviewThank you for confirming that #7206 should remain independently trackable. Below is the complete, bounded design-only RFC addressing the requested window evidence and stable generation identity, exclusive pool-level activation ownership, foreground cancellation and race handling, restart recovery, maximum synthetic quota cost, and measurable acceptance criteria.
The offline TypeScript reference planner has been tested locally on Node 22 (15 passing deterministic tests). It does not make upstream requests, and it is an illustrative model rather than integrated OpenCodex code. Its source/tests can be provided as a separate offline-only PR if that would be useful after review.
Safety gate: this submission does not request or authorize synthetic upstream traffic, paid-credit usage or production routing changes. It explicitly requires independent provider-behavior and permission evidence and maintainer review before any live implementation.
RFC: Adaptive Idle Quota Staggering for N ChatGPT Plus Accounts
Status: Draft for maintainer review — design only, no authorization to run synthetic upstream requests
Date: 2026-10-16
Primary issue: lidge-jun/opencodex #7206
Parent/related: #3376, #2969, #4079, #6018, #823
Maintainer design review: @Ingwannu's comment
Target initially: homogeneous supported ChatGPT Plus/Codex five-hour windows, N ≥ 2; plan name is not sufficient evidence of supported provider behavior.
1. Executive decision and exact problem
Users of OpenCodex with multiple ChatGPT Plus accounts want to reduce periods in which every usable account simultaneously has exhausted its short-window quota. Existing per-account auto-activation can unintentionally align five-hour boundaries, and a fixed round-robin activation schedule loses alignment when genuine requests start a different account's quota window early.
Proposed solution: add an optional pool-level idle activation policy that (a) never intervenes in foreground routing; (b) observes actual provider windows, with provenance and confidence; (c) plans spaced synthetic activation attempts for eligible, truly unstarted or restart-eligible windows only when no real work is active; and (d) gradually realigns future idle-only activation opportunities after real traffic changes the observed phases. The optimizer treats
300/Nminutes as a target for N eligible comparable five-hour accounts, not as a mandatory wakeup period or a provider contract.Two independent go/no-go gates:
2. Existing code and reuse boundaries (reviewed 2026-10-16)
This is a small feature-policy extension, not a replacement for the account pool.
src/codex/quota-auto-refresh.tsCONCURRENCY = 4.src/codex/quota-auto-refresh-state.tsscheduledByAccount,completedByAccount, and retry maps keyed by account; credential generation fencing.src/codex/warmup.tssrc/codex/quota.ts,quota-types.ts,quota-history.tsshortPercent,shortResetAt,shortObservedAt,shortWindowSeconds, weekly limits, source timestamps, and history.src/codex/routing/selection.tssrc/lib/state-store-sweeper.tsplan/tick/observecycle; no second timer subsystem necessary.Reviewer's source baseline was
dev@4ae49360b7at the time of review. Any implementation PR must rebase onto then-currentdevand re-check module ownership. The links above describe current reviewed paths, not guaranteed permanent API contracts.3. Goals, non-goals, and invariants
Goals
Non-goals
Non-negotiable invariants
I1. Foreground precedence: if a real request needs an eligible account, this policy never makes the request wait for its desired phase. Existing routing owns the request.
I2. Only future idle opportunities may move: an already anchored provider window cannot be moved by a local timer. Deferral affects only a future background warmup of an unstarted/newly eligible window.
I3. One authority for synthetic short-window activation: the legacy per-account worker may observe/persist state but must not independently dispatch the same 5h attempt for accounts controlled by the pool policy.
I4. Unknown implies no synthetic action: stale/missing/unverified provider metadata, an uncertain previous outcome, or permission uncertainty blocks warmup (not foreground usage).
I5. No unbounded cost: opt-in, limits per account and pool, a credit-exclusion gate, retry caps, durable attempt ledger, and a manual kill switch.
I6. Disable is behavior-preserving: with feature disabled, original per-account auto-refresh and all foreground routing semantics continue unchanged.
4. Model: orthogonal pool and account state machines
Do not combine user-idle status and provider-window status into one ambiguous state.
4.1 Pool scheduler states
DISABLEDACTIVEquietUntilactiveRequests===0then quiet timerCOOLDOWNnow < lastRealTrafficAt + idleAfterIDLE_PLANNINGIDLE_WAITING; uncertain ->OBSERVE_ONLYIDLE_WAITINGDISPATCH_GUARD; activity ->ACTIVE; cohort/config change ->IDLE_PLANNINGDISPATCH_GUARDRECONCILINGIDLE_PLANNINGorOBSERVE_ONLYOBSERVE_ONLYIn Phase 1 (design validation),
DISPATCH_GUARDemits a simulation intent only, never a live network request.4.2 Per-account five-hour window states
UNKNOWNUNSTARTED_CANDIDATEshortPercent=0)ACTIVE_ANCHOREDEXHAUSTEDRESTART_ELIGIBLEATTEMPT_PENDINGVERIFYINGBLOCKEDImportant: quota percentage 0 and a moving
reset_at ≈ observed_at + 300 minare hints, never proof by themselves. Previous snapshots can also be stale or delayed. All provider-state classification must have provenance, TTL, credential generation, and confirmed rule version.4.3 Significant transitions
ACTIVEACTIVEACTIVE-> laterCOOLDOWNCOOLDOWNCOOLDOWN->IDLE_PLANNINGDISABLED/reconciled stateRECONCILING/OBSERVE_ONLYVERIFYING, do not blindly retry5. Evidence, window identity and activation contract
The largest design risk is confusing a local schedule with remote quota behavior. This RFC asks the maintainer to approve a contract before enabling any live network operation.
5.1 Proposed evidence envelope
The
windowEpochKeyis an internal deduplication construct assembled from credential generation + positively verified anchoring/previous reset evidence + internal epoch; it must not be recomputed from a sliding unstartedresetAton every poll. Change it only upon an evidenced new generation, not on ordinary snapshot refresh. If generation is uncertain, stop automatic action and require re-verification.5.2 Separate claim from proof
VERIFYINGwith no duplicate retryA local account-switch operation is not provider activation. After-reset synthetic requests may consume real quota or trigger unexpected upstream behavior. No live request should be made solely because this RFC exists.
6. Offline phase optimization for N accounts
6.1 Cohort and phase-space definition
Let
W=300 minutes. LetE(t)be the eligible five-hour cohort at timet, drawn from explicit opt-in, healthy accounts of supported subscription/window type, with weekly headroom and accepted window evidence. DefineN=|E(t)|. IfN<2, disable stagger optimization (normal legacy behavior or observation only, as configured).For accounts with confirmed anchored next reset
r_i, phase isφ_i = mod(r_i, W). A planned not yet anchored synthetic activation ats_ihas hypothetical phasemod(s_i + W, W), explicitly marked planned, never displayed as a verified reset. Cyclic gaps are sorted-phase differences including the wraparound. In the unconstrained ideal, each gap isW/N.Crucial distinction: if there is a weekly limit, model validity is not continuous; a 5h reset does not imply that the account can serve. Also, if all users naturally exhaust every account early, phases do not guarantee uninterrupted service.
6.2 Feasible actions and budgets
A candidate account may be planned only when its remote five-hour window is confidently unstarted or restart-eligible; it must have no pending/uncertain activation attempt, active foreground work, account pause, reauth or credit-spending risk.
The admissible background start times are:
S_i = { earliest_i + k·q | k ≥ 0, k·q ≤ D_i, candidate is eligible at slot }where
q=5–15 minplanning resolution;earliest_iis persisted eligibility or policy start time, not a sliding remote reset;D_iis bounded by policy. Suggested separate budgets:initialSpreadHorizonMinutes ≤ 300to allow distributing an idle cohort; only after provider contract and cost approval.maxRepairDeferralMinutes = 60per eligible opportunity;maxCumulativeDeferralMinutesPer24h = 120as an additional conservative proposal (must be reviewed).maxSyntheticAttemptsPerAccountPer5h=1,maxSyntheticAttemptsPerPoolPerHour=2as proposed guardrails, not an existing guarantee; choose pool caps in line with N and approved provider rates. Do not optimize by hammering quota endpoints.6.3 Deterministic plan construction
base + j·W/Nfor deterministic orderingj∈[0,N-1], subject to the first-time horizon and budget.(maximum cyclic gap, sum of squared deviations from W/N, cumulative deferral, count of synthetic requests)lexicographically, only across a fixed cohort. Prioritize correctness, fewer requests and bounded deferral over mathematically perfect spacing. Evaluate multiple candidates jointly in offline simulations; a production bounded heuristic is fine if it passes metrics.planEpoch, eligible-cohort hash, chosen slots and observation references atomically; emit explanatory skip reasons. Recompute upon real activity, eligibility change, changed provider evidence, config change, restart or schedule expiry.dispatchGuardrevalidates every condition immediately before dispatch. The plan alone does not authorize a request.For large N, avoid combinatorial optimization. A deterministic bounded greedy/small beam search with tie-breaking
(score, accountId, scheduledAt)is acceptable; prove its behavior in offline tests. Do not use local wall-clock times without UTC epoch normalization.6.4 Example: A/B disruption (illustrative only)
6.5 Example: five Plus accounts
If five comparable, confirmed unstarted, idle and eligible accounts share the same stable planning start at 00:00 and there are no anchored constraints, initial planned slots can be 00:00, 01:00, 02:00, 03:00, 04:00. These are planned events, not proof of five real quota-window anchors. If B starts early from real work at 00:35, the old B slot at 01:00 is cancelled; its observed reset becomes a fixed phase constraint, and other future idle slots are replanned without moving already started windows.
If an account exhausts its weekly quota,
Nchanges and the plan is invalidated; do not carry forward the old 60-minute target for the reduced cohort. If rebalancing cannot safely proceed within budgets, do nothing.7. Scheduling authority, races and persistence
7.1 Avoid two dispatchers
Introduce a policy owner decision (interface illustrative):
runCodexQuotaAutoRefreshcontinues observing/recording but delegates authorization of 5h synthetic dispatch to the pool policy. Only the single authorized owner can reserve/dispatch.7.2 Foreground-vs-warmup race
The existing router owns foreground selection. The scheduler must never take a lock that waits on running client requests. Proposed order:
lastRealTrafficAtand incrementsplanEpoch; pending warmup intents are immediately stale.(enabled, idle, epoch, account generation, window evidence, budgets, lease)and records anATTEMPT_PENDINGreservation before any side effect.7.3 Durable ledger schema (proposal)
Persistence requirements: bounded history + atomic write, generation fencing; no access tokens, full response bodies or private prompts. After a crash with
reserved/sentstatus, perform read-only reconciliation and do not blindly retry: upstream may have accepted the request just before the crash. Multi-process installations require a genuinely exclusive owner/lease; a process-local map is not sufficient.7.4 Time and recovery
Persist scheduling timestamps as UTC epoch milliseconds. For a clock jump / wake from sleep, compare to fresh
Date.now(), invalidate overdue plans and construct a new plan; never burst-replay missed activation times. Cap catch-up to zero speculative requests. Restore retries/ledger conservatively. If no fresh evidence is available, stay in observe-only mode.8. Proposed interface (NOT existing OpenCodex keys)
{ "codexIdleStaggering": { "enabled": false, "mode": "observe-only", "targetPlan": "plus", "idleAfterMinutes": 30, "planningResolutionMinutes": 5, "initialSpreadHorizonMinutes": 300, "maxRepairDeferralMinutes": 60, "maxCumulativeDeferralMinutesPer24h": 120, "maxSyntheticAttemptsPerAccountPerFiveHours": 1, "maxSyntheticAttemptsPerPoolPerHour": 2, "unknownOrAmbiguousResult": "stop-and-verify", "realTrafficAlwaysWins": true, "allowCredits": false } }Operator modes (proposed):
off(fully legacy),observe-only(compute plan, zero synthetic traffic),approved-live(requires code-level provider capability gate + explicit opt-in and verified permission). These names and config placement require maintainers' input. The example intentionally includes amodedespiteenabledto distinguish policy enabled for observation from approved execution; avoid UI combinations that imply permission when it is absent.Dashboard/CLI should show
ACTIVE / COOLDOWN / IDLE / OBSERVE_ONLY, dynamic eligibleN, verified vs hypothetical resets, next plan, skip reasons, weekly gate, account-level remaining deferral budget, attempt ledger summary and cost. Do not label a planned timestamp as the provider's actual reset.9. Deterministic offline validation protocol (no network, no credentials)
Implement a pure
plan(snapshot, state, now) -> {newState, syntheticIntents, diagnostics}function with injected clock and no network, disk or global state. Run it with a fake quota provider and event journal.Model provider contracts separately using three fixtures:
(A)first-use-anchored rolling 5h;(B)fixed reset schedule;(C)unknown/slidingresetAtof unstarted window. The planner must not infer A from B/C; under B/C, no unsafe action.Minimum deterministic tests:
reset_at = now + Wsliding every readreserved,sentor ambiguous resultOffline model should include property-based assertions: no real request delayed by policy; no action without opt-in and verified capability; no duplicate attempt for
(account, epochKey); plans survive idempotently across repeated ticks; no credit usage by policy; only confirmed anchors appear as observed; all synthetic attempt budgets hold.Deliverables for Phase 1: source-level pure planner, deterministic fixtures/test output, baseline replay and a short design review report. There is no dependency on real OpenAI requests for this phase.
10. Separate upstream verification plan (future, requires approval)
Do not run these steps merely because they appear in the RFC. They define evidence needed for a later, expressly authorized test plan and cannot override provider terms, account owner consent, or maintainer security review.
supported|unsupported|unknown, costs, verification method, usage policy basis and reviewer. Only supported + authorized permits a separate Phase 2 live-activation PR.If the provider contract does not support deterministic activation, the valid product remains a passive multi-account reset heatmap / prediction / alerting tool without synthetic traffic.
11. Evaluation and acceptance metrics
Do not equate attractive spacing diagrams with real user benefit.
Paired offline replay: run the same exogenous foreground request trace, initial pool state, quota capacities and provider model against:
Primary outcome: total duration over horizon
Hwith zero accounts actually usable for a defined comparable workload, normalized to the fixed initial test cohort. Use provider-verified short/weekly exhausted/available states, not guessed reset times. Distinguish unknown status from unusable; report missing-data coverage instead of silently treating unknown as zero availability.Secondary outcomes:
P50/P95time-to-serve/foreground latency, error/fallback rate, synthetic requests and tokens/credits, phase-gap variance and maximum gap (diagnostics, not primary), duplicate attempts, weekly exhaustion and idle deferral time. Compare multiple workload intensities and N=2/3/5. Confidence bounds and absolute denominators must be documented. Never promise improvement; if no measurable benefit or high cost, do not ship live mode.Proposed acceptance thresholds for maintainers to decide, not claims of measured performance: 0 added application-layer foreground blocking due to scheduling; 0 unauthorized synthetic attempts; 0 known paid-credit usage; 0 duplicate attempts in deterministic fault traces; bounded memory/time; strictly nonnegative primary-outcome change in accepted simulations; demonstrably useful improvement in at least one representative heavy-usage scenario with no material regressions in others. For live tests require predetermined sample size, budget and explicit consent.
12. Security/privacy, feature-flag rollout and abort controls
account-store, generation fences). No tokens or real prompts in planner state/logs.13. Suggested PR plan (do not open live PR before gates)
Repository policy: PRs target
dev; security-sensitive authentication and synthetic upstream work require explicit maintainer/security review. Follow CONTRIBUTING and MAINTAINERS.14. Explicit maintainer decisions requested
D1. Is the preferred upstream scope Plus-only first and restricted to a confirmed shared five-hour scope, with other plans excluded until individually supported?
D2. Is a two-stage observe-only → authorized-live gate acceptable, and what provider permission/semantics evidence is sufficient? This RFC assumes no permission absent approval.
D3. Where should the exclusive activation-owner gate live in the existing worker, especially when a single warmup might affect both 5h and weekly windows?
D4. What counts as a stable window-generation identity when upstream exposes only snapshots and sliding reset timestamps? Should ambiguity force indefinite manual review for that generation?
D5. Are the proposed first-start (≤300m), per-round deferral (≤60m), per-day cumulative deferral (≤120m), and synthetic attempt limits acceptable? Would maintainers prefer lower defaults?
D6. Which exact data source should mark foreground “active” across long-lived streams, in-flight requests and background Codex agents, without changing existing request routing?
D7. Should the first contribution stop at PR A offline model pending D1–D6, as the reviewer requested?
15. References
Decision requested: Please review and refine the offline model, evidence contract, and decision gates first. No operational background activation is proposed until explicitly authorized. The full feature remains optional, best-effort, reversible, and foreground-transparent.
Ingwannu commentedon Oct 18, 2026
The next contribution should stop at PR A: the pure offline planner and deterministic fixtures, targeting current dev. That is a reviewable evidence slice, not approval of the proposed runtime keys, synthetic operation or live budgets.
For D1–D7: use a positively verified comparable five-hour cohort rather than plan name alone; keep unknown/sliding/fixed-window models observe-only; represent an ambiguous window generation as no executable intent. The exclusive activation owner belongs at the existing worker's final dispatch admission, not in a competing timer; a single operation affecting weekly and short windows needs one reservation, not two. Foreground activity must use actual admission/stream lifecycle ownership, with epochs checked again immediately before dispatch; a signal observed after send cannot prove zero upstream cost. The numerical delay/attempt caps remain proposals until separately reviewed.
In PR A, preserve the paired passive/legacy baselines and failure traces, but add queue/pool-size churn, credential replacement, disabled→observe-only migration and restart after each reservation/send boundary. Bound plan/ledger growth and runtime at large N. Report usable-account time and unknown coverage separately; spacing uniformity is secondary. No network, credentials, global config writes or integration with the live worker are needed. Please link the actual 15-test source/receipts there rather than treating the RFC's counts as independently reproduced evidence.
needs-designremains appropriate for the live phases.feat(codex): add offline-only quota phase planner for lidge-jun#7206
docs(codex): preserve lidge-jun#7206 RFC source and offline test prov…
docs(codex): preserve lidge-jun#7206 RFC source and offline test prov…
test(layout): register offline stagger tests for lidge-jun#7206
test(layout): register offline stagger tests for lidge-jun#7206
xmzzzw commentedon Oct 18, 2026
Thank you for the scoped PR A guidance. I have submitted Draft PR #7325 against current
dev:#7325
It contains only the pure offline planner, deterministic failure and paired passive/legacy/offline-policy fixtures, original RFC 15-test source/receipt, and the corresponding test layout registrations. There are no live-worker integrations, network calls, credential access, runtime configuration keys, upstream synthetic activations, or paid-credit changes.
Local reproducibility reported in the PR: 36/36 new Node tests and 15/15 reproduced original RFC tests, with isolated TypeScript source typecheck. The project-wide Bun checks and required CI are still pending; it is deliberately a Draft, not marked ready for review.
This contribution does not seek approval for live activation, runtime budgets or any later phase. I will address any review feedback in the PR.
Ingwannu commentedon Oct 19, 2026
PR A is now tracked in Draft #7325. I independently ran its two focused files under capped Linux/Bun 1.4.3: 36 passed, 0 failed. The review requests the shared fixture-path helper and owning structure documentation; project typecheck/current-head required CI remain pending. The original Node/RFC receipts and synthetic availability deltas stay separately labeled. This does not approve runtime integration, timers, quota activation, live-account calls or a later phase; the feature remains needs-design.
github-actions commentedon Oct 19, 2026
Automated translation bookkeeping — detected language: English.
merge(dev): reconcile PR A offline planner with current dev
xmzzzw commentedon Oct 22, 2026
Hi @lidge-jun and @Ingwannu,
Thank you both for the time, reviews, and guidance on #7206 and PR #7325. I appreciate the work you've put into maintaining OpenCodex.
I understand the reason for closing #7325: the offline planner does not yet have a product consumer. I respect that decision and don't want to reopen the same PR without addressing the underlying concern.
I'd like to ask whether you'd be willing to help guide or collaborate on implementing the actual feature.
The intended feature is:
I'm happy to continue doing the implementation, testing, documentation, and maintenance work. I'm not asking you to take over the entire development effort.
Would you be open to helping us with three decisions?
I'd be especially grateful if you were interested in collaborating directly on this feature, but even high-level architectural guidance would be very helpful.
We can preserve the work already completed in #7325 while adapting the implementation to better serve the project's needs.
I won't proceed with live activation, synthetic quota operations, or production routing changes without an agreed design and the necessary evidence.
Thanks again for your time and consideration.
Ingwannu commentedon Oct 23, 2026
The smallest useful next slice would be a read-only pool-window diagnostic, subject to @lidge-jun agreeing that it is useful product scope. It should explain the currently observed short-window phases, missing/stale evidence, and a proposed idle realignment; it must not start the proposed realignment. Please get that consumer agreed before reopening an implementation PR, so we do not land another unused planner.
There are existing owners to reuse on current dev
26415a90e4: bounded, generation-fenced observations insrc/codex/quota-history.ts, the read-onlyGET /api/codex-auth/quota/history/ocx account history openaisurface, and eligibility/reset ordering insrc/codex/routing/selection.ts. Keep a projection a pure consumer of captured observations, with unknown data reported as unknown. Do not make a diagnostic call the refresh/warmup path:src/codex/quota-auto-refresh.tsalready owns real scheduled activation, credential generations, retries and its worker registration.For a revised proposal, specify one concrete command/output example and its consumer, the observation freshness/eligibility contract, and deterministic N=2/3/5 fixtures for drift, cohort changes, weekly exhaustion and restart with absent evidence. Keep measured observations, hypothetical recommendations and synthetic availability comparisons visibly separate. Preserve the prior contributor work/attribution if it is carried.
I can review that bounded design and implementation here; this is not a commitment to activate the runtime scheduler. Live activation, synthetic requests, quota spending, a new timer and routing changes still need a separate agreed provider/consent/budget design. A GUI or broader runtime feature remains an owner product decision.
xmzzzw commentedon Oct 23, 2026
@lidge-jun — following up on @Ingwannu's guidance above, could you confirm whether a read-only pool-window diagnostic would be useful, acceptable product scope for #7206?
My proposed first slice would extend an existing account-history CLI/API surface to display only:
It would reuse the existing quota-history and account-selection data and make no live activation requests, timers, warmups, credential operations, routing changes, or quota/credit spending. We would first post a concrete CLI output example and a bounded freshness/eligibility contract for review.
I can take responsibility for the design, coding, tests, and documentation, with @Ingwannu's offered review. Would you approve this read-only diagnostic as the next product-facing contribution, or prefer a smaller/different consumer?
I will keep PR #7325 closed and avoid opening a replacement implementation PR until the scope is agreed. Thanks for considering it.
vibewriter-hand commentedon Oct 27, 2026
Could the design in #7206 also cover an opt-in reset-aware weighting strategy for generic and Anthropic OAuth pools?
The goal is to distribute new conversations using fresh quota and reset observations while keeping healthy existing bindings stable. A reset timestamp alone should not be treated as proof of replenishment. Any extension should preserve account eligibility, cooldown and weekly-limit rules, and avoid prescribing fixed weights.
#7234 was closed without merging; it is related design history, not a landed implementation. This is a design request, not a claim that the proposed strategy exists or has been runtime-tested.
lidge-jun commentedon Oct 28, 2026
At dev@fdc6dd82d, bounded observations and credential fencing exist (
src/codex/quota-history.ts:4-17,63-75), while the history API is deliberately scoped to one stored pool account (src/codex/auth-api/routes.ts:388-425). The worker already owns scheduled spending (src/codex/quota-auto-refresh.ts:123-154,326,415). #7325 is closed without merging. The pending product-scope agreement remains a prerequisite; this supplies the concrete consumer contract requested above.The options are a CLI-only pool projection, the same projection plus a dashboard, or live scheduler integration. CLI-first gives operators a reproducible snapshot with the fewest consumers. A dashboard improves visibility but expands scope. Live integration requires the separate activation/consent/budget decisions and is premature.
I recommend the CLI projection, conditional on the existing owner decision. Proposed syntax, not an existing command:
ocx account history openai --pool-windows --json. Example output in prose: generated at 12:00Z; account pAAAAAA observed at 11:58Z, 18,000-second window, reset 15:00Z; account pBBBBBB observed at 11:59Z, reset 16:00Z; observed cyclic gaps 60/240 minutes; hypothetical target gap 150 minutes; action none. If start semantics are unknown, the recommendation is “insufficient evidence to propose an activation time,” rather than an invented slot.For this display, propose a maximum evidence age of 30 minutes, matching the existing capacity display bound (
src/providers/codex-capacity.ts:36), explicitly without changing routing freshness. Require matching current account/credential generation, shared scope, exact five-hour duration and known weekly headroom before including a row in the comparable cohort. Report stale/missing/weekly-blocked rows and coverage separately. Stable resets describe observed phases; neither zero usage nor a passed reset proves an unstarted window. Freshness itself never proves provider activation semantics.The smallest implementation, once scope is agreed, is a pure
src/codex/pool-window-diagnostic.ts, exposed through a history route sibling andsrc/cli/account-history.ts. Capture all rows before projection and recheck identities before publishing; do not stitch asynchronously changing generations into one pool. Preserve the existing single-account response and add no persisted plan, timer or refresh call. A proposedtests/codex-integration/pool-window-diagnostic.test.tsshould cover N=2/3/5, drift, cohort replacement, weekly exhaustion, stale observations and restart without evidence; API/CLI fixtures must prove zero warmup/refresh calls and visibly separate observations from hypotheses. Carry prior planner work only where consumed and with attribution.lidge-jun commentedon Nov 16, 2026
Owner decision (lidge-jun, 2026-11-16): the CLI-only, read-only diagnostic is approved (window start times and a suggested spacing; it executes nothing). The dashboard view and any automatic action stay out of scope. @xmzzzw, go ahead.