Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/dcode-wrapper-identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.stdout}\n${run.stderr}`).not.toContain("sk-live-XXXXXXXXXXXXX");
});
});

it("ignores traversal-shaped agent preferences", () => {
withTempDir((dir) => {
const config = SAMPLE_CONFIG.replace('default = "backend-dev"', 'default = ".."');
Expand Down
Loading