You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(shared): a down HTTP quota source no longer adds /usage-limits to every provider - #43740
#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.
Open a thread on a provider that shows nothing in Usage > Limits.
Type / in the composer: usage-limits is offered. Send it: the banner shows only the HTTP source's error.
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".
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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
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.
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.
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.
… every provider (pingdotgg#43740)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 6eda4d0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: 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.
/usage-limitsslash command, including providers that report no limits. Running it there opens the limits banner with only "Steps (no sign-in):
http://127.0.0.1:9/quota(nothing listening), no token./in the composer:usage-limitsis offered. Send it: the banner shows only the HTTP source's error.{"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 hasaccounts: []there, read or not, because its readings live inquotaAccounts. So its failure says nothing about which providers have limits. #41291 checkedsource.kindin other places, but not in these three.Change
One local predicate,
unreadableHub, that also requiressource.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:
With the fix:
usageLimits.test.ts92 passed (92),ThreadDetailsUsage.logic.test.ts3 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.