fix(server): Grok accounts with no usage yet no longer vanish from Limits - #12799
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Grok limits bug fix that changes only how successful responses with no metered usage are represented, keeping those accounts visible without altering valid usage or genuinely unsupported paths. The production change is covered by focused test expectations and introduces no schema, deployment, or static-analysis changes. You can add or adjust custom eligibility rules. Learn more. |
|
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: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughGrok billing responses without valid metering data now produce empty usage limits instead of unsupported limits. The related test verifies that the account remains available in the Limits view. ChangesGrok usage limits
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| // A billing read that succeeded but carries no percentage is an account | ||
| // with nothing metered yet, not one that can never report: xAI omits the | ||
| // field entirely (rather than sending 0) until usage registers, then fills | ||
| // it in. Calling that `unsupported` would strand the account — the Limits | ||
| // view drops unsupported entries and deliberately mutes their notice, so a | ||
| // freshly signed-in Grok account would vanish with no explanation until it | ||
| // happened to be used, and `applyUsageLimitsUpdate` would refuse the | ||
| // mid-turn windows that could have recovered it. |
There was a problem hiding this comment.
since the t3 team has collaborated with grok, maybe something to ask them to fix on their end
…mits xAI omits `creditUsagePercent` from its billing response entirely until an account has accrued metered usage, rather than sending 0. We treated that absence as `unsupported`, which the contract reserves for accounts that can never report quota, such as API keys and Bedrock. The Limits view drops those accounts and deliberately mutes their notice, so a freshly signed-in Grok account disappeared from Usage with no bar and no explanation until it happened to be used. `applyUsageLimitsUpdate` also refuses mid-turn windows for an `unsupported` snapshot, so nothing could recover it in the meantime. Report no windows instead, leaving the `unavailable` marker off. The account keeps its row and gets the existing "No limits reported." notice, and the bar appears on its own once usage registers. The genuine can-never-report paths in `readGrokUsageLimits` (API key, alternate auth deployments, custom config) still return `unsupported` and are unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
81e95dc to
e5de07b
Compare
## What's Changed * fix(web): sidebar Back always returns to the main app by @t3dotgg in pingdotgg/t3code#13516 * fix(desktop): desktop updates reconnect in seconds, not minutes by @t3dotgg in pingdotgg/t3code#12006 * fix(connect): remove tunnels after hosts go offline by @t3dotgg in pingdotgg/t3code#9386 * fix(mobile): capture a lit 6.9-inch lock screen in the agent-activity showcase by @juliusmarminge in pingdotgg/t3code#13522 * feat(grok): offer one-click updates through `grok update` by @juliusmarminge in pingdotgg/t3code#13523 * fix(mobile): make Android subscription usage widgets scrollable by @tris203 in pingdotgg/t3code#13474 * fix(web): keep sidebar terminal pulses in sync by @t3dotgg in pingdotgg/t3code#12962 * feat(web): add iPhone Duo 3D controls by @juliusmarminge in pingdotgg/t3code#12813 * fix(relay): export tunnel cleanup counters to Axiom by @juliusmarminge in pingdotgg/t3code#13528 * fix(server): Grok accounts with no usage yet no longer vanish from Limits by @jakeleventhal in pingdotgg/t3code#12799 * fix(server): report the Grok account email so usage limits merge across environments by @jakeleventhal in pingdotgg/t3code#12588 * feat(web): add usage page keybinding by @jakeleventhal in pingdotgg/t3code#9434 * chore: clear Effect language service suggestions by @juliusmarminge in pingdotgg/t3code#13536 * ci(relay): add a forced manual relay deploy by @juliusmarminge in pingdotgg/t3code#13550 * fix(web): selected text stays visible on a revealed file line by @t3dotgg in pingdotgg/t3code#13548 * fix(web): collapsed composer bar stops flipping its labels while you scroll by @t3dotgg in pingdotgg/t3code#13555 * fix(clients): sync status no longer flickers when opening running threads by @t3dotgg in pingdotgg/t3code#13551 * fix(server): newer Codex models get T3 Code's instructions again by @t3dotgg in pingdotgg/t3code#13547 **Full Changelog**: pingdotgg/t3code@v0.0.43-nightly.20260924.2223...v0.0.43-nightly.20260925.2237 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.43-nightly.20260925.2237
xAI omits
creditUsagePercentfrom its billing response entirely until an account has accrued metered usage — it sends the field late rather than sending0. We mapped that absence tounavailable: { reason: "unsupported" }, which the contract reserves for accounts that can never report quota (API keys, Bedrock).collectLimitAccountsdrops those accounts, andcollectLimitNoticesdeliberately mutes their notice because there is nothing to act on. The result: a freshly signed-in Grok account disappears from the Limits view with no bar and no explanation, until it happens to be used.applyUsageLimitsUpdatealso refuses mid-turn windows for anunsupportedsnapshot, so nothing could recover it in the meantime.I hit this with a second Grok account: it was signed in, listed in the model picker, and running threads, but simply absent from Usage with nothing to indicate why.
grokUsageResponseToLimitsnow reports no windows and leaves theunavailablemarker off when the billing read succeeds but carries no percentage. The account keeps its row and picks up the existing "No limits reported." notice, and the bar appears on its own once usage registers. The genuine can-never-report paths inreadGrokUsageLimits(API key, alternate auth deployments, custom config layers) still returnunsupportedand are untouched.Before
The second Grok account is signed in and working, but nothing on the page mentions it.
After
Captured against a dev server with two Grok instances, with the billing response for the second stubbed to the real payload xAI returns for an unmetered account (
currentPeriodpresent, nocreditUsagePercent). That stub was only for the screenshots and is not part of the diff.vp test run apps/server/src/provider/Layers/GrokProvider.test.ts packages/shared/src/usageLimits.test.ts— 62 passing. The shared side already covered this shape: a provider with empty windows and no marker yields "No limits reported." while anunsupportedone is skipped, so no client change was needed.Model: Claude Opus 5 (1M context). Harness: Claude Code in T3 Code.
🤖 Generated with Claude Code
Summary by CodeRabbit