Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Grok accounts with no usage yet no longer vanish from Limits #12799

Mergedjakeleventhal(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/12799/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 13 additions and 2 deletions.

x
0 of 2 viewed, 2 left
4 additions and 1 deletionapps/server/src/provider/Layers/GrokProvider.test.tsModified
View file
@@ -564,7 +564,10 @@
for (const response of [{}, { config: {} }, { config: { creditUsagePercent: NaN } }]) {
const limits = grokUsageResponseToLimits(response, checkedAt);
expect(limits.windows).toEqual([]);
- expect(limits.unavailable?.reason).toBe("unsupported");
+ // Nothing metered yet, which xAI reports by omitting the field until
+ // usage registers. Marking it `unsupported` would drop the account from
+ // the Limits view for good; leaving the marker off keeps it listed.
+ expect(limits.unavailable).toBeUndefined();
expect(
grokUsageResponseToLimits({ config: { creditUsagePercent: 0 } }, checkedAt).windows,
9 additions and 1 deletionapps/server/src/provider/Layers/grokUsageLimits.tsModified
View file
@@ -41,7 +41,15 @@
) {
const usedPercent = response.config?.creditUsagePercent;
if (usedPercent === undefined || !Number.isFinite(usedPercent)) {
- return makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" });
+ // 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.
Thread on lines 44 to 51

since the t3 team has collaborated with grok, maybe something to ask them to fix on their end