Skip to content

feat(quota-plane): browser-token adapter framework — managed credentials, fail-closed dashboard-API clients #1153

Open

Description

@dezren39

Priority P0 — order 2. Horizon: Week. Design: quota-plane-design-2026-10-26.md (usage-billing-hub goal files), Stage 2. Parent context: epic #1047. (§1, adapter framework; builds on #1115's pattern — this is its implementation vehicle for Stage 2)

The shared browser-token adapter framework: credential = dashboard session token/cookie captured once at login, held as a managed quota credential (0600 file contract and/or Bitwarden); client calls the same undocumented endpoints the provider's dashboard SPA calls; parsing is fail-closed (schema drift -> "unparseable", previous value ages, never zeros); a session health check (get-session equivalent) distinguishes "expired — re-login needed" from zero usage and raises the re-login as a user/owned item instead of failing silently. Includes the file-export ingest path (a dated-reads file written on the session-holding machine, same quota-current contract, source labelled file-export).
Acceptance: framework + one working adapter (developer's pick of the easiest dashboard API) + tests for drift/expiry behavior.

Acceptance criteria

  • A shared browser-token adapter framework exists: dashboard session credentials are captured once at login and held as managed quota credentials (0600 file contract and/or Bitwarden), never in repo files.
  • Adapter clients call the same endpoints the provider dashboard SPA calls, and parsing is fail-closed: schema drift yields "unparseable" and the previous value ages — never a zero.
  • A session health check distinguishes "expired — re-login needed" from zero usage, and raises the re-login as a user/owned item instead of failing silently.
  • The file-export ingest path works: a dated-reads file written on the session-holding machine is ingested under the same quota-current contract, with source labelled file-export.
  • At least one working adapter (developer's pick of the easiest dashboard API) runs on the framework, with tests covering the drift and expiry behaviours.

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, Muse review of the fork-ecosystem quota subcommand at Drew's direction): the starting point already exists — do NOT build a new framework. OpenChamber's quota module (devtoday-openchamber, packages/web/server/lib/quota) is a registry-pattern adapter library with ~30 providers, a managed-credential store with validators (routes.js: exe-dev, cursor, zenmux, opendesign), per-credential fetching, and the openchamber quota CLI (PRs #474/#475/#481/#484/#520). It already implements Drew's pattern: e.g. opencode-go calls the undocumented console APIs (opencode.ai/console/api/go/status), codex calls chatgpt.com/backend-api/wham/usage, claude calls api.anthropic.com/api/oauth/usage with the stored OAuth credential, antigravity calls cloudcode-pa v1internal:retrieveUserQuotaSummary.
    Re-scope this issue to: adopt this module as the adapter framework; harden it for unattended 15-min use (timeouts, per-adapter isolation at the library level, schema-drift tests); fill the two registry gaps — there is NO meta provider and NO command-code provider in the catalogue.

  3. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    CORRECTION (2026-10-26 23:2x CDT, per Drew — my earlier wording was wrong): "no meta provider / no command-code provider" was imprecise. Precise state:

    • The META inference provider exists and is in daily use (sessions ran on it today; the funded team key was proven live 2026-10-25). What does not exist is a meta QUOTA FETCHER in the OpenChamber quota catalogue. Meta quota DATA exists — it was read from the dev.meta.ai console on 2026-10-25 (weekly window 46% used at first read) — it is simply not automated. That automation is plan(quota-plane): exception integration — Meta (login, token capture, console API) #1167, now with Drew's explicit route: log in via the laptop (RustDesk), view usage at dev.meta.ai with the credentials there, capture how the console reads it.
    • COMMAND CODE: a quota provider DID exist — built upstream (279f248a0) and DROPPED in an upstream sync (1b1a95ff6) because "the official API has no usage endpoints; the old source was the unofficial studio API." The module DOCUMENTATION.md still documents that route: GET /alpha/whoami then GET /alpha/billing/credits(?orgId=). Drew used Command Code quota reads this week (fleet CLI/console reads). Restoration is re-scoped in feat(quota-plane): adapter — Command Code via CLI/app credential #1165: recover the dropped provider from git history, re-point/verify against the /alpha studio API with our credential.
    • CODEX: provider exists and WORKS (verified live 2026-10-26 23:2x after the server restore below: codex ok on the legacy-login row; the token-sharing row errors by design).
      Also live-verified in the same pass: with opencode-serve restored, openchamber quota --json returns per-provider results — cline-pass ok, deepseek ok, opencode-go ok, openai.alternate ok; claude ERRORS "session expired" (credential present, needs re-login — a fixable state, tracked in the resilience issue filed alongside this comment).
  4. added
    kind/featureNew feature or capability request
    priority/criticalDrop everything: main broken, security exposure, repo-wide outage
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 28, 2026
  5. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Intake review

    Fleet monitor intake pass, 2026-10-28. Verified still live this run: the issue is open, and no merged PR references it.

    Related: Parent epic #1047 and the Stage 2 epic #1149 are the surrounding context named in the body; this item builds on #1115's pattern as its Stage 2 implementation vehicle. Sibling pm-stack items #1141-#1150 were filed from the same 2026-10-26 review.

    Notes / risks: This is the framework slice, not a single-provider fix: the fail-closed parsing and the expired-vs-zero distinction are the parts that must not be simplified away — a silent zero or a silent expiry is exactly the failure the quota plane exists to prevent. Credential handling is the risk surface: managed credentials only (0600/Bitwarden), nothing in repo files.

    Suggested approach: Start from #1115's working pattern, extract the shared framework (credential home, health check, fail-closed parser contract, file-export ingest), then prove it with the easiest dashboard API as the first adapter, with drift/expiry tests from the start.

    Labels normalized this pass and an ## Acceptance criteria section appended to the body (original text preserved verbatim above it), formalizing the acceptance prose already in the issue. Marked meta/enriched.

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 29, 2026
  7. 25 remaining items

  8. added
    mode/onlineFully doable remotely: design, config, code, cloud
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  10. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    State on current main 23c2c514b

    Remainder — already tracked, not new work for a packet

  11. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · correction (lane E shift, post-shift)

  12. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  13. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7197 (triage, queued, priority 70) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

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

Metadata

Metadata

Assignees

Labels

effort/lLarge: multi-day or open-ended; expect staged check-inskind/featureNew feature or capability requestmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedmeta/follow-upFollow-up spun out of earlier workmode/onlineFully doable remotely: design, config, code, cloudpriority/criticalDrop everything: main broken, security exposure, repo-wide outagequeue/queuedHas a queued task in the Supabase agent queuesource/creatorFiled by the new-issue-creator jobstatus/needs-triageNot yet triaged; needs a first lookstatus:in-reviewtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions