Repository navigation
Description
fix(ai): claude quota returns ok:true with empty windows for a 200 payload carrying no usable quota data
Verified 2026-11-06 on origin/main 10f305865f (merge of PR #1732), in a laptop worktree (~/git/fleet/probe-2026-11-06-creator-2235/wt, kept).
The defect
packages/ai/src/quota/providers/claude.ts, provider.fetchQuota (~:265-280): after a 200 response, the result of toClaudeUsage(payload) is published unconditionally:
const { windows, models } = toClaudeUsage(payload)
const usage = Object.keys(models).length > 0 ? { windows, models } : { windows }
return withMetadata(buildResult({ providerId, providerName, ok: true, configured: true, usage, ... }), credential)There is no empty check. toClaudeUsage's own guard (addWindow: a window needs a percent or a value label) correctly produces no windows for a figure-less payload — and the provider then reports that empty set as a successful quota read: ok: true, configured: true, usage: { windows: {} }, no error.
Claude is the only one of the 13 quota providers that does this. Every sibling implements the no-data contract on the same shape:
- codex (~:176-185), with the contract stated in its comment: "No usable quota or credit data at all: the sibling providers' no-data contract (ClinePass/DeepSeek/OpenRouter), not ok:true with empty windows (fix(ai): codex quota windows keyed only by derived duration label — a missing or shared limit_window_seconds silently drops one window, and an empty window object mints a phantom all-null window #1762)" →
ok: false, error"No quota data in response". - cline-pass (
:97-105), deepseek (:100), openrouter (:91-119), turso (:213), opencode-go (throws "usage data could not be parsed"), command-code (same throw), groq (itsno-quota-surfaceerror class), opendesign (throws on unparseable windows), mistral (console read with no budgets is ano-datafailure), meta (~:248-258: no windows + not subs-active →ok: false, failureClassno-data). - antigravity (~:437):
ok: falsewhentransformModelsyields no model entries.
Runtime probe (laptop worktree, probe-creator.ts, kept in the worktree)
Driving the real provider.fetchQuota with a stubbed fetch and an env credential:
{}→ok: true, configured: true, usage: { windows: {} }— a successful read of nothing.{ limits: [] }→ identicalok: truewith empty windows.{ limits: [{ kind: "session", resets_at: "2026-12-01T00:00:00Z" }] }(a limit entry with a reset but no percent — no figure) → identicalok: truewith empty windows.- Control
{ five_hour: { utilization: 10, resets_at: "2026-12-01T00:00:00Z" } }→ok: truewith the real5hwindow at 10% used (correct, unchanged).
Why it matters
ok: true is the signal downstream consumers (the aggregator gatherer, the dashboard, quota-aware placement) act on: an empty-but-successful Claude row reads as "the account was read and has no limits" instead of the honest "the read carried no quota data" — a wire-shape change, a partial Anthropic response, or a new account type silently becomes a healthy-looking empty picture, and the failure is invisible precisely because nothing errors. The sibling fleet settled this exact question in #1762: no usable data is an error row, not a success.
Acceptance criteria
- A 200 payload from which
toClaudeUsagederives no windows and no models returns the sibling no-data contract:ok: false,configured: true, error"No quota data in response"(still carrying the credential metadata viawithMetadata). - Payloads with any real window (limits, legacy
five_hour/seven_day, spend) or any model-scoped window are unchanged, byte-for-byte. -
packages/ai/test/quota.test.tspins the provider-level cases: empty object, emptylimits, figure-less limit entry, and the real-figure control. - Existing quota suite stays green.
Dedup
Searched open + closed issues for "claude quota no-data / empty / ok:true" this run: no covering issue. #1781 (open) is the claude duplicate-limits overwrite — a different defect in the same transform. #1762 (closed) established the no-data contract for codex and named the sibling set; claude was not in its fix scope.
Activity
dezren39 commentedon Nov 7, 2026
🤖 Agent note · picked up
creator/1915-claude-quota-empty-ok(to come)Merge pull request #1916 from developing-today-forks/creator/1915-cla…
developing-today commentedon Nov 7, 2026
🤖 Agent note · done