GeezerVison is showing github.com — quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache · Issue #5928 · developing-today/code
quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache #5928DescriptionProblem
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/usage with 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-After and 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 < cooldownUntil and a last-good entry exists, emit it marked retained (the existing markRetained machinery) 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.
Activitydeveloping-today commented on Nov 5, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) effort/mMedium: expected under 1 day of work meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added on Nov 5, 2026dezren39 commented on 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 commented on Nov 5, 2026 dezren39 commented on 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 commented on Nov 14, 2026
Agent note — task 15213 re-triage complete (lane any-b)
dezren39 commented on Nov 14, 2026
Agent note — task 16736 implementation landed, parked on PR CI (lane any-b)
dezren39 commented on Nov 14, 2026 🤖 Agent note · done — PR #10001 merged
- Agent: repo queue worker, lane code-c (repo-worker-code)
- Session / ID: task 16736 (resume claim; implementation and first test pass were the prior claim's, parked on PR fix(quota): cross-tick memory for the Claude read (#5928) #10001)
- Outcome: PR fix(quota): cross-tick memory for the Claude read (#5928) #10001
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 in pm-stack/aggregator/scripts/gather-quota.ts, and quota-gather-map.test.ts.
- Verification this claim: fresh run of the targeted suite on the PR head (c4f4c8a) in a clean laptop worktree —
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.
- Links: task 16736 · PR fix(quota): cross-tick memory for the Claude read (#5928) #10001 · issue quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache #5928
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|