





















@@ -389,6 +389,7 @@ describe("bridgeCodexAppServerStartOptions", () => {
389389await applyCodexAppServerAuthProfile({
390390client: { request } as never,
391391 agentDir,
392+startOptions: createStartOptions(),
392393});
393394394395expect(request).toHaveBeenNthCalledWith(1, "account/read", { refreshToken: false });
@@ -415,6 +416,7 @@ describe("bridgeCodexAppServerStartOptions", () => {
415416await applyCodexAppServerAuthProfile({
416417client: { request } as never,
417418 agentDir,
419+startOptions: createStartOptions(),
418420});
419421420422expect(request).toHaveBeenNthCalledWith(1, "account/read", { refreshToken: false });
@@ -443,6 +445,7 @@ describe("bridgeCodexAppServerStartOptions", () => {
443445await applyCodexAppServerAuthProfile({
444446client: { request } as never,
445447 agentDir,
448+startOptions: createStartOptions(),
446449});
447450448451expect(request).toHaveBeenCalledTimes(1);
@@ -465,6 +468,7 @@ describe("bridgeCodexAppServerStartOptions", () => {
465468await applyCodexAppServerAuthProfile({
466469client: { request } as never,
467470 agentDir,
471+startOptions: createStartOptions(),
468472});
469473470474expect(request).toHaveBeenCalledTimes(1);
@@ -474,6 +478,32 @@ describe("bridgeCodexAppServerStartOptions", () => {
474478}
475479});
476480481+it("does not send env API-key fallback to websocket app-server connections", async () => {
482+const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-"));
483+const request = vi.fn(async (method: string) => {
484+if (method === "account/read") {
485+return { account: null, requiresOpenaiAuth: true };
486+}
487+return { type: "apiKey" };
488+});
489+vi.stubEnv("CODEX_API_KEY", "codex-env-api-key");
490+vi.stubEnv("OPENAI_API_KEY", "openai-env-api-key");
491+try {
492+await applyCodexAppServerAuthProfile({
493+client: { request } as never,
494+ agentDir,
495+startOptions: createStartOptions({
496+transport: "websocket",
497+url: "ws://127.0.0.1:1455",
498+}),
499+});
500+501+expect(request).not.toHaveBeenCalled();
502+} finally {
503+await fs.rm(agentDir, { recursive: true, force: true });
504+}
505+});
506+477507it("applies an OpenAI Codex token profile backed by a secret ref", async () => {
478508const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-app-server-"));
479509const request = vi.fn(async () => ({ type: "chatgptAuthTokens" }));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。