From 2270b832acd1d3af5e074079d70c5f5e755264ad Mon Sep 17 00:00:00 2001 From: Vinay Bhagavath Date: Mon, 3 Aug 2026 10:44:21 -0700 Subject: [PATCH 1/2] test(dcode): cover secret rejection exit code (#8137) --- test/dcode-wrapper-identity.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/dcode-wrapper-identity.test.ts b/test/dcode-wrapper-identity.test.ts index cb91c318977..cf2949676e2 100644 --- a/test/dcode-wrapper-identity.test.ts +++ b/test/dcode-wrapper-identity.test.ts @@ -184,6 +184,21 @@ describe.skipIf(!canRun)( }); }); + it("returns exit code 2 when .env contains a raw OpenAI API key (#8137)", () => { + withTempDir((dir) => { + const fixture = buildFixture(dir, SAMPLE_CONFIG); + fs.writeFileSync(fixture.envFile, "OPENAI_API_KEY=sk-live-XXXXXXXXXXXXX\n", "utf8"); + + const run = runBashWrapper(fixture, ["-n", "Reply with PING."], {}); + + expect(run.status).toBe(2); + expect(run.launched).toBe(false); + expect(run.stderr).toContain("refusing to start"); + expect(run.stderr).toContain("OPENAI_API_KEY"); + expect(run.stderr).not.toContain("sk-live-XXXXXXXXXXXXX"); + }); + }); + it("ignores traversal-shaped agent preferences", () => { withTempDir((dir) => { const config = SAMPLE_CONFIG.replace('default = "backend-dev"', 'default = ".."'); From 6f64df817366f1d2217af1eb94df931c604daf06 Mon Sep 17 00:00:00 2001 From: Vinay Bhagavath Date: Mon, 3 Aug 2026 10:50:58 -0700 Subject: [PATCH 2/2] test(dcode): cover secret output streams (#8137) --- test/dcode-wrapper-identity.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dcode-wrapper-identity.test.ts b/test/dcode-wrapper-identity.test.ts index cf2949676e2..71251466676 100644 --- a/test/dcode-wrapper-identity.test.ts +++ b/test/dcode-wrapper-identity.test.ts @@ -195,7 +195,7 @@ describe.skipIf(!canRun)( expect(run.launched).toBe(false); expect(run.stderr).toContain("refusing to start"); expect(run.stderr).toContain("OPENAI_API_KEY"); - expect(run.stderr).not.toContain("sk-live-XXXXXXXXXXXXX"); + expect(`${run.stdout}\n${run.stderr}`).not.toContain("sk-live-XXXXXXXXXXXXX"); }); });