From 7e47a1d36bf5269bae075d10f1601df4736b031c Mon Sep 17 00:00:00 2001 From: roboomp Date: Fri, 17 Jul 2026 02:55:39 +0000 Subject: [PATCH] test(auth): isolated import fixtures from broker env Saved and cleared ambient auth-broker settings around local-store import tests, then restored them after each case. Fixes #5782 --- packages/coding-agent/CHANGELOG.md | 4 ++++ packages/coding-agent/test/auth-broker-import.test.ts | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 5406325c3..a96dd9adb 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -6,6 +6,10 @@ - `retry.fallbackChains` wildcards now support id-prefixed targets and keys: a chain entry like `"openrouter/google/*"` re-prefixes the failing model's bare id (`google-antigravity/gemini-x` → `openrouter/google/gemini-x`), a plain `"provider/*"` entry falling back *from* an aggregator strips the vendor prefix when the target provider only knows the bare id (`openrouter/google/x` → `google-vertex/x`), and an id-prefixed key (`"openrouter/google/*"`) scopes a chain to that provider's ids under the prefix. +### Fixed + +- Isolated the CLIProxyAPI auth-broker import tests from ambient broker configuration so fixture credentials cannot be uploaded to a live broker ([#5782](https://github.com/can1357/oh-my-pi/issues/5782)). + ## [17.0.1] - 2026-07-16 ### Changed diff --git a/packages/coding-agent/test/auth-broker-import.test.ts b/packages/coding-agent/test/auth-broker-import.test.ts index cea621e58..6077a3746 100644 --- a/packages/coding-agent/test/auth-broker-import.test.ts +++ b/packages/coding-agent/test/auth-broker-import.test.ts @@ -22,9 +22,14 @@ describe("auth-broker import (CLIProxyAPI)", () => { let agentDir = ""; let cliproxyDir = ""; let originalAgentDir: string | undefined; + const savedEnv: Record = {}; beforeEach(async () => { originalAgentDir = process.env.OMP_AGENT_DIR; + savedEnv.OMP_AUTH_BROKER_URL = process.env.OMP_AUTH_BROKER_URL; + savedEnv.OMP_AUTH_BROKER_TOKEN = process.env.OMP_AUTH_BROKER_TOKEN; + delete process.env.OMP_AUTH_BROKER_URL; + delete process.env.OMP_AUTH_BROKER_TOKEN; agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "omp-import-agent-")); cliproxyDir = await fs.mkdtemp(path.join(os.tmpdir(), "omp-import-cliproxy-")); setAgentDir(agentDir); @@ -36,6 +41,10 @@ describe("auth-broker import (CLIProxyAPI)", () => { else process.env.OMP_AGENT_DIR = originalAgentDir; await removeWithRetries(agentDir); await removeWithRetries(cliproxyDir); + for (const key of ["OMP_AUTH_BROKER_URL", "OMP_AUTH_BROKER_TOKEN"] as const) { + if (savedEnv[key] === undefined) delete process.env[key]; + else process.env[key] = savedEnv[key]; + } }); async function writeCliProxyJson(name: string, body: Record): Promise {