Repository navigation
Closed
Labels
design/quota-planeDesign: quota-plane - all issues of this effort carry itDesign: quota-plane - all issues of this effort carry iteffort/mMedium: expected under 1 day of workMedium: expected under 1 day of workepic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedIntake review done: acceptance criteria, links, and normalized labels addedpriority/highImportant and time-sensitiveImportant and time-sensitivestatus/triagedTriaged and routed (see agent note)Triaged and routed (see agent note)status:done
Description
Problem
The quota gatherer's Claude read is in a near-permanent error state — Rate limited. Retrying soon. — even though the credential is valid. Verified 2026-11-04 (provider audit):
- Direct probe:
GET https://api.anthropic.com/api/oauth/usagewith the stored OAuth access token (~/.claude/.credentials.json, expiresAt 2026-11-05T06:18:18Z) returns HTTP 429{"error":{"type":"rate_limit_error",...}}— the token is accepted (a dead token returns 401, which the fetcher maps to "Claude session expired"), the endpoint is rate-limiting the read. Anthropic's OAuth usage endpoint is aggressively per-token rate-limited; Claude Code itself and the OpenChamber server poll it with the same token. - The OpenChamber quota module's claude fetcher already handles 429 correctly inside a long-lived process: it sets a cooldown from
Retry-Afterand serves its in-process last-good cache. The gatherer, however, is a fresh oneshot process every ~15 minutes, so the cache and cooldown reset every tick: every tick pays a fresh endpoint call (adding to the very pressure that trips the limit), and no last-good read can ever be retained — there is no successful Claude percentage read in the gatherer's snapshot history through this path.
Fix shape (aggregator side, pm-stack)
Give the gatherer cross-tick memory for the claude provider, mirroring the fetcher's own design:
- Persist
{ lastGoodEntry, cooldownUntil }for the claude read in the gatherer state file (quota-gatherer-state.json). - On a tick: if
now < cooldownUntiland a last-good entry exists, emit it marked retained (the existingmarkRetainedmachinery) and skip the endpoint call entirely. - On a fresh 429: set
cooldownUntil = now + Retry-After(fall back to the fetcher's 5 min default, cap 60 min) and emit the last-good entry retained when one exists; only surface the bare error when no read has ever succeeded. - On success: store the entry as the new last-good.
Acceptance: with the endpoint in its current 429 mood, consecutive ticks stop calling it every 15 min, the board's Claude row carries a retained last-good (once one exists) instead of a raw error, and the heartbeat distinguishes "in cooldown, retained" from a fresh failure. Keep the change scoped to the claude run; other providers' finalize/retention behavior (#5719) is unchanged.
Related: #5704 (WS6 gatherer fixes), #5721 (gatherer lib source).
Acceptance criteria
- The Claude quota read no longer sits in a near-permanent
Rate limited. Retrying soon.state across gatherer ticks when the endpoint is not actively limiting. - Cooldown/cache state survives across oneshot gatherer invocations (cross-tick memory on disk or equivalent), so the fetcher's in-process cooldown is actually honoured.
- A 401 response still maps to 'Claude session expired' (dead-token path unchanged); a 429 maps to a bounded backoff that other pollers' activity does not reset.
- Demonstrated over multiple consecutive ticks: state file/cache is written on a limited read and read back on the next tick.
Metadata
Metadata
Assignees
Labels
design/quota-planeDesign: quota-plane - all issues of this effort carry itDesign: quota-plane - all issues of this effort carry iteffort/mMedium: expected under 1 day of workMedium: expected under 1 day of workepic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedIntake review done: acceptance criteria, links, and normalized labels addedpriority/highImportant and time-sensitiveImportant and time-sensitivestatus/triagedTriaged and routed (see agent note)Triaged and routed (see agent note)status:done
Activity
developing-today commentedon Nov 5, 2026
CODE-1605
dezren39 commentedon Nov 5, 2026
Intake review
Related: Proven by direct probe 2026-11-04 (provider audit): the usage endpoint returns 429 for the stored OAuth token while Claude Code and the OpenChamber server poll the same endpoint. Sibling quota work: openchamber issue #1619.
Still-live check: searched merged PRs referencing this issue at 2026-11-05T04:31:57Z — none found; the issue stands as filed.
Notes / risks: The endpoint is shared with other pollers; a fix that polls harder makes the fleet's rate position worse. Any cross-tick store must not leak the OAuth token into logs or world-readable files.
Suggested approach: Persist the fetcher's cooldown/cache in a small state file beside the quota output, keyed by credential fingerprint, and have the oneshot gatherer load it before fetching and save it after.
Acceptance criteria were appended to the issue body and labels normalised by the fleet monitor's intake pass.
dezren39 commentedon Nov 5, 2026
Agent note - handed off
ses_e5e5345bb37ffeVIwaWpY3Yh4O73 remaining items
dezren39 commentedon Nov 14, 2026
Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 15213 moved from blocked/parked to queued in the fleet unblock-all pass (worker
main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet.dezren39 commentedon Nov 14, 2026
Agent note — task 15213 re-triage complete (lane any-b)
status/triaged. The bug and fix shape are fully specified on the issue (429 proven against the valid token 2026-11-04; oneshot gatherer defeats the fetcher's in-process cooldown/cache; persist{ lastGoodEntry, cooldownUntil }inquota-gatherer-state.json, claude run only). The one-writer ordering gate that parked task 11149 for days is dead: PR fix(aggregator): reject unsafe OpenChamber quota lib checkouts (#5721) #7133 was closed as superseded on 2026-11-10 (dirty/unmergeable, parent Quota gatherer ticks fail at import: lib dir resolves to stale openchamber checkout parked on a queue branch #5721 closed completed, its module never landed on main) — the hold onpm-stack/aggregator/scripts/gather-quota.tsis lifted, per the dropped-thread catcher note on this issue.triaged; the fix is enqueued as task 16736 (small_fix; the enqueue revived the dedupe row and cancelled the stale predecessor task 11149). Labels: quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache #5928 keepsqueue/queuedfor task 16736; claim-state labels from task 15213 are removed at completion.dezren39 commentedon Nov 14, 2026
Agent note — task 16736 implementation landed, parked on PR CI (lane any-b)
fix/5928-claude-cross-tick-memory, commit c4f4c8a)_clauderead in the quota gatherer —{ lastGoodEntry, cooldownUntil }persisted inquota-gatherer-state.jsonunder the reserved keyclaudeCrossTick:v1; in-cooldown ticks emit the last-good entry viamarkRetained; a fresh 429 sets the cooldown from Retry-After (fallback 5 min, cap 60 min); success stores the new last-good and clears the cooldown; the 401Claude session expiredmapping never engages the cooldown; claude run only, other providers unchanged. Pure helpers + 7 unit tests insrc/quota-gather-map.ts/src/quota-gather-map.test.ts.opencode quotalisting subcommand, which fetches all providers in one call; the cooldown governs the gatherer's consumption of the claude result (fresh result discarded, last-good emitted retained) — the aggregator-side seam the fix shape specifies.tsc --noEmitclean for the touched files; the full-suite failures (18, live-source/source-gate suites) verified identical on clean main — pre-existing.Merge pull request #10001 from developing-today/fix/5928-claude-cross…
dezren39 commentedon Nov 14, 2026
🤖 Agent note · done — PR #10001 merged
fix(quota): cross-tick memory for the Claude read (#5928)merged. The change is additive only (204 additions, 0 deletions):pm-stack/aggregator/src/quota-gather-map.ts(last-good + 429 cooldown persisted in the gatherer state file under the reserved v1 key), its hookup inpm-stack/aggregator/scripts/gather-quota.ts, andquota-gather-map.test.ts.bun test src/quota-gather-map.test.ts: 7 pass, 0 fail (state-key, parse/serialize round-trip, 429-vs-401 classification, Retry-After parsing, cooldown caps). PR checks: no CI gate runs on PRs in this repo (CI on main); Codex review run failed on quota with zero findings (0 inline comments), the standing non-blocker. No hard-stop labels on the PR or this issue at merge time.