Skip to content

fix(shared): a down HTTP quota source no longer adds /usage-limits to every provider - #43740

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/http-quota-source-down-usage-limits
Nov 26, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/http-quota-source-down-usage-limits

Conversation

@iamshadmantaqi

Copy link
Copy Markdown
Contributor

Problem

#41291 added user-hosted HTTP quota sources. When one cannot be read (its server is down, it answers 500, its JSON does not match, or the URL is invalid), every provider gets a /usage-limits slash command, including providers that report no limits. Running it there opens the limits banner with only ": Could not read the HTTP quota source." When the quota server comes back, the command disappears again, so the slash menu flips with the health of an unrelated server.

Steps (no sign-in):

  1. Settings > Providers > Usage providers > Add HTTP source, URL http://127.0.0.1:9/quota (nothing listening), no token.
  2. Open a thread on a provider that shows nothing in Usage > Limits.
  3. Type / in the composer: usage-limits is offered. Send it: the banner shows only the HTTP source's error.
  4. Serve {"version":1,"accounts":[]} at that URL and wait for a refresh: the command is gone.

Cause

Three checks in packages/shared/src/usageLimits.ts (hasProviderUsageLimits, sameUsageLimitCommandCoverage, withUsageLimitsCommands) treat any source with an error and no accounts as an unreadable CLIProxyAPI hub, which may route any driver. An HTTP source always has accounts: [] there, read or not, because its readings live in quotaAccounts. So its failure says nothing about which providers have limits. #41291 checked source.kind in other places, but not in these three.

Change

One local predicate, unreadableHub, that also requires source.kind === "cliproxy", used in the three places. A down CLIProxyAPI hub still offers the command everywhere, as before.

Scope

Small fix of an obvious bug, steps reproduce it, so it needs no issue.

Verification

New test in packages/shared/src/usageLimits.test.ts, "does not offer the command to every provider while an HTTP quota source is down".

Test commit alone, on main a066eb0:

-   "slashCommands": [],
+   "slashCommands": [
+     {
+       "description": "Show this provider's usage limits",
+       "name": "usage-limits",
+     },
+   ],
Tests  1 failed | 91 skipped (92)

With the fix: usageLimits.test.ts 92 passed (92), ThreadDetailsUsage.logic.test.ts 3 passed (3).

vp run check:changed: format, lint, knip, typecheck (37 packages) and test (2 files) all pass.

Not verified: I did not run the steps in the real app; the slash command list comes from withUsageLimitsCommands, which the test calls. A provider that has its own limits still lists the HTTP source's error in its banner; that is how unreadable hubs already show, and this PR leaves it alone.

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cc4b394 and fbd8c0f.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Errored sources with no accounts now provide wildcard usage-limit and command coverage only when they are unreadable cliproxy hubs. A test verifies that a failed HTTP quota source does not change unrelated provider coverage or command coverage.

Changes: Usage limit coverage

Layer / File(s) Summary
Source coverage and regression test
packages/shared/src/usageLimits.ts, packages/shared/src/usageLimits.test.ts
Coverage checks and command advertisement use wildcard behavior only for errored, account-empty cliproxy sources. The test checks that a failed HTTP quota source does not affect unrelated provider coverage or command coverage.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, omaribrahim6

Merge Risk: Minimal · previous review cc4b3

This fix stops a down HTTP quota source from adding the usage-limits command to every provider, while unreadable CLIProxyAPI hubs keep their existing behavior. The change is small and covered by a regression test, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a down HTTP quota source no longer makes /usage-limits appear for every provider. It matches the raw summary (predicate narrowed to cliproxy sources) and the PR object…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the cause and reproduction steps. The Change section names the single predicat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a down HTTP quota source no longer makes /usage-limits appear for every provider. It matches the raw summary (predicate narrowed to cliproxy sources) and the PR objectives. It uses the conventional commit form and is specific.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the cause and reproduction steps. The Change section names the single predicate and where it is used. Scope explains why no issue is linked. Verification gives the failing test before the fix, the passing results after it, and what was not verified. The model and harness line at the end is present. The template's Scope asks for a linked issue or a reason for none, and the author gives a reason. The description does not link a prior issue beyond #41291, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a066eb0 and cc4b394.

Files selected for processing: 2

  • packages/shared/src/usageLimits.test.ts
  • packages/shared/src/usageLimits.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Open a Replay (dev) Showcase thread, type /, add an unreachable HTTP quota source at http://127.0.0.1:18799/quota without a token, refresh provider status, reopen the thread, and clear/retype /. Both runs used Chromium, 1280×800, dark theme, and fresh synthetic state.

Before After
9b4943f91c fbd8c0fed9
Before: failed HTTP source adds usage-limits to Replay After: Replay command coverage stays unchanged
Before recording After recording

Scenario script. scenarios:prove exited 0: failed on base and passed on head. Recordings mask the rightmost settings area containing internal paths.

Not shown:

  • Unreadable CLIProxyAPI hub fallback was not exercised; this scenario configured only an HTTP quota source.
  • The error-only usage banner and recovery after starting an empty-accounts endpoint were not exercised; the scenario isolated the erroneous command coverage.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge
juliusmarminge merged commit 6eda4d0 into pingdotgg:main Nov 26, 2026
56 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 27, 2026
… every provider (pingdotgg#43740)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 6eda4d0)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 27, 2026
… every provider (pingdotgg#43740)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 6eda4d0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants