Skip to content

[Feature]: Adaptive idle 5-hour quota staggering for N ChatGPT Plus accounts #7206

Open

Description

@xmzzzw

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:

  1. 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.
  2. 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, and UNKNOWN. used_percent=0 is 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 + 300min on 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:

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

  1. added
    enhancement
    account-pool
    on Oct 15, 2026
  2. Ingwannu commented on Oct 16, 2026

    @Ingwannu
    Owner

    This is a distinct follow-up to #3376, so it should remain independently trackable rather than be closed as a duplicate. Current dev@4ae49360b7 has 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.

  3. added
    needs-design
    on Oct 16, 2026
  4. xmzzzw commented on Oct 16, 2026

    @xmzzzw
    Author

    RFC submission in response to @Ingwannu's needs-design review

    Thank 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.

    Approval boundary. This RFC proposes a deterministic offline scheduler and separately specifies evidence required before any upstream activation is enabled. Nothing here authorizes synthetic requests, credit consumption, or changes to production routing. The default and fail-safe behavior is observe only / no synthetic traffic until provider-specific evidence, review, and explicit operator opt-in are all satisfied.

    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/N minutes 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:

    1. Scheduling proof: deterministic offline tests demonstrate safety, state transitions, idempotency intent, and improvement under a declared, simulated provider-window model. This may be implemented without contacting OpenAI.
    2. Upstream activation proof and authorization: separately demonstrate on an expressly permitted test path that an identified operation predictably anchors the next real window, can be verified, and has bounded known quota/token/credit and account-security implications. Absent this proof, only the simulation / dashboard observation part may proceed.

    2. Existing code and reuse boundaries (reviewed 2026-10-16)

    This is a small feature-policy extension, not a replacement for the account pool.

    Existing component Evidence / current contract Intended treatment
    src/codex/quota-auto-refresh.ts Per-account opt-in 5h/weekly window due checks, saved deadlines, retry backoff, one-minute sweep, account-batched warming with CONCURRENCY = 4. Re-use, but make the pool policy the exclusive decision authority for its opted-in 5h background attempts. Keep unrelated weekly activation behavior unless explicitly reviewed.
    src/codex/quota-auto-refresh-state.ts scheduledByAccount, completedByAccount, and retry maps keyed by account; credential generation fencing. Preserve safety behavior; introduce narrowly scoped durable policy state, not a second independent worker.
    src/codex/warmup.ts Existing warmup operation with stream success/failure handling. Candidate activation primitive only, subject to upstream evidence and approval. HTTP success alone is insufficient.
    src/codex/quota.ts, quota-types.ts, quota-history.ts Stored observations include shortPercent, shortResetAt, shortObservedAt, shortWindowSeconds, weekly limits, source timestamps, and history. Use as evidence, with explicitly defined freshness, account/credential identity and confidence; do not reinterpret 0% alone as “not started.”
    src/codex/routing/selection.ts Selection, eligibility, reset-first, usage thresholds, affinity. Do not alter foreground choice, binds, fallback, or routing priorities. Read shared eligibility rules; never overwrite routing state in the background.
    src/lib/state-store-sweeper.ts One-minute periodic callback; config-generation reconciliation. Reuse for a lightweight plan/tick/observe cycle; no second timer subsystem necessary.

    Reviewer's source baseline was dev@4ae49360b7 at the time of review. Any implementation PR must rebase onto then-current dev and re-check module ownership. The links above describe current reviewed paths, not guaranteed permanent API contracts.

    3. Goals, non-goals, and invariants

    Goals

    • Reduce verified aggregate intervals with zero usable accounts for a fixed, comparable account cohort under the same foreground trace and provider-window semantics.
    • Avoid avoidable synchronized idle-triggered five-hour activations across 2, 3, 5 or more eligible Plus accounts.
    • Recover best-effort staggered phases after real traffic anchors/changes windows.
    • Ensure measurable, bounded synthetic attempt cost, no affinity disruption, deterministic crash recovery and transparent diagnostics.

    Non-goals

    • Increasing, pooling, resetting, or circumventing upstream limits; enforcing a guaranteed usable account at all times.
    • Redirecting, pausing, slowing, or denying foreground requests to preserve a staggering pattern.
    • Treating local account selection as proof of a remote quota-window start.
    • Proactive manipulation of weekly quotas; using paid credits or reset credits as a fallback.
    • Building a generic cross-provider activation framework before provider-specific semantics are proven.

    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

    State Entry predicate Permitted work Exit / guard
    DISABLED Setting off, operator pause, upstream feature not approved Passive observation only; no new synthetic attempts Explicit enable after gates pass
    ACTIVE Any observed real request/stream in flight, or now before quietUntil Record observations, cancel pending idle jobs, foreground untouched activeRequests===0 then quiet timer
    COOLDOWN No in-flight requests, but now < lastRealTrafficAt + idleAfter Recompute offline plan; do not dispatch Quiet deadline reached and no work resumed
    IDLE_PLANNING Quiet deadline passed Validate identities, evidence and eligibility; compute next plan Plan ready -> IDLE_WAITING; uncertain -> OBSERVE_ONLY
    IDLE_WAITING Valid persisted plan with future slots Reconcile observed state, wait locally Due slot -> DISPATCH_GUARD; activity -> ACTIVE; cohort/config change -> IDLE_PLANNING
    DISPATCH_GUARD Proposed synthetic slot due Atomically recheck credentials/identity, plan epoch, no foreground traffic, budget, permission and lease All pass -> optional future dispatcher; otherwise cancel/skip
    RECONCILING Attempt completed/failed/ambiguous, or new provider snapshot Verify upstream result, persist state and recalculate IDLE_PLANNING or OBSERVE_ONLY
    OBSERVE_ONLY Evidence/permission/health uncertain, circuit breaker or budget exhausted Passive observations and operator diagnostics only Fresh evidence + reset, explicit approval or re-enable

    In Phase 1 (design validation), DISPATCH_GUARD emits a simulation intent only, never a live network request.

    4.2 Per-account five-hour window states

    State Minimum evidence Scheduling consequence
    UNKNOWN Missing, stale, contradictory or mismatched identity/scope observations Exclude from activation; show why; avoid presenting any reset as verified
    UNSTARTED_CANDIDATE Fresh, same-credential provider evidence suggesting a moving full-duration deadline, plus a proven provider-specific classifier contract (not merely shortPercent=0) May be planned; dispatch only after upstream/permission gate
    ACTIVE_ANCHORED Fresh verified anchor/reset deadline that is stable under a short observation interval, or an accepted documented equivalent Treat as immutable phase input; no redundant warmup
    EXHAUSTED Fresh known short-window exhaustion (or refusal supported by scope), with reset time No warmup before eligibility; preserve existing foreground exhaustion handling
    RESTART_ELIGIBLE A prior anchored window ended and fresh provider evidence indicates a new window can be started Candidate for future idle-only activation, subject to gates/budget
    ATTEMPT_PENDING Durable attempt reservation for account+credential+window generation No concurrent duplicate attempt; stop on foreground competition
    VERIFYING Network attempt finished or uncertain; provider state not yet authoritatively confirmed Quarantine synthetic retry; bounded observation only
    BLOCKED Paused, reauth, weekly exhausted, credits guard, invalid plan, or policy violation Exclude until state explicitly changes

    Important: quota percentage 0 and a moving reset_at ≈ observed_at + 300 min are 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

    Event Pool transition Account/schedule effect
    Real work arrives just before a planned warmup Any idle state -> ACTIVE Advance epoch, cancel not-yet-dispatched job, let existing router serve immediately
    Real work arrives while a network warmup is in flight -> ACTIVE Abort if safely cancellable; otherwise do not wait for it, fence its completion; background may consume quota despite cancellation
    Real work starts B's window early ACTIVE -> later COOLDOWN B gets actual provider timestamp; obsolete B synthetic job invalidated, calculate fresh phase gap
    Last real stream finishes -> COOLDOWN Quiet time begins after stream end, not request start
    Idle timer passes COOLDOWN -> IDLE_PLANNING Re-evaluate entire eligible cohort N
    Five-hour window reset becomes due existing idle state Revalidate upstream: expiration does not itself prove new window started; choose feasible future idle slot
    Account weekly-exhausted or reauth any Exclude account from eligible cohort, invalidate plan epoch
    Credential is replaced / account removed any Drop old identity/generation jobs, invalidate reservations without exposing secrets
    Restart/sleep/wall-clock change DISABLED/reconciled state Recover durable state; recompute overdue intents, never replay every missed job
    Ambiguous upstream attempt result -> RECONCILING/OBSERVE_ONLY Mark VERIFYING, do not blindly retry

    5. 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

    // Draft type names: not yet implemented.
    type QuotaWindowEvidence = {
      accountId: string;                 // non-secret OpenCodex account id
      credentialGeneration: string;      // existing fenced identity; no token fingerprint
      planClass: "plus" | "other" | "unknown";
      scope: "shared-codex-five-hour" | "independent" | "unknown";
      observedAtMs: number;
      resetAtMs?: number;                 // from fresh server observation only
      durationMs?: number;                // must be exactly supported duration
      usedPercent?: number;
      weeklyGate: "headroom" | "exhausted" | "unknown";
      provenance: "quota-response" | "usage-response" | "observed-request";
      confidence: "verified" | "candidate" | "unknown";
      state: "UNKNOWN" | "UNSTARTED_CANDIDATE" | "ACTIVE_ANCHORED" |
             "EXHAUSTED" | "RESTART_ELIGIBLE" | "VERIFYING" | "BLOCKED";
      windowEpochKey?: string;           // local synthetic identity, not a provider-issued id
    };

    The windowEpochKey is an internal deduplication construct assembled from credential generation + positively verified anchoring/previous reset evidence + internal epoch; it must not be recomputed from a sliding unstarted resetAt on 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

    Claim needed for live activation Required evidence / decision If unavailable
    First qualifying use anchors the next 5h window for the intended Plus entitlement Provider docs or authorized, reproducible controlled evidence distinguishing rolling, fixed and moving unstarted displays Disable live activation for that account/product
    A particular request reliably starts that remote window Explicit operation contract, same-credential observations before/after, exact account and quota scope No synthetic request
    Completion proves remote activation Stable new observed deadline/generation or documented equivalent; no reliance on HTTP 200 alone VERIFYING with no duplicate retry
    Cost/credits/account risk is bounded and allowed Provider-permitted operation and measured request/token/credit cost; account owner consent; explicit cap Observe-only; no “free warmup” claim
    Foreground traffic remains unaffected Negative tests of request path, account affinity, native-main ownership, quarantine, auth and cancellation Feature stays disabled

    A 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. Let E(t) be the eligible five-hour cohort at time t, drawn from explicit opt-in, healthy accounts of supported subscription/window type, with weekly headroom and accepted window evidence. Define N=|E(t)|. If N<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 at s_i has hypothetical phase mod(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 is W/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 min planning resolution; earliest_i is persisted eligibility or policy start time, not a sliding remote reset; D_i is bounded by policy. Suggested separate budgets:

    • First-time, truly unstarted window: an explicit initialSpreadHorizonMinutes ≤ 300 to allow distributing an idle cohort; only after provider contract and cost approval.
    • Later window after reset: maxRepairDeferralMinutes = 60 per eligible opportunity; maxCumulativeDeferralMinutesPer24h = 120 as an additional conservative proposal (must be reviewed).
    • maxSyntheticAttemptsPerAccountPer5h=1, maxSyntheticAttemptsPerPoolPerHour=2 as proposed guardrails, not an existing guarantee; choose pool caps in line with N and approved provider rates. Do not optimize by hammering quota endpoints.
    • No automatic credit/redemption usage; if reliably known credits may be charged, skip.

    6.3 Deterministic plan construction

    1. Snapshot the cohort, config generation and current provider evidence; reject unknown/mixed window scope.
    2. Retain confirmed anchored phases as fixed constraints, including anchors caused by foreground requests.
    3. For an entirely unstarted cohort, allocate stable candidate slots at base + j·W/N for deterministic ordering j∈[0,N-1], subject to the first-time horizon and budget.
    4. For a mixed cohort, choose unstarted/restart-eligible accounts in stable account order. Generate feasible candidate times, simulate their prospective phases, and select times that improve cyclic-gap uniformity relative to earliest-feasible activation without violating budgets. Do not postpone when measured or modeled capacity costs outweigh the improvement.
    5. Prefer scoring by (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.
    6. Persist 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.
    7. dispatchGuard revalidates 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)

    • A window began 00:00 -> confirmed next reset around 05:00; B had an intended first idle slot at 02:30.
    • Foreground request uses B at 01:00 -> immediately route normally; cancel the 02:30 background job; B's actual next reset may be 06:00 if provider first-use anchoring is verified.
    • Both real requests end 03:00 -> enter quiet period (default 30 minutes).
    • On verified A restart eligibility ~05:00, optional background policy may start A after guards; its newly observed reset becomes ~10:00.
    • B becomes restart-eligible ~06:00, but an idle-only planned restart at e.g. 07:00 (60-minute deferral cap) spreads the hypothetical future reset to ~12:00; a later cycle may recover the remaining phase gap subject to cumulative budgets.
    • If genuine traffic chooses B at 06:15, it is served immediately; the 07:00 synthetic plan is discarded. If the provider does not verify restart eligibility, there is no background B request at 07:00 at all.

    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, N changes 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):

    type ShortWindowActivationOwner = "legacy-per-account" | "idle-pool";
    function activationOwner(accountId: string, config: OcxConfig): ShortWindowActivationOwner;
    • When off: all existing code behaves exactly as today.
    • When enabled but provider gate is unapproved: remain observe-only; do not accidentally fall back to legacy synthetic dispatch for accounts whose explicit policy says no synthetic traffic. Define opt-in migration semantics carefully.
    • For accepted and opted-in eligible 5h accounts: runCodexQuotaAutoRefresh continues observing/recording but delegates authorization of 5h synthetic dispatch to the pool policy. Only the single authorized owner can reserve/dispatch.
    • Weekly activation retains its separate semantics; a single warmup could incidentally affect both weekly and short windows. Do not assume they are independently controllable without a provider contract. If ambiguous, do not dispatch and request maintainer decision.

    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:

    1. Foreground arrival synchronously increments active-request/stream count, updates lastRealTrafficAt and increments planEpoch; pending warmup intents are immediately stale.
    2. The dispatch path atomically checks (enabled, idle, epoch, account generation, window evidence, budgets, lease) and records an ATTEMPT_PENDING reservation before any side effect.
    3. If a real request appears after an external request has already been sent, it is not delayed. Best-effort cancellation may prevent more work, but an already dispatched request may still have caused consumption; mark uncertain and require confirmation rather than declaring it cancelled with no cost.
    4. The response handler must check credential/config/attempt generations before publishing quota state. Never overwrite newer foreground observations with an older warmup response.

    7.3 Durable ledger schema (proposal)

    type IdleStaggerStore = {
      schemaVersion: 1;
      configGeneration: number;
      planEpoch: number;
      cohortAccountIds: string[]; // stable sorted, no tokens/emails
      persistedPolicyStartAtMs: number;
      lastRealTrafficAtMs: number;
      paused: boolean;
      pendingPlans: Array<{
        accountId: string;
        credentialGeneration: string;
        epochKey: string; // stable generation; NEVER sliding reset timestamp
        eligibleAtMs: number;
        scheduledAtMs: number;
        reason: "initial-stagger" | "realign";
        state: "planned" | "reserved" | "sent" | "verifying" | "completed" | "skipped";
        attemptId: string;
      }>;
      attemptLedger: Array<{
        attemptId: string;
        accountId: string;
        epochKey: string;
        reservedAtMs: number;
        sentAtMs?: number;
        verifiedAtMs?: number;
        outcome: "reserved" | "sent" | "verified" | "failed" | "ambiguous";
        knownCost?: { tokens?: number; credits?: number; requestCount: number };
      }>;
    };

    Persistence requirements: bounded history + atomic write, generation fencing; no access tokens, full response bodies or private prompts. After a crash with reserved/sent status, 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 a mode despite enabled to 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 eligible N, 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/sliding resetAt of unstarted window. The planner must not infer A from B/C; under B/C, no unsafe action.

    Minimum deterministic tests:

    ID Fixture / events Required assertion
    T01 N=2 clean unstarted cohort Distinct deterministic 150-min planned slots, zero network
    T02 N=3 / N=5 clean cohort 100-/60-min initial spacing, stable on repeated tick/restart
    T03 A starts; B real request before slot No foreground delay; B synthetic intent invalid; actual B anchor replaces plan
    T04 Two due legacy activations at once At most one pool-authorized short-window attempt per permitted slot; no duplicate per-account worker
    T05 Known anchored window No extra warmup/anchor adjustment
    T06 Unstarted reset_at = now + W sliding every read Stable intended slots still become due in simulation; unknown state never authorizes live attempt
    T07 Mixed weekly-only and 5h accounts Weekly-only does not occupy N slots
    T08 Weekly exhausted, 401, 429, account pause/reauth Account excluded; plan recomputed; no synthetic request
    T09 Real request arrives exactly as dispatch guard runs Real traffic wins; stale epoch cannot dispatch
    T10 User arrives after synthetic request already sent Foreground never waits; attempt fenced/verified; cannot claim zero cost
    T11 Restart after reserved, sent or ambiguous result No duplicate; read-only reconcile/quarantine
    T12 Sleep for 12h / wall-clock jump Recalculate; no burst replay
    T13 Account N changes from 5 to 3 to 2 Dynamic target spacing; no retroactive changes to anchored resets
    T14 5h reset + weekly reset same instant No double activation; ambiguous combined cost blocks request
    T15 Legacy mode disabled Byte-for-byte equivalent dispatch selection/behavior to previous version in regression fixtures
    T16 Weekly headroom but 5h state unknown No assumption of new anchor, skip
    T17 Zero/negative/NaN time, stale snapshots, account ID change Reject invalid evidence deterministically
    T18 100+ accounts / heavy simulated event trace Bounded compute time, deterministic tie-breaking

    Offline 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.

    1. Desk review: locate official provider contract and relevant OpenCodex evidence of window behavior; document whether a synthetic request is an allowed intended use. If prohibited/uncertain, stop; use observe-only or user-originated traffic only.
    2. Test account scope: volunteer owner-controlled Plus accounts only, explicit consent, no credential export, no paid credits/reset credits; limited number and measured maximum cost. Require maintainer review of exact operation and environment.
    3. Before/after observation: independently capture fresh quota evidence before and after one approved operation, including server-observed timestamps, account/credential generation, short- and weekly-window status; redact account identifiers and payloads.
    4. Contrast with controls: compare no-use idle sliding deadline, genuine foreground first use, and candidate permitted activation; reject coincidences, cached reads, fixed schedules and stale data.
    5. Failure / ambiguous tests: abort, 401, 429, timeout, restart, request completion without header, delayed quota propagation. Never repeat a questionable request just to force a result.
    6. Output: a provider-capability decision record stating 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:

    • B0: legacy per-account activation;
    • B1: no idle synthetic activation (passive baseline);
    • T1: proposed adaptive policy with explicit simulated activation semantics;
    • T2: proposed policy with disabled activation gate (should equal passive baseline in side effects).

    Primary outcome: total duration over horizon H with 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/P95 time-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

    • Secrets stay with existing owners (account-store, generation fences). No tokens or real prompts in planner state/logs.
    • No fake client responses: synthetic response/output must not contaminate user session history, routing affinity, conversation logs, usage attribution, model cache or user-visible chat.
    • Single ownership and reauthorization checks: account selection, pause/reauth, credential generation, native main admission and profile claims must be checked both on planning and dispatch, using the existing enforcement surface.
    • Abuse prevention: maximum count/cost, opt-in, documented operation only; never auto-buy credits/redeem resets; rate limits remain provider-enforced.
    • Emergency off: disable feature cancels future intents; does not promise undo of in-flight upstream cost.
    • No forced migration: legacy per-account auto-refresh remains unchanged for disabled users; policy opt-in must clarify whether it supersedes previously enabled account flags.
    • Rollout: internal offline / dry-run -> reviewer sign-off -> limited approved live evidence -> small opt-in cohort -> broader availability only after impact review. Each stage reversible.

    13. Suggested PR plan (do not open live PR before gates)

    1. PR A — RFC + deterministic offline model/tests: no runtime behavior, network access or provider claims. Document state/evidence contracts and metrics.
    2. PR B — Observation and shared scheduling ownership (observe-only): read-only telemetry and persisted plans; prove legacy disabled parity and no synthetic I/O.
    3. PR C — Provider capability decision: documentation and authorization evidence, separate from scheduling algorithm; reviewers can refuse without discarding offline work.
    4. PR D — gated live dispatch (only if C passes): small exact-account activation, idempotency, race fencing, bounded cost, failure paths and cross-platform CI.
    5. PR E — dashboard/settings/docs: clear distinction verified reset vs planned slot, consent, pause, costs, fallback, migration.

    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.

  5. Ingwannu commented on Oct 18, 2026

    @Ingwannu
    Owner

    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-design remains appropriate for the live phases.

  6. xmzzzw commented on Oct 18, 2026

    @xmzzzw
    Author

    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.

  7. Ingwannu commented on Oct 19, 2026

    @Ingwannu
    Owner

    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.

  8. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  9. xmzzzw commented on Oct 22, 2026

    @xmzzzw
    Author

    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:

    • Adaptive staggering of eligible ChatGPT Plus 5-hour quota windows across N accounts.
    • Real user requests always take priority over background scheduling.
    • Dynamic realignment when normal usage changes the observed reset windows.
    • Safe restart recovery and coordination with the existing account-pool workers.
    • Opt-in behavior, with no synthetic requests or quota spending without separately approved provider evidence and safeguards.

    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?

    1. Product integration: What would be the smallest useful product-facing consumer or vertical slice that would justify integrating the existing offline planner?
    2. Architecture and ownership: Could you help identify the appropriate integration points and, if you're interested, collaborate on the runtime portion once its safety and provider assumptions have been established?
    3. Contribution path: Would you prefer a revised smaller PR, a read-only diagnostic feature first, or a different implementation approach?

    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.

  10. Ingwannu commented on Oct 23, 2026

    @Ingwannu
    Owner

    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 in src/codex/quota-history.ts, the read-only GET /api/codex-auth/quota/history / ocx account history openai surface, and eligibility/reset ordering in src/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.ts already 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.

  11. xmzzzw commented on Oct 23, 2026

    @xmzzzw
    Author

    @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:

    • Observed 5-hour window phases for eligible pool accounts, with observation freshness and missing/stale/unknown evidence clearly marked.
    • A clearly labeled hypothetical idle-stagger/realignment recommendation (not an executable schedule), with observed vs. simulated information kept separate.
    • Deterministic tests for N=2/3/5, including drift, pool membership changes, weekly exhaustion, and missing evidence after restart.

    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.

  12. vibewriter-hand commented on Oct 27, 2026

    @vibewriter-hand
    Contributor

    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.

  13. lidge-jun commented on Oct 28, 2026

    @lidge-jun
    Owner

    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 and src/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 proposed tests/codex-integration/pool-window-diagnostic.test.ts should 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.

  14. lidge-jun commented on Nov 16, 2026

    @lidge-jun
    Owner

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolenhancementneeds-design

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions