Conversation
- Add QuotaManager with TTL cache mechanism in Rust backend
- Support 5h sliding window and weekly quota parsing for Codex and Antigravity
- Implement dual-runtime commands and Axum endpoints (/api/quota/{agentType})
- Add ComposerQuotaBadge component in chat composer with countdown and progress bars
- Support manual refresh, low quota alerts, and full internationalization (10 languages)
- Add comprehensive unit tests covering models, parsers, and UI components
SousekiL
force-pushed
the
feat/quota-claude-devin
branch
from
September 27, 2026 17:26
34de477 to
e170580
Compare
Contributor
Author
|
Agreed — #845 first. I've marked this as draft and will rebase onto main once #845 lands. One thing for #845 itself: the badge always prefers the 5-hour window, but ChatGPT Pro reports one that stays ~100% while the weekly budget drains, so Pro users see a meaningless "5h" figure. My last commit here ( |
SousekiL
marked this pull request as draft
September 27, 2026 19:10
|
Thanks, that makes sense. I'll bring the binding-window badge fix into #845. Appreciate you catching this! |
- Pick whichever window has less remaining percentage via pickBindingWindow - Map daily limit labels to 1d - Add tests covering ChatGPT Pro binding window and tie-breaking cases
|
The binding-window badge fix has been committed and pushed to #845 ( |
Contributor
Author
|
Nice, thanks for the quick fix! |
Builds on the QuotaManager from xintaofei#845 with two more providers. Claude Code: reads the CLI's own OAuth credentials (macOS Keychain item "Claude Code-credentials", else <CLAUDE_CONFIG_DIR|~/.claude>/.credentials.json) and calls the same https://api.anthropic.com/api/oauth/usage endpoint the CLI's /usage command uses, mapping five_hour / seven_day utilization onto the 5-hour and weekly windows and subscriptionType onto the plan name. An expired login is reported as such rather than as an opaque HTTP error. Devin CLI: reads windsurf_api_key + api_server_url from ~/.local/share/devin/credentials.toml (XDG_DATA_HOME aware) and calls the CLI's SeatManagementService/GetUserStatus Connect RPC; PlanStatus supplies the daily / weekly remaining percentages and reset times, plan name and ACU counters. Both the built-in `devin` id and the `custom:devin` wire id of a user-registered Devin ACP agent resolve to this probe. Credentials are only ever sent to their issuing service and never stored. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
SousekiL
force-pushed
the
feat/quota-claude-devin
branch
from
September 28, 2026 05:39
c9787b2 to
ea0cd62
Compare
It is read only by the macOS Keychain branch, so Linux and Windows builds flagged it as dead code under clippy -D warnings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
Adds two more quota-detection sources on top of the
QuotaManagerfrom #845 (this PR stacks on top of #845 and includes its commits; the binding-window display now lives in #845 itself; recommend merging this PR after #845 lands, or having @ana52070 fold these two providers directly into #845):Claude Code-credentials, or<CLAUDE_CONFIG_DIR|~/.claude>/.credentials.jsonon other platforms), and calls the same endpoint used by Claude Code's/usagecommand,https://api.anthropic.com/api/oauth/usage(withanthropic-beta: oauth-2025-04-20), mapping thefive_hour/seven_dayutilization to the 5-hour and weekly windows, and mappingsubscriptionTypeto the plan name. Shows a clear message instead of a raw HTTP error when the login has expired.windsurf_api_keyandapi_server_urlfrom~/.local/share/devin/credentials.toml(supportsXDG_DATA_HOME), and calls the same Connect RPC that Devin CLI itself uses,exa.seat_management_pb.SeatManagementService/GetUserStatus, taking daily / weekly quota remaining percentage, reset time, plan name, and ACU usage fromPlanStatus(ACU is appended after the plan name in the form12.2 / 150 ACU). Both the built-indevinid and the user-registeredcustom:devinid point to the same account and the same detection.SUPPORTED_AGENTSgainsclaude_code,devin,custom:devin; reuses feat(quota): 接入 Codex 与 Antigravity 实时额度探测与监控 #845's badge and popover, no new UI.Testing
cargo test --no-default-features --bin codeg-server --lib quota→ 27 unit tests pass (6 new: payload parsing for both sides, missing-field tolerance, credential validation, camelCase / snake_case compatibility).composer-quota-badge.test.tsx→ 9 pass (2 new cases for Claude andcustom:devin; the original "unsupported agent" case now usesgemini).tsc --noEmitpasses.Assisted with Claude Code