Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(codex): report the stored login email when a custom provider hides the account #13114

Closedomar7550(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/13114/headopened View on GitHub

Showing 3 changed files with 90 additions and 5 deletions.

x
0 of 3 viewed, 3 left
20 additions and 1 deletionapps/server/src/provider/Layers/CodexProvider.test.tsModified
View file
@@ -1,6 +1,10 @@
import { assert, it } from "@effect/vitest";
​
-import { applyPreferredCodexDefaultModel, mapCodexModelCapabilities } from "./CodexProvider.ts";
+import {
+ applyPreferredCodexDefaultModel,
+ codexStoredLoginEmail,
+ mapCodexModelCapabilities,
+} from "./CodexProvider.ts";
​
it("maps current Codex model capability fields", () => {
const capabilities = mapCodexModelCapabilities({
@@ -161,3 +165,18 @@
​
assert.deepStrictEqual(models.find((model) => model.isDefault)?.slug, "gpt-5.4");
});
+​
+it("reads the email claim from a stored ChatGPT login", () => {
+ const claims = Buffer.from(JSON.stringify({ email: "pooled@example.com" })).toString("base64url");
+ const authJson = JSON.stringify({ tokens: { id_token: `header.${claims}.signature` } });
+ assert.strictEqual(codexStoredLoginEmail(authJson), "pooled@example.com");
+ assert.strictEqual(
+ codexStoredLoginEmail(JSON.stringify({ OPENAI_API_KEY: "sk-test" })),
+ undefined,
+ );
+ assert.strictEqual(codexStoredLoginEmail("not json"), undefined);
+ assert.strictEqual(
+ codexStoredLoginEmail(JSON.stringify({ tokens: { id_token: "no-payload" } })),
+ undefined,
+ );