From 18ba61973a8e90624995c0e6706e7cabad9f0eae Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 21:49:24 +0000 Subject: [PATCH 1/2] test(evals): GPT evals refuse a provider that requires OpenAI auth with no key Failing repro for #39373. Co-Authored-By: Claude Opus 5.5 --- evals/shared/proxy.test.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 evals/shared/proxy.test.ts diff --git a/evals/shared/proxy.test.ts b/evals/shared/proxy.test.ts new file mode 100644 index 0000000000000..bdb9848aec9cc --- /dev/null +++ b/evals/shared/proxy.test.ts @@ -0,0 +1,31 @@ +import * as NodeFS from "node:fs"; +import * as NodeOS from "node:os"; +import * as NodePath from "node:path"; +import { describe, expect, it, vi } from "vite-plus/test"; +import { proxyConfig } from "./proxy.ts"; + +const config = `model_provider = "cliproxy" + +[model_providers.cliproxy] +base_url = "https://proxy.example/v1" +requires_openai_auth = true +`; + +describe("proxyConfig", () => { + it.each([ + ["no auth.json", undefined], + ["a ChatGPT-login auth.json", { OPENAI_API_KEY: null, tokens: { access_token: "t" } }], + ])("fails when the provider requires OpenAI auth and %s has no key", (_, auth) => { + const home = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-evals-proxy-")); + using _home = { + [Symbol.dispose]: () => { + vi.unstubAllEnvs(); + NodeFS.rmSync(home, { recursive: true }); + }, + }; + NodeFS.writeFileSync(NodePath.join(home, "config.toml"), config); + if (auth) NodeFS.writeFileSync(NodePath.join(home, "auth.json"), JSON.stringify(auth)); + vi.stubEnv("CODEX_HOME", home); + expect(() => proxyConfig()).toThrow(/requires_openai_auth/); + }); +}); From 7c2266a55123c5a3fb98455407afd4508026d240 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 21:52:51 +0000 Subject: [PATCH 2/2] fix(evals): GPT evals stop at startup when OpenAI auth is required but no key is found A Codex provider with requires_openai_auth and no OPENAI_API_KEY in auth.json (missing, or a ChatGPT login) now fails with a setup error instead of sending every request without an Authorization header. Fixes pingdotgg/t3code#39373 Co-Authored-By: Claude Opus 5.5 --- evals/shared/proxy.test.ts | 1 + evals/shared/proxy.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/evals/shared/proxy.test.ts b/evals/shared/proxy.test.ts index bdb9848aec9cc..a38c1656510f9 100644 --- a/evals/shared/proxy.test.ts +++ b/evals/shared/proxy.test.ts @@ -1,3 +1,4 @@ +// @effect-diagnostics nodeBuiltinImport:off import * as NodeFS from "node:fs"; import * as NodeOS from "node:os"; import * as NodePath from "node:path"; diff --git a/evals/shared/proxy.ts b/evals/shared/proxy.ts index 12ea4c150e80c..f088316cea97f 100644 --- a/evals/shared/proxy.ts +++ b/evals/shared/proxy.ts @@ -40,6 +40,7 @@ h.update({k: os.environ[v] for k,v in p.get('env_http_headers', {}).items()}) key = os.environ.get(p['env_key']) if p.get('env_key') else p.get('experimental_bearer_token') if p.get('env_key') and not key: fail(f'[model_providers.{name}] in {path} reads its key from {p["env_key"]}, which is not set.') if not key and p.get('requires_openai_auth') and (home / 'auth.json').is_file(): key = json.loads((home / 'auth.json').read_text()).get('OPENAI_API_KEY') +if not key and p.get('requires_openai_auth'): fail(f'[model_providers.{name}] in {path} sets requires_openai_auth, but {home / "auth.json"} has no OPENAI_API_KEY.') if key: h['Authorization'] = 'Bearer ' + key print(json.dumps({'url': p['base_url'].rstrip('/'), 'headers': h})) `,