@devries-cameron20 / t3code-1 / commits / 300baf8ebe
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): the Codex plan badge updates after a ChatGPT downgrade (#24978)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Victor Vogel committed Oct 31, 2026 at 03:36 UTC 300baf8ebe61c546ce25e9648ed7abf186ac4bd2
2 files changed +33 -3
apps/server/src/provider/CodexProvider.ts
+11 -3
@@ -117,12 +117,17 @@ function reasoningEffortLabel(reasoningEffort: string): string {
117 return REASONING_EFFORT_LABELS[reasoningEffort] ?? reasoningEffort;
118 }
119
120 -function codexAccountAuthLabel(account: CodexSchema.V2GetAccountResponse["account"]) {
120 +function codexAccountAuthLabel(
121 + account: CodexSchema.V2GetAccountResponse["account"],
122 + usagePlanType: string | null | undefined,
123 +) {
124 if (!account) return undefined;
125 if (account.type === "apiKey") return "OpenAI API Key";
126 if (account.type === "amazonBedrock") return "Amazon Bedrock";
127 if (account.type !== "chatgpt") return undefined;
125 - return codexPlanLabel(account.planType);
128 + // account/read takes the plan from the cached login token; the usage read asks the backend.
129 + const usageLabel = usagePlanType === "unknown" ? undefined : codexPlanLabel(usagePlanType);
130 + return usageLabel ?? codexPlanLabel(account.planType);
131 }
132
133 export function codexPlanLabel(planType: string | null | undefined): string | undefined {
@@ -698,7 +703,10 @@ function accountProbeStatus({ account, rateLimits }: CodexAppServerProviderSnaps
703 readonly auth: ServerProvider["auth"];
704 readonly message?: string;
705 } {
701 - const authLabel = codexAccountAuthLabel(account.account);
706 + const authLabel = codexAccountAuthLabel(
707 + account.account,
708 + rateLimits && "snapshot" in rateLimits ? rateLimits.snapshot.planType : undefined,
709 + );
710 const authEmail = codexAccountEmail(account.account);
711 const workspaceId =
712 rateLimits && "accountId" in rateLimits ? rateLimits.accountId?.trim() : undefined;
apps/server/src/provider/ProviderRegistry.test.ts
+22
@@ -410,6 +410,28 @@ it.layer(
410 }),
411 );
412
413 + it.effect("labels the plan the usage read reports over the cached login plan", () =>
414 + Effect.gen(function* () {
415 + const statusWithUsagePlan = (planType: string | null) =>
416 + checkCodexProviderStatus(defaultCodexSettings, () =>
417 + Effect.succeed(
418 + makeCodexProbeSnapshot({
419 + rateLimits: { snapshot: { planType }, resetCredits: null },
420 + }),
421 + ),
422 + );
423 +
424 + const downgraded = yield* statusWithUsagePlan("free");
425 + assert.strictEqual(downgraded.auth.label, "ChatGPT Free Subscription");
426 +
427 + const unreported = yield* statusWithUsagePlan(null);
428 + assert.strictEqual(unreported.auth.label, "ChatGPT Pro 200 Subscription");
429 +
430 + const unknown = yield* statusWithUsagePlan("unknown");
431 + assert.strictEqual(unknown.auth.label, "ChatGPT Pro 200 Subscription");
432 + }),
433 + );
434 +
435 it.effect("returns unauthenticated when app-server requires OpenAI auth", () =>
436 Effect.gen(function* () {
437 const status = yield* checkCodexProviderStatus(defaultCodexSettings, () =>