Skip to content

feat(usage-hub): Codex usage reader via wham/usage route (daily, per credential) #1112

Closed

Description

@dezren39

Part of epic #1047. Design: hub-v2-v3-design-2026-10-26.md §3.

The Codex pool's manual read is the weakest in family 1: the registry records the chatgpt.com codex usage endpoint returning 403 with the stored OAuth token. But the OPENAI LOGINS record (2026-10-25) verifies the legacy chatgpt-browser login (drewrypope) reads wham/usage fine, and the store holds TWO distinct OpenAI logins.

Build a small daily reader on the working route: 7-day window %, reset credits, reset time — recorded per credential (see the per-credential issue in this epic), fed to quota-view/registry + snapshots. If the route dies, the pool falls back to the daily console read (already live in stewardship's DAILY CONSOLE READS block) and the card must say so.
Acceptance: Codex card freshness goes from manual/weekly-era to daily automated, with the source named; a 403 regression shows as stale, never as 0%.

Activity

  1. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    REVIEW FINDING (2026-10-26): the wham/usage route is ALREADY IMPLEMENTED — OpenChamber's codex quota provider fetches https://chatgpt.com/backend-api/wham/usage, including per-credential rows. Re-scope this issue to: wire that provider into the routine gather path (stewardship quota-view + hub snapshots today; the #1151 gatherer next), verify both OpenAI logins' rows live, and retire the manual Codex read once the wired path proves stable for a week.

  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triage verdict: ALREADY IMPLEMENTED — closing with evidence)

    • Agent: queue worker (repo-worker-code), Lane C shift
    • Session / ID: queue task 2388 (triage)
    • Found via: queue claim
    • Task: Triage feat(usage-hub): Codex usage reader via wham/usage route (daily, per credential) #1112 against current state and route it.
    • Verdict: The reader this issue asks for exists, is running, and meets every acceptance point — verified live on the laptop at 2026-10-29T02:45Z, not just from code:
      1. Route: OpenChamber's quota module ships a Codex provider (packages/web/server/lib/quota/providers/codex.js in developing-today/openchamber) that GETs https://chatgpt.com/backend-api/wham/usage — the exact route named here — including primary/secondary windows, reset stamps, and credits.
      2. Per credential: fetchQuotaForCredential (landed 2026-10-26 in openchamber 8e18868c, "per-credential and instance quota"; percentage-clamp fix 145d8f4d 2026-10-27) plus the hub gatherer (pm-stack/aggregator/scripts/gather-quota.ts, direct credential-store read) produce one row per login. Live quota-current.json right now holds BOTH rows: "OpenAI" (legacy Codex sign-in) state ok, weekly 22%, credits window present; "OpenAI 2" (Sign-in-with-ChatGPT token-sharing login) state error.
      3. Daily automated, source named: snapshots/usage-2026-10.jsonl shows openai:codex weekly values written by quota-gatherer (source api) throughout today — 21% at 01:15Z, 22% at 02:30Z, resetsAt 2026-11-04 — far fresher than the manual/weekly-era baseline this issue filed against. Hub entries carry source openchamber-quota.
      4. Failure never reads as 0%: the token-sharing credential, which OpenAI refuses at this endpoint, surfaces as an explicit error entry ("OpenAI shows usage for Sign in with ChatGPT only at chatgpt.com/settings/usage. The legacy Codex sign-ins show it here.") with empty windows — the mapper's documented never-zeros contract — exactly the stale/error-not-zero behavior required here.
    • Remaining work lives elsewhere: display-side per-credential separation is feat(usage-hub): per-credential quota rows — stop collapsing same-type logins #1113 (still open, untouched by this close). Nothing in feat(usage-hub): Codex usage reader via wham/usage route (daily, per credential) #1112's own acceptance is left open, so no follow-up packet is enqueued and the issue closes as already-done.
    • Links: epic epic(usage-hub): SaaS/cloud services completion — v2 live collectors, daily console reads, v3 reconciliation #1047 · sibling feat(usage-hub): per-credential quota rows — stop collapsing same-type logins #1113 · openchamber packages/web/server/lib/quota/providers/codex.js · pm-stack/aggregator/scripts/gather-quota.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions