Skip to content
Open
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: 1 addition & 1 deletion apps/server/src/provider/Layers/CodexProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
const snapshot = probeResult.success.value;
const accountStatus = accountProbeStatus(snapshot.account);
const usageLimits =
snapshot.account.account?.type === "apiKey"
snapshot.account.account?.type === "apiKey" || !snapshot.account.requiresOpenaiAuth
? makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" })
: snapshot.rateLimits === undefined || "failure" in snapshot.rateLimits
? makeUnavailableUsageLimits({
Expand Down
27 changes: 26 additions & 1 deletion apps/server/src/provider/Layers/ProviderRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function makeCodexProbeSnapshot(
email: "test@example.com",
planType: "pro",
},
requiresOpenaiAuth: false,
requiresOpenaiAuth: true,
},
models: [
{
Expand Down Expand Up @@ -365,6 +365,31 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
"ProviderRegistry",
(it) => {
describe("checkCodexProviderStatus", () => {
it.effect("does not count proxy rate limits as a native subscription", () =>
Effect.gen(function* () {
for (const account of [
null,
{ type: "chatgpt" as const, email: "test@example.com", planType: "pro" as const },
]) {
const status = yield* checkCodexProviderStatus(defaultCodexSettings, () =>
Effect.succeed(
makeCodexProbeSnapshot({
account: { account, requiresOpenaiAuth: false },
rateLimits: {
snapshot: {
primary: { usedPercent: 90, windowDurationMins: 10080, resetsAt: 1789436313 },
},
rateLimitsByLimitId: null,
resetCredits: null,
},
}),
),
);
assert.strictEqual(status.usageLimits?.unavailable?.reason, "unsupported");
assert.deepStrictEqual(status.usageLimits?.windows, []);
}
}),
);
it.effect("uses the app-server account and model list for provider status", () =>
Effect.gen(function* () {
const status = yield* checkCodexProviderStatus(defaultCodexSettings, () =>
Expand Down
Loading