Repository navigation
Description
Symptom
The quota gatherer's record (~/.local/state/pm-aggregator/quota-current.json, 15-minute ticks) carries labelled per-account rows for two of the three OpenCode Go accounts — opencode-go.drewrypope and opencode-go.developing-today-0 — plus ONE unlabelled opencode-go row. There is no labelled opencode-go.popesdrew row, so that account's windows cannot be read or steered per-account. The three Go accounts are seated 1:1:1 in the deepseek-flash-plan tier of workhorse-ordered, so per-account steering matters.
Census 2026-11-10 (quota-current.json generatedAt 2026-11-10T20:30:08Z, all rows fresh-measured in that tick):
opencode-go.drewrypope— 5h 0% / weekly 100% / monthly 100% (monthly resets 2026-12-03T03:02:35Z)opencode-go.developing-today-0— 5h 0% / weekly 100% / monthly 54% (monthly resets 2026-12-08T22:09:41Z)opencode-go(unlabelled, no credentialId) — weekly 100% / monthly 100%, credits_balance $0.00, resets 2026-11-16T00:00Z / 2026-12-03T17:35:51Z
Root cause (wire-verified on the laptop, 2026-11-10)
The unlabelled row IS popesdrew's measurement, unattributed:
- popesdrew is enrolled as a Console OAuth device sign-in (credential
cred_bh5LJo8s26zwYccj8tDnC3LP1x, orgorg_01M6H7986JGCDR5H81QXPFJW2J, popesdrew@gmail.com, token expiry 2026-12-03T17:42:29Z) stored under its own instance integrationopencode-go.popesdrew. The other two accounts hold API-key credentials under their instance integrations. The same Console sign-in also exists as the sharedopencodeintegration's active row. - The gatherer's single source is the opencode fork's quota subcommand (
opencode quota --json, forkpackages/ai/src/quota). Its base per-credential walk foropencode-goreads only the credential aliasesopencode+opencode-go— so it measures popesdrew's account through the sharedopencoderow and emits it as the bare, unlabelledopencode-goresult. Proof the numbers are popesdrew's: a direct Console status call with that credential returns week used 3,006,253,692 / 3,000,000,000 micro-cents (100%, resets 2026-11-16T00:00Z), month 6,006,253,692 / 6,000,000,000 (100%, resets 2026-12-03T17:35:51Z — exactly the unlabelled row's reset), billing balance 0 ($0.00 — exactly the unlabelled row's balance), fiveHour meter present but idle (used 0, resetsAt null — the Console parser drops a meter with no reset, which is why the unlabelled row has no 5h window while the API-key rows do). - The instance path never rescues it:
opencode-godid not setfoldInstanceCredentials(only Codex did), so configured instances were never folded into the base answer; and the row-usability verdict re-keys an instance row under the base id (opencode-go), where a Console sign-in reads as neither Console credential (that lookup keys on the sharedopencodeintegration) nor API key — so the instance is judged unusable, excluded from the configured listing, and an explicit ask foropencode-go.popesdrewanswersNot configured(verified live).
Fix
In the opencode fork's quota module (the gatherer's single source), with the OpenChamber quota lib (the same module's original home, still used by OpenChamber surfaces) mirrored:
opencode-goprovider setsfoldInstanceCredentials: true— configured Go instances fold into the base answer, one labelled row per account, the pattern Codex already uses for openai.main / openai.alternate.- The provider gains an
isCredentialUsablehook that judges a row on its own shape (Console sign-in under the Console key, or an API key present) instead of the dispatcher's base-id re-keying, which cannot see an instance-stored Console row. - The listing's instance-usability verdict consults the same hook the fetch path uses, so listing and fetch agree (previously the listing re-implemented the verdict without the hook).
Tests: fork packages/ai/test/quota.test.ts gains a describe block covering the fold, the instance ask, and the listing (212 pass, typecheck clean); OpenChamber lib index.test.js gains the mirror coverage (46 pass) and opencode-go.test.js stays green (45 pass).
Related: #5324 (the route-level sibling symptom — the popesdrew pool drawing zero), #2490 (quota read-path unification), #1161 (the Go console per-workspace adapter this builds on), #8102 (popesdrew self-renewal stays UNPROVEN — its Console token expires 2026-12-03).
Proof
Posted as a comment on this issue after deploy: a fresh gatherer tick's quota-current.json with three labelled opencode-go rows and popesdrew's numbers quoted.
Activity
developing-today commentedon Nov 10, 2026
CODE-2455
Merge pull request #8265 from developing-today/chore/opencode-pin-8260
dezren39 commentedon Nov 10, 2026
Proof + deploy status — 2026-11-10 ~16:40 CST
Fix: merged everywhere.
cb3968e4f4713ae9e2918250614d83f2df2a3bb8.providers/opencode-go.tsgainsfoldInstanceCredentials: trueplus anisCredentialUsablehook that judges a row on its own shape; the configured-listing verdict inquota/index.tsnow consults that hook like the fetch path already did. Tests: 212 pass / 0 fail inpackages/ai, type check clean.1fabc820a50f90c514592ceb3d05141606e54acd. Already live on the laptop: the OpenChamber sync service pulled it 2026-11-10 15:43 CST, exit 0.6531b2b28034a265b904896682f60b0ac4ed488f. flake.lock opencode rev3497ea22c→cb3968e4f.Proof on the wire, with the pinned binary.
Built only the system path from the pin branch (reason below):
/nix/store/6kfwdzx23s8lg1w3zsw60xh0b1smgycf-system-path/bin/opencodereportsopencode v2.0.30+cb3968e.Direct instance ask, previously answered "Not configured":
One-off gatherer tick through the gatherer's own script (
gather-quota.ts, working directory~/git/code/pm-stack/aggregator, the unit's normal env and state paths) with onlyQUOTA_SUBCOMMANDpointed at the new binary: tick2026-11-10T22:29:00.048Z, providers=17 ok=15 records=+4, journal linequota-gatherer: opencode-go.popesdrew ok ... rows=1, Turso sink wrote 23 quota_records rows. The snapshot history (snapshots/usage-2026-11.jsonl) carries the durable record from that tick:Two honest caveats.
resetsAt: null(used 0), and the quota parser drops a meter that has no reset time. So the labelled row carries weekly + monthly + balance, matching the account's real Console answer; the other two accounts' rows show a 5h window because their API-key path reports one. Separate small gap, noted here rather than hidden./run/current-system/sw/bin/opencode(system generation 554,2.0.30+c43145b), so regular 15-minute ticks again write the record without the labelled row (currentquota-current.jsongeneratedAt 2026-11-10T22:30:18Z). A full generation build from the pin branch fails on pre-existingfleet-0.1.0compile errors that have nothing to do with this change — rustc E0063: missing fieldparametersinSearchOptions, missingglobal_top_k/shard_top_kinBranchQuery(fleet-search library), cascading into atlas-search.service, opencode-env-key-materialize, and home-manager. The system-path component containing the new binary builds clean on its own (proof above). Once fleet builds again and a generation switch lands the merged pin, the labelled row becomes permanent with no further change needed here.Leaving this issue open for the deploy-permanence step only; the code fix itself is merged in both quota-module copies and pinned in code.
One side effect worth recording: the first one-off tick attempt failed because invoking the new binary made the background OpenCode server restart on a version mismatch;
opencode.servicecame back healthy at 16:22:59 CST ("opencode: ready", serving on 127.0.0.1:13420) and the retried tick then ran clean.dezren39 commentedon Nov 10, 2026
Update 2026-11-10 ~17:15 CST — popesdrew converted to an API key; this issue's OAuth premise is now moot in production
Per Drew's ruling (2026-11-10 16:45 CST: "need popesdrew Ai key Instead?"), the
opencode-go.popesdrewcredential is no longer the OAuth device sign-in (cred_bh5LJo8s26zwYccj8tDnC3LP1x) this issue was written around. It is now an API key, shaped exactly like the other two Go accounts.What was done
credential.keyas the bearer for key rows (packages/core/src/plugin/provider/opencode.ts,credentialHeaders), route history shows the key-backed instances serving heavily (drewrypope key row 7,579 attempts / 4,805 ok in 14d; developing-today-0 key row 6,883 / 5,823), and the key quota path (GET /zen/go/v1/usage) returns the account's Go windows for both key accounts.fleet(svcacct_3ffe4c75…) + keyfleet(sk_6a3d4dd3…, permissions all) on popesdrew's own org (org_01M6H7986JGCDR5H81QXPFJW2J). Before swapping, the key was verified to read popesdrew's own windows (weekly 100% → 2026-11-16, monthly 100% → 2026-12-03T17:35:51Z — identical to the Console read).opencode.api-key-popesdrew(project "developing today", secret id85ac68c7-5705-4ee5-9eec-b4fe017c49a5), matching theopencode.api-key-developing-today-0naming; read-back hash-verified (sha256 fp1d3d2ab3).cred_pKcBNN4l8hgClpiztdF1dXcreated + activated (label "OpenCode Go (popesdrew)"), OAuth rowcred_bh5LJo8s26zwYccj8tDnC3LP1xdeleted in the same motion. The instance now holds exactly one credential row, a key — same end state as drewrypope / developing-today-0. The shared Console rowcred_ewyKoFzIohrg5B3rVzFtC1vz(integrationopencode) is untouched — it is the Console account session, not an instance credential.Verification on the wire
opencode quota --json opencode-go.popesdrew→ ok, 5h 0% with a real reset clock, weekly 100% → Sun Nov 16 00:00Z, monthly 100% → Dec 3 17:35:51Z.opencode-go.popesdrewfiles labelled, state walled, sourceopencode-quota, windows 5h 0% (resets 2026-11-11T04:15:28Z) / weekly 100% / monthly 100%. Durable snapshot record foropencode-go.popesdrew|5hwritten 23:07:15Z. The missing-5h gap is fixed by the key path — the key-based usage API reports the rolling window with a reset time, where the Console meter reportedresetsAt: null.What this changes for this issue
isCredentialUsable/ fold fix stays — the baseopencode-goaggregate still reads through the shared Console credential, and the hook remains the correct guard for any future OAuth-shaped instance row.dezren39 commentedon Nov 10, 2026
Serving check (follow-up, ~17:25 CST): the new key row
cred_pKcBNN4l8hgClpiztdF1dXis already bound in live routing — 11 route attempts since the swap, all failing429 "OpenCode Go usage limit reached", the same quota-wall response the other two key rows return right now (account weekly/monthly at 100%). That is the key serving exactly like its siblings: authentication succeeds, the plan wall answers. Zero auth failures on the new row.dezren39 commentedon Nov 10, 2026
Permanence blocker removed. The generation switch this issue waits on was blocked by the fleet flake build failing; that failure is fixed and merged:
ac6dfcb53daddedatlas-prototo atlas-core's dependencies without updatingpkgs/fleet/Cargo.lock, which the Nix package pins — locked/offline resolution failed in the flake build while workstation cargo silently self-healed the lock.a5946ee5f2f0(one-line lock addition). Locked cold builds green ×2; fleet-search tests 19/19; atlas-core tests 68/68.cb3968e4f(chore(flake): opencode pin -> cb3968e4f (opencode-go labelled quota rows, #8260) #8265), the gatherer timer runs the new binary persistently and the labelled popesdrew row should hold across ticks — that post-switch tick check remains this issue's closing step.dezren39 commentedon Nov 11, 2026
Interim: seat-side half of the permanence fix is live (2026-11-11)
The labelled
opencode-go.popesdrewrow was being erased by regular gatherer ticks because the gatherer resolves anopencodebinary at the stale c43145b vintage (no instance-fold fix). Status of the two halves:01148f78, incl. the fold fix lineage) under systemd socket activation on 2026-11-11: build2.0.30+6a4793c->2.0.30+01148f7, MainPID 62542 -> 480147, zero connection-refused window across the switch (4,150-probe record), all 15,597 baseline sessions retained (15,734 total after). Pin PR: code flake: pin opencode to fork main 01148f78 (socket-activation switch proof, code#8255) #8372 (merged999b41828f10). Full evidence: Shadow supervisor (pid 1059342, stale system profile) respawns prod OpenCode service within seconds of any stop — port version decided by rebind race #8261 comment 6784017786.~/.local/bin/opencode(system/home profile, still c43145b vintage). It advances with the laptop system generation switch from code main (which now carries the new pin). A generation build from~/git/codeat origin/main0696e54c7ais running as the cold-environment confirmation (also the fleet build-fix lane's confirmation, Prod service started by its own unit runs a stale binary (3497ea2) baked into the runtime config snapshot — unit ExecStart ignored #8264 comment 6782223834). Once the generation is switched, the closing check for this issue is: >=2 regular gatherer ticks (~15 min apart) keep the labelledopencode-go.popesdrewrow in quota-current.json.dezren39 commentedon Nov 17, 2026
state: done (already_done)
lane: any-b, worker: repo-worker-code, task 18619
Triage verdict for #8260 (checked fresh this shift, 2026-11-17): resolved — the closing check named on this issue now passes, so I am closing it with the evidence.
The issue's closing step was: at least 2 regular gatherer ticks (~15 min apart) keep the labelled
opencode-go.popesdrewrow inquota-current.json. Observed live this shift in/home/user/.local/state/pm-aggregator/quota-current.json:opencode-go.popesdrewpresent, state ok; heartbeat perProvideropencode-go.popesdrew= {state: ok, rows: 1}.Three consecutive regular ticks spanning 15m07s (first and third 15m07s apart) all hold the labelled row — the gatherer-side permanence fix (generation advance carrying the instance-fold fix, whose seat-side half landed 2026-11-11 per comment 6784094285) is doing its job; the row is no longer erased between ticks and the account no longer publishes only as the unlabelled aggregate.
No follow-on packet needed.
dezren39 commentedon Nov 17, 2026
agent-note:v1
state: done
task: 20137
lane: any-n
worker: repo-worker-code
Freshly revalidated #8260 as CLOSED with status:done. The existing triage evidence confirms three regular gatherer ticks spanning 15m07s retained the labelled opencode-go.popesdrew row, satisfying the stated closing check. Queue task 20137 completed as already_done.