fix(server): usage hubs with a host-less URL no longer vanish from Limits#11368
Refs #10193 (doesn't fix it: the reconnect loop there didn't reproduce)
A usage hub saved with a URL that has no scheme, such as localhost:8317, silently disappears from Usage → Limits. Node parses that URL with an empty host, so the hub's label is empty. The label fails to encode, and the server drops that hub from the list it sends to clients. There's no error anywhere, and other hubs keep working.
When the parsed host is empty, the label now falls back to the hub's ID (or "Usage limit source" if the ID is blank), so the hub shows up on Usage → Limits with its error. This doesn't change or repair the saved URL.
GPT-6 via Codex in T3 Code.
Summary by CodeRabbit
Bug Fixes
- Improved usage-limit source labels when configured URLs are missing, malformed, or lack a host.
- Uses a clear fallback label instead of displaying an unprocessed source identifier.
Tests
- Added coverage confirming malformed source URLs remain supported in configuration updates.
- Verified source labels, management-key validation errors, and prevention of unexpected network requests.
Real-app retest on current code (Oct 14, 2026)
Fresh worktrees of current main and this branch, web app on a dev server each. Settings → Providers → Usage providers: added a hub with URL localhost:8317 and one with https://hub.test:8318, then opened Usage → Limits.
Main: only hub.test:8318 shows; the localhost:8317 hub is silently missing | This PR: both hubs show, the bad one labeled by its ID (cliproxy-hub) |
|---|---|
Both hubs are saved in Settings on both builds:
| Main | This PR |
|---|---|
The valid hub keeps its host as the label on both builds. No client disconnect or reconnect, console error or server error on either build.
Checks
Approvability
Verdict: Approved at 98bacc9
Macroscope's review found this PR approvable — This is a narrowly scoped server bug fix that keeps usage-source snapshots schema-valid for malformed or hostless URLs, preventing configuration-stream disconnects while preserving valid labels and existing management-key behavior. The added test is development-only and covers the affected service and event-encoding path.
No code changes detected at cba258a. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
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: 11fd54f · PR result: cba258a · Source CI: success
Scenario 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.
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.
Review Change StackReview Change Stack
Important
Review skipped
We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.
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. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
a79d67c3-3c4f-48ad-a0aa-5d6d39c85865
📥 Commits
Reviewing files that changed from the base of the PR and between 20363c32c9bfdbf49c2716ef11d1f18483fcc01b and 324a644269d5838e4a72d151bba38938e6477fbe.
📒 Files selected for processing (2)
apps/server/src/usage/UsageLimitSources.test.tsapps/server/src/usage/UsageLimitSources.ts
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
The change updates usage-limit source labels for invalid or hostless URLs. It adds an effect-based test that verifies source snapshots remain encodable in
ServerConfigStreamEventupdates.Changes: Usage limit source handling
Layer / File(s) Summary Source label fallback and encoding validation
apps/server/src/usage/UsageLimitSources.ts,apps/server/src/usage/UsageLimitSources.test.tssourceLabelnow uses a trimmed source ID or"Usage limit source"when a URL is invalid or has no host. The test verifies labels, missing management-key errors, snapshot encoding, and disabled network activity.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to 2e354
Malformed or hostless usage source URLs now receive safe non-empty labels while preserving source errors, with regression coverage for configuration-event encoding. No merge-blocking risk is identified.
Pre-merge checks: Passed 4 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Passed Passed checks: 4 passed
Check name Status Explanation 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. Title check Passed The title clearly and concisely describes the main fix: usage hubs with host-less URLs remain visible in Limits. Description check Passed The description clearly explains the problem, the fallback behavior, the unchanged URL handling, and the verification results with before-and-after evidence. It does not use the template headings exac…
✨ Finishing Touches 💡 1
-
📝 Generate docstrings 💡
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/server-usage-source-empty-label
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- fix(server): keep malformed usage sources from disconnecting clientsed9b5b4
hey any update on this? i cant use t3code at all because of this bug.
Added 2 commits