Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): managed Codex renews the token its model catalog uses #33713

Openjuliusmarmingewants to merge 7 commits intomain fromrefs/pull/33713/headopened View on GitHub

Showing 5 changed files with 8 additions and 3 deletions (loading 2).

x
0 of 5 viewed, 5 left
2 additions and 1 deletionapps/server/src/provider/CodexChatGptAuth.test.tsModified
View file
@@ -736,7 +736,8 @@
yield* h.phase("succeeded");
assert.strictEqual(Option.getOrThrow(yield* h.auth.read).subject, "user-test");
assert.strictEqual(h.exchanges[0]?.get("client_id"), "oaiapp_test");
- yield* h.seedExpired;
+ // 75 s left on the one-hour token: inside the renewal margin Codex's 60 s token cache needs.
+ yield* TestClock.adjust("3525 seconds");
const records = yield* Effect.all([h.auth.access, h.auth.access], {
concurrency: "unbounded",
});
2 additions and 1 deletionapps/server/src/provider/CodexChatGptAuth.tsModified
View file
@@ -31,6 +31,7 @@
import { HttpClient, HttpClientRequest } from "effect/http";
import * as ProviderCredentialStore from "./ProviderCredentialStore.ts";
import { withChatGptSessionLock } from "./CodexChatGptSessionLock.ts";
+import { TOKEN_RENEWAL_MARGIN_MS } from "./CodexManagedTokenProtocol.ts";
import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
import * as ServerSettings from "../serverSettings.ts";
import * as ServerEnvironment from "../environment/ServerEnvironment.ts";
@@ -823,7 +824,7 @@
"Token sharing is disabled. Sign in with ChatGPT and enable token sharing.",
const now = yield* Clock.currentTimeMillis;
- if (record.expiresAt - now > 60_000) return record;
+ if (record.expiresAt - now > TOKEN_RENEWAL_MARGIN_MS) return record;
if (record.earliestRefreshAt !== null && record.earliestRefreshAt > now) {