Skip to content

[Bug] Codex Auth: ~30d primary-only account shows stale weekly with simultaneous display for weekly + 30 days (#315 remaining) #382

Closed

Description

@jhste102lab

Client or integration

OpenCodex dashboard

Area

Authentication and account pool

Summary

Team Codex Auth 계정 중 WHAM primary_window만 있고 limit_window_seconds=2628000(약 30.4일)인 계정이, 대시보드 Codex Auth에서 주간과 30일을 **같은 reset_at**으로 동시에 표시합니다.

기대: WHAM에 ~30d primary만 있으면 monthlyPercent만 노출되고 weeklyPercent는 없어야 합니다.
실제: /api/codex-auth/accounts와 UI에 weeklyPercent + monthlyPercent가 함께 남습니다.

관련: #315 (closed), #317 (parseUsageQuota의 monthly 분류 수정은 반영됨). 이번 건은 그 잔여/회귀입니다.

Reproduction

  1. OpenCodex 2.7.35에서 Codex Auth pool에 Team 계정들을 둔다.
  2. 그중 WHAM primary_window.limit_window_seconds=2628000, secondary_window=null, tertiary 없음인 계정을 확인한다.
  3. 해당 계정으로 Codex 요청을 1회 이상 보내거나, 예전에 primary→weekly로 캐시된 상태가 있는 경우 Dashboard → Codex Auth / GET /api/codex-auth/accounts?refresh=1을 연다.
  4. 같은 reset_at으로 주간과 30일이 함께 표시된다.

실측 (alias / email / account id 마스킹):

account plan WHAM primary secondary/tertiary fresh parseUsageQuota 기대 API/UI after refresh
monthly-A team 100%, 2628000 (~30.4d), reset 1787401330 null { monthlyPercent: 100 } only weeklyPercent: 100 and monthlyPercent: 100, same reset
weekly-A team 100%, 604800 (7d) null weekly only weekly only (정상)
weekly-B team 80%, 604800 (7d) null weekly only weekly only (정상)

WHAM 원본 (monthly-A, 민감정보 제외):

{
  "plan_type": "team",
  "rate_limit": {
    "primary_window": {
      "used_percent": 100,
      "limit_window_seconds": 2628000,
      "reset_after_seconds": 2531353,
      "reset_at": 1787401330
    },
    "secondary_window": null
  }
}

GET /api/codex-auth/accounts?refresh=1 (monthly-A):

{
  "quota": {
    "weeklyPercent": 100,
    "monthlyPercent": 100,
    "weeklyResetAt": 1787401330,
    "monthlyResetAt": 1787401330,
    "resetCredits": 0
  }
}

Version

2.7.35 (@bitkyc08/opencodex)

Operating system

WSL2 / Linux (kernel 6.6.x)

Provider and model

OpenAI Codex / ChatGPT Team (plan_type: team). 특정 모델 무관 — Codex Auth quota 표시 문제.

Logs or error output

원인 추정 (설치된 2.7.35 소스 기준):

  1. src/codex/quota.ts parseUsageQuota() — fix(codex): classify monthly WHAM windows #317 이후 primary limit_window_seconds >= 28d면 monthly로 분류. 위 WHAM이면 fresh parse는 monthly만 나와야 함.
  2. src/server/responses.ts — upstream x-codex-primary-used-percent를 duration/window-minutes 무시하고 항상 weekly로 updateAccountQuota에 넣음. (x-codex-*-window-minutes는 passthrough만 하고 분류에 미사용)
  3. src/codex/quota.ts updateAccountQuota() — merge-only라 이후 WHAM refresh가 monthly만 줘도 기존 weeklyPercent를 clear하지 않음.
  4. Dashboard는 weeklyPercent/monthlyPercent가 있으면 각각 codexAuth.weekly / codexAuth.monthly(KO: 주간 / 30일)를 렌더할 뿐.

결과적으로 ~30d primary 하나가 **주간 줄(헤더/스탈) + 30일 줄(WHAM)**로 중복 표시되고, 리셋 시각이 동일해진다.

Screenshots and supporting files

N/A (재현은 API JSON으로 확인). 필요하면 마스킹 스크린샷 추가 가능.

Redacted configuration

{
  "surface": "OpenCodex dashboard #codex-auth",
  "auth": "Codex account pool (Team)",
  "note": "aliases, emails, tokens, ChatGPT account ids omitted"
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Related

Suggested fix

  1. 헤더 경로도 window-minutes(또는 WHAM과 동일 ≥28d 규칙)로 primary를 weekly/monthly 분류
  2. WHAM/헤더 갱신 시 이번에 없는 window 필드는 clear (또는 quota replace)
  3. 회귀 테스트: ~30d primary-only + 이전 stale weekly → refresh 후 weekly 제거, weeklyResetAt/monthlyResetAt 동일 중복 표시 방지

Activity

  1. changed the title [-][Bug] Codex Auth: ~30d primary-only 계정에 stale weekly가 남아 주간+30일이 동시 표시됨 (#315 잔여)[/-] [+][Bug] Codex Auth: ~30d primary-only account shows stale weekly with simultaneous display for weekly + 30 days (#315 remaining)[/+] on Jul 24, 2026
  2. github-actions commented on Jul 24, 2026

    @github-actions
    Contributor

    English translation (original: ko)

    Client or integration

    OpenCodex dashboard

    Area

    Authentication and account pool

    Summary

    Among the Team Codex Auth accounts, accounts with only WHAM primary_window and limit_window_seconds=2628000 (about 30.4 days) are displaying both weekly and 30 days simultaneously on the dashboard Codex Auth with the same reset_at.

    Expected: If there is only ~30d primary in WHAM, only monthlyPercent should be exposed and weeklyPercent should not exist.
    Actual: Both weeklyPercent + monthlyPercent remain in the /api/codex-auth/accounts and UI.

    Related: #315 (closed), #317 (the modification of monthly classification in parseUsageQuota has been reflected). This case is that remaining/regression.

    Reproduction

    1. Set up Team accounts in the Codex Auth pool on OpenCodex 2.7.35.
    2. Check accounts with WHAM primary_window.limit_window_seconds=2628000, secondary_window=null, and no tertiary.
    3. Send one or more Codex requests with that account, or if there is a previous cached state from primary to weekly, open Dashboard → Codex Auth / GET /api/codex-auth/accounts?refresh=1.
    4. Both weekly and 30 days will be displayed with the same reset_at.

    Measured (masked alias / email / account id):

    account plan WHAM primary secondary/tertiary fresh parseUsageQuota expected API/UI after refresh
    monthly-A team 100%, 2628000 (~30.4d), reset 1787401330 null { monthlyPercent: 100 } only weeklyPercent: 100 and monthlyPercent: 100, same reset
    weekly-A team 100%, 604800 (7d) null weekly only weekly only (normal)
    weekly-B team 80%, 604800 (7d) null weekly only weekly only (normal)

    WHAM original (monthly-A, excluding sensitive information):

    {
      "plan_type": "team",
      "rate_limit": {
        "primary_window": {
          "used_percent": 100,
          "limit_window_seconds": 2628000,
          "reset_after_seconds": 2531353,
          "reset_at": 1787401330
        },
        "secondary_window": null
      }
    }

    GET /api/codex-auth/accounts?refresh=1 (monthly-A):

    {
      "quota": {
        "weeklyPercent": 100,
        "monthlyPercent": 100,
        "weeklyResetAt": 1787401330,
        "monthlyResetAt": 1787401330,
        "resetCredits": 0
      }
    }

    Version

    2.7.35 (@bitkyc08/opencodex)

    Operating system

    WSL2 / Linux (kernel 6.6.x)

    Provider and model

    OpenAI Codex / ChatGPT Team (plan_type: team). Independent of specific models — Codex Auth quota display issue.

    Logs or error output

    Estimated cause (based on installed 2.7.35 sources):

    1. src/codex/quota.ts parseUsageQuota() — After fix(codex): classify monthly WHAM windows #317, if primary limit_window_seconds >= 28d, classify as monthly. In the above WHAM, fresh parse should only show monthly.
    2. src/server/responses.ts — Always puts upstream x-codex-primary-used-percent into updateAccountQuota as weekly, ignoring duration/window-minutes. (x-codex-*-window-minutes only passthroughs and is not used for classification)
    3. src/codex/quota.ts updateAccountQuota() — Since it’s merge-only, even if a refreshed WHAM gives only monthly, it does not clear the existing weeklyPercent.
    4. The Dashboard simply renders codexAuth.weekly / codexAuth.monthly (KO: weekly / 30 days) if both weeklyPercent / monthlyPercent exist.

    As a result, a ~30d primary is displayed as both a weekly line (header/stale) + a 30-day line (WHAM), with the same reset timestamp.

    Screenshots and supporting files

    N/A (Reproduction can be confirmed through API JSON). If needed, masked screenshots can be added.

    Redacted configuration

    {
      "surface": "OpenCodex dashboard #codex-auth",
      "auth": "Codex account pool (Team)",
      "note": "aliases, emails, tokens, ChatGPT account ids omitted"
    }

    Checks

    • I searched existing issues and documentation.
    • I removed secrets, tokens, account details, request credentials, and personal data.

    Related

    Suggested fix

    1. Classify primary as weekly/monthly based on the header path window-minutes (or the same ≥28d rule as WHAM).
    2. Clear the absent window fields during WHAM/header updates (or quota replace).
    3. Regression test: ~30d primary-only + previous stale weekly → after refresh, remove weekly, prevent duplicate display of weeklyResetAt/monthlyResetAt being the same.
  3. self-assigned this
    on Jul 24, 2026
  4. lidge-jun commented on Jul 24, 2026

    @lidge-jun
    Owner

    Fixed by #390 (merged to dev as ac49d13). The stale weekly + simultaneous weekly/30-day display for ~30d primary-only Codex Auth accounts is resolved: header/WHAM refreshes now preserve existing windows and only clear weekly when the account is genuinely primary-only (see quota.ts merge/precedence semantics + regression tests in rate-limit-reset-credits.test.ts). Reopen if you still see both windows on the same reset_at after updating.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions