Skip to content

plan(quota-plane): exception integration — Meta (login, token capture, console API) #1167

Closed

Description

@dezren39

Priority P1 — order 6. Horizon: Month. Design: quota-plane-design-2026-10-26.md (usage-billing-hub goal files), Stage 2. Parent context: epic #1047. (§5). Pending confirmation by this epic's exceptions-audit issue; re-scope if the audit names a different pair.

Meta High Usage full integration plan (Drew's shape: log in -> get the token -> hit the undocumented API the dashboard uses):

  1. Drew logs in on the LAPTOP browser (established route; auth.meta.ai is policy-blocked from the Muse browser — never retry that route).
  2. Capture the console session token from the laptop browser profile (laptop profile read path is proven) and store it as a managed quota credential.
  3. Identify the console's own usage/billing API calls (dev.meta.ai) and replay them from the gatherer on the 15-minute tick: short + weekly windows, resets, PAYG accrual.
  4. Fallback if the session cannot be replayed off-laptop: a laptop-side file exporter on a 15-minute schedule feeding the gatherer's file-export ingest, so Meta still arrives at gatherer cadence.
    Context: the plan's token quota is team/entitlement-attached (the 402 billing_not_configured wall is entitlement, not a meter); the API key alone will never carry this data.
    Acceptance: Meta windows arrive via the gatherer (or the file-export fallback) at 15-minute cadence with measuredAt + source; expiry raises re-login.

Acceptance criteria

  • Meta High Usage windows (short + weekly windows, resets, PAYG accrual) arrive via the gatherer at 15-minute cadence with measuredAt + source — or via the laptop file-export fallback at the same cadence.
  • The console session token is stored as a managed quota credential; expiry raises a re-login signal instead of silently going stale.
  • Note: step 1 needs Drew logged in on the laptop browser (auth.meta.ai is policy-blocked from the sandbox/Muse browser); the API key alone is never treated as carrying this data.

Activity

  1. developing-today commented on Oct 27, 2026

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

    @dezren39
    MemberAuthor

    DREW'S INSTRUCTION (2026-10-26 23:22 CDT) + work begun: "go log on to the web browser using RustDesk and determine how to view the usage information from dev.meta.ai... using the credentials from there." An investigation on the laptop route is dispatched tonight (2026-10-26): sign in at dev.meta.ai on the laptop browser, open the usage/billing views for the team entitlement (Muse Code High Usage), and capture WHICH API calls the console itself makes (endpoints, auth/token type, response shape) so the gatherer can replay them — the same pattern as the other dashboard adapters. Findings land here + in the provider-quota registry.
    Known starting facts: entitlement = token quota on team "My Team" (projects Muse Code + Default Project, tier PAID); first console read 2026-10-25 showed the weekly limit 46% used, resetting Sun 19:00; the API key carries NO quota state (402 = entitlement wall on the orphaned key era; the funded key proves inference, not usage). The Muse browser remains policy-blocked from auth.meta.ai — laptop route only.

  3. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Meta console investigation complete (2026-10-27). Full report: workspace/goals/usage-billing-hub-token-quotas-per-service-saas-limits/hidden_files/meta-console-investigation-2026-10-26.md (hatch-personal).

    Fresh quota reading — 2026-10-27 00:03 CDT (Helium session on the laptop was already signed in to dev.meta.ai; no login/code needed):

    • Muse Code High Usage — short (5h) window: 1% used, resets 3:40 AM CT
    • Weekly limit: 8% used (API exact 8.83%), resets Nov 1, 2026 6:00 PM CT
    • Free credits remaining: $148.57; PAYG current balance $0.00
    • PAYG billable cost Oct 21–27: $23.92, all dated Oct 25 (orphaned-key day); Oct 26–27: $0
    • Payment method: Visa •••• 9545 (exp 3/29, default); auto-charge at $20.00 balance or Nov 1, 2026; spend email-alert threshold $0.01/mo

    How the console reads it (cookie-auth GETs, no bearer token):

    • GET dev.meta.ai/api/portal/teams/{team_id}/subscription-quota → weighted used/limit + reset epochs for both windows (the one call the gatherer needs)
    • GET .../billing-banner → free credits remaining; GET .../usage/batch?metrics=... → daily spend/tokens
    • Session cookie llama_dev_sess (dev.meta.ai, httpOnly, expires 2027-10-27) lives in the laptop Helium profile; billing details render only in a billing.dev.meta.ai iframe (not needed for quota).

    Feasibility verdict for the 15-min gatherer: FEASIBLE. Recommend Phase 1 = laptop-side read/export (session's own device/egress; doubles as the fallback), Phase 2 = trial off-laptop replay (risk: Meta session binding — a sessionBindingId exists). A stale/401 response must be treated as 're-capture needed', never as zeros.

    Leftover note: the laptop Firefox window is still parked on the old email-code prompt (expired; can be closed). Vault RustDesk/KRDP passwords still don't match the laptop servers — SSH+CDP is the working channel.

  4. added
    kind/infrastructureInfrastructure / host-portability work
    source/humanFiled directly by a human
    priority/highImportant and time-sensitive
    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

    Related: Quota-plane Stage 2 exception integration, parent epic #1047, order 6 / P1. Pending the exceptions-audit confirmation. Sibling: #1169 (Google/Antigravity, same shape).

    Notes / risks: BLOCKER RISK: step 1 needs Drew's laptop browser login — auth.meta.ai is policy-blocked from the Muse browser and that route must not be retried. The laptop file-exporter fallback keeps this moving without the session replay.

    Suggested approach: The 402 billing_not_configured wall is entitlement, not a meter (per the body) — do not treat API-key data as a substitute.

    Live check: verified still open and unheld this run; a merged-PR search on this run (2026-10-28T10:35:00Z) returned no PR resolving this issue, so it remains live work. Acceptance criteria appended to the body (original text preserved verbatim above it) and labels normalized by the fleet monitor.

  6. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Agent note — Meta read regression traced to the #1301 exporter parser (fleet monitor, 2026-10-29 evening)

    Drew ordered the Muse (Meta) quota read fixed on 2026-10-29. Live diagnosis (full detail on #1301, comment of 2026-10-30T01:11Z): the Phase 1 laptop exporter built under this plan (PR #1303, merged) is alive — timer firing, session healthy — but every tick since 2026-10-29T16:15Z fails unparseable on windowReset: the console returns a non-finite window_resets_at when the short window is inactive, and the parser fail-closes the whole export on that one field. That is the entire read regression the steward has flagged for 8+ runs; the Meta route itself is healthy (opencode#818 closed).

    This plan's acceptance is met through the file-export fallback, so the remaining path runs entirely through #1301: parser fix (tolerate a null reset only for an inactive window) + regression tests + laptop redeploy + end-to-end verification. Recommend closing this issue when #1301 verifies end-to-end.

    Queue state: this issue's triage task 2452 sat queued/unclaimed at priority 70 since 2026-10-28; raised to priority 90 today under Drew's order. Not part of the #2323 dedupe-blocked set.

  7. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Agent note — Meta exporter fixed; this issue's recovery is complete via #1301 (2026-10-29 evening)

    Per this issue's own standing note (close when #1301 verifies end-to-end), the end-to-end verification is now done:

    • Fix: PR fix(meta-exporter): tolerate absent reset on a not-yet-started window (#1301) #2530 (commit 67a8fa82) — parseSubscriptionQuota tolerates a null/absent *_resets_at only on a window with zero recorded usage (emitted with resetAt: null); every other malformed shape still fails closed. Tests 11/11, including regressions built from the captured failing payload.
    • Redeployed on the laptop via install-laptop.sh (installed copy diff-verified byte-identical to the PR head).
    • Verified live: three consecutive ok export ticks (03:13:13Z, 03:16:12Z, 03:31:13Z — after failure on every tick since 2026-10-29T16:15Z); latest export: 5h 0% (inactive window), weekly 23.62% (resets 2026-11-02), free credits $148.57, PAYG $0; the hub quota-current.json Meta entry (file-export/meta-laptop) is state: ok with real windows again.

    Full record: #1301 comment 6514351059. PR #2530 has auto-merge armed and lands as soon as its required check clears the repo-wide nix ci runner stall; this issue closes with #1301 at that point.

  8. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Agent note — CLOSED: recovery complete via #1301 / PR #2530

    Closing update to comment 6514372099: PR #2530 has merged (merge commit 9105190ed331ef83daf81ff866a72d9be0ff36d0, 2026-10-30T04:01:07Z, double-verified via gh), the deployed exporter is byte-identical to merged main, and the live read is verified healthy post-merge — five consecutive ok ticks through 04:00:13Z (5h 0%, weekly 23.62% resetting 2026-11-02, free credits $148.57, PAYG $0; hub Meta entry ok). #1301 is closed as completed (comment 6514701890), so per this issue's standing note it closes too: the Meta pool's quota read is restored end-to-end.

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/infrastructureInfrastructure / host-portability workmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedmeta/follow-upFollow-up spun out of earlier workpriority/highImportant and time-sensitivequeue/queuedHas a queued task in the Supabase agent queuesource/humanFiled directly by a humanstatus/needs-triageNot yet triaged; needs a first look

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions