Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/server/src/provider/CodexProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
? { status: "ready" as const, auth: managedAuth, message: undefined }
: accountProbeStatus(snapshot);
const usageLimits =
// Only a ChatGPT login has quotas; a custom model provider runs with no account.
(!snapshot.account.account && !snapshot.account.requiresOpenaiAuth) ||
snapshot.account.account?.type === "apiKey"
? makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" })
: snapshot.rateLimits === undefined || "failure" in snapshot.rateLimits
Expand Down
17 changes: 17 additions & 0 deletions apps/server/src/provider/ProviderRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}),
);

Expand Down Expand Up @@ -547,6 +548,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, () =>
Expand Down
Loading