Repository navigation
fix(server): give Claude's usage read time to answer - #14064
mkantautas wants to merge 1 commit into
Conversation
get_usage takes 2.7-4.3s with Claude Code 2.1.283, and the probe cut it off at the shared 4s budget, so Usage > Limits showed "Could not read limits." on most probes. The read gets its own 15s budget and logs a warning when it fails.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This small bug fix gives Claude’s existing usage probe enough time to receive slow responses while preserving the overall probe deadline and existing capability fallback behavior. The accompanying test covers both delayed success and timeout handling. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe Claude capability probe now allows 15 seconds for its optional usage request. Usage-read failures are logged as warnings. Tests cover delayed usage data and timeout behavior. ChangesClaude usage probe
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Claude usage reads have more time to return without withholding initialized account and command capabilities. No actionable merge-blocking risk is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change adds no new endpoint or privilege, and a failed usage read still leaves account information available. It does newly log failure details from the usage request. Whether those details can contain sensitive information is not established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Note Grok responding on behalf of Julius. Thanks for digging into this. #16358 is now on main and fixes the same "Could not read limits" failure at its source: most of |
What Changed
The Claude capabilities probe gives the SDK's
get_usageread its own 15s budget instead of the shared 4sDEFAULT_TIMEOUT_MS, and logs a warning when the read fails. The existing timeout test moves to 15s; a new test covers a read that answers after 5s.Why
Usage → Limits showed "Claude: Could not read limits." on a working Claude Max account.
get_usagemakes the CLI fetch the account's usage from Anthropic, and with Claude Code 2.1.283 that took 2.7–4.3s across seven runs of the probe's exact SDK options (0.3.276). The 4s timeout cut it off, the probe returned nousage, and the provider publishedprobeFailed. The server trace shows the same thing:checkClaudeProviderStatusspans of 4.6–4.9s, which is init (~0.7s) plus the 4s timeout. Nothing was logged, so the failure was invisible outside the UI.The probe returns its result once the usage read settles, so a read that hangs now holds the result for up to 15s instead of 4s. Initialization keeps its own 25s budget.
Checklist
Verified with
vp test run src/provider/Layers/ClaudeCapabilitiesProbe.test.ts(4 passed; the new test fails on the old 4s budget),vp lintandvp fmt --checkon the two files, and the server typecheck.Summary by CodeRabbit
Fixes #15354