fix(server): Claude limits load again for users with large transcript histories #16358
main fromrefs/pull/16358/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubUsers with a few GB of Claude transcripts saw probeFailed on every Claude instance, and the Limits tab stayed empty. The probe's usage request also scans every local transcript from the last 7 days to fill behaviors. The probe never reads that field. With about 4 GB of transcripts the request takes 5.4-5.8 s, which is longer than the probe's 4 s deadline.
The probe now calls usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET({ skipBehaviors: true }). The SDK documents this option for callers that need only the plan rate limits. With it, the same request answers in about 0.4 s.
This takes over #14456 by @Ashkaan, who found the cause and wrote the fix. Their commit is kept with its authorship. It is rebased onto the module layout that replaced provider/Layers/, and its test moved to ClaudeCapabilitiesProbe.test.ts.
Proof: the new test fails without the option and passes with it. The installed CLI (2.1.287) accepts skip_behaviors and documents that it skips the transcript scan. A real SDK call with the option succeeds. I could not reproduce the 5 s slowdown on my machine: it authenticates through a proxy token that has no plan limits, so the timings above are @Ashkaan's measurements.
Co-authored-by: Ashkaan <a@ashkaan.me>
🤖 Generated with Claude Code using Claude Opus 5.5
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
Approvability#
Verdict: Approved at
874854fMacroscope's review found this PR approvable — This narrowly fixes Claude capability probing for large transcript histories by skipping an unused local scan while preserving rate-limit data. The production change is isolated and covered by a regression test, with no product-default, schema, security, or deployment changes.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).53453ba. Prior analysis still applies.Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
61a0ec9· PR result:53453ba· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
70668d5c-f36c-4bd3-bf4e-c02f680bff67
📥 Commits
Reviewing files that changed from the base of the PR and between 874854f2d160606627f78e05f979ecc38de9d6c9 and 53453ba0cd7e1472ff65d12cbe23024760dd9349.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
6afb7458-0aa8-439a-be38-a08e515b20ea
📥 Commits
Reviewing files that changed from the base of the PR and between 71964e670ff212006ebb8de26585649c2adced68 and 874854f2d160606627f78e05f979ecc38de9d6c9.
📒 Files selected for processing (2)
apps/server/src/provider/ClaudeCapabilitiesProbe.test.tsapps/server/src/provider/ClaudeProvider.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough#
The Claude capability probe now requests usage data with behavior collection disabled. A test verifies that the request receives
{ skipBehaviors: true }.Changes#
Claude usage probe
Layer / File(s) Summary Skip behavior collection in usage probe
apps/server/src/provider/ClaudeProvider.ts,apps/server/src/provider/ClaudeCapabilitiesProbe.test.tsThe usage request passes skipBehaviors: true. The probe still reads rate-limit fields, and a test verifies the request option. Existing timeout and failure handling remain unchanged.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
juliusmarmingeMerge Risk: ⚪ Minimal · up to
87485The probe can skip transcript scanning while still reading plan rate limits, so no actionable merge risk remains.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly identifies the fix: Claude limits load again for users with large transcript histories. It is concise and relevant to the main change. Description check ✅ Passed The description covers the problem, the change, and focused verification, including what could not be reproduced. It also identifies issue #14456. It does not state that maintainers approved the direc…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. ✨ Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes