From a7598ad4643aadc17034ffe1d7ded32f5293a939 Mon Sep 17 00:00:00 2001 From: Abdillah Bakari Ali Date: Mon, 12 Oct 2026 21:23:00 +0300 Subject: [PATCH 1/2] fix: skip Codex usage without an account - custom model providers run with no account, so account/rateLimits/read always fails with -32600 - report usage as unsupported instead of a probe error --- apps/server/src/provider/CodexProvider.ts | 3 ++- .../server/src/provider/ProviderRegistry.test.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/CodexProvider.ts b/apps/server/src/provider/CodexProvider.ts index 7d4bbfdf5d0fa..99b737001837b 100644 --- a/apps/server/src/provider/CodexProvider.ts +++ b/apps/server/src/provider/CodexProvider.ts @@ -740,7 +740,8 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu ? { status: "ready" as const, auth: managedAuth, message: undefined } : accountProbeStatus(snapshot); const usageLimits = - snapshot.account.account?.type === "apiKey" + // Only a ChatGPT login has quotas; a custom model provider runs with no account. + !snapshot.account.account || snapshot.account.account.type === "apiKey" ? makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }) : snapshot.rateLimits === undefined || "failure" in snapshot.rateLimits ? makeUnavailableUsageLimits({ diff --git a/apps/server/src/provider/ProviderRegistry.test.ts b/apps/server/src/provider/ProviderRegistry.test.ts index d0c1f348a7366..57cf9eb7f3627 100644 --- a/apps/server/src/provider/ProviderRegistry.test.ts +++ b/apps/server/src/provider/ProviderRegistry.test.ts @@ -547,6 +547,22 @@ it.layer( }), ); + it.effect("marks usage unsupported when a custom provider runs without an account", () => + Effect.gen(function* () { + const status = yield* checkCodexProviderStatus(defaultCodexSettings, () => + Effect.succeed( + makeCodexProbeSnapshot({ + account: { account: null, requiresOpenaiAuth: false }, + rateLimits: { failure: "Codex could not read usage (JSON-RPC -32600)." }, + }), + ), + ); + + assert.strictEqual(status.status, "ready"); + assert.deepStrictEqual(status.usageLimits?.unavailable, { reason: "unsupported" }); + }), + ); + it.effect("returns an Amazon Bedrock label for codex Bedrock auth", () => Effect.gen(function* () { const status = yield* checkCodexProviderStatus(defaultCodexSettings, () => From 4cdd98bbc172ee7692f8d99a581c52e71bbff71c Mon Sep 17 00:00:00 2001 From: Abdillah Bakari Ali Date: Tue, 13 Oct 2026 14:13:07 +0300 Subject: [PATCH 2/2] fix: keep probe failure for logged-out Codex --- apps/server/src/provider/CodexProvider.ts | 3 ++- apps/server/src/provider/ProviderRegistry.test.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/CodexProvider.ts b/apps/server/src/provider/CodexProvider.ts index 99b737001837b..4393230eeae4b 100644 --- a/apps/server/src/provider/CodexProvider.ts +++ b/apps/server/src/provider/CodexProvider.ts @@ -741,7 +741,8 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu : accountProbeStatus(snapshot); const usageLimits = // Only a ChatGPT login has quotas; a custom model provider runs with no account. - !snapshot.account.account || snapshot.account.account.type === "apiKey" + (!snapshot.account.account && !snapshot.account.requiresOpenaiAuth) || + snapshot.account.account?.type === "apiKey" ? makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }) : snapshot.rateLimits === undefined || "failure" in snapshot.rateLimits ? makeUnavailableUsageLimits({ diff --git a/apps/server/src/provider/ProviderRegistry.test.ts b/apps/server/src/provider/ProviderRegistry.test.ts index 57cf9eb7f3627..2e4d7662551d0 100644 --- a/apps/server/src/provider/ProviderRegistry.test.ts +++ b/apps/server/src/provider/ProviderRegistry.test.ts @@ -506,6 +506,7 @@ it.layer( status.message, "Codex CLI is not authenticated. Run `codex login` and try again.", ); + assert.strictEqual(status.usageLimits?.unavailable?.reason, "probeFailed"); }), );