From bcecf9b3340a715feb18b6270f2a70f243d91c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Mon, 16 Nov 2026 18:27:30 +0500 Subject: [PATCH] =?UTF-8?q?PEP-171:=20Codex=20agents=20start=20without=20t?= =?UTF-8?q?he=20removed=20--full-auto=20=E2=80=94=20no=20approvals,=20no?= =?UTF-8?q?=20sandbox=20by=20default=20(like=20bypassPermissions);=20mock-?= =?UTF-8?q?codex=20refuses=20--full-auto=20like=20Codex=200.169?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- packages/runner/src/providers.ts | 7 +++++-- packages/testkit/src/mock-agent.ts | 5 +++++ packages/testkit/test/limits.test.ts | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/runner/src/providers.ts b/packages/runner/src/providers.ts index 349b6876..1b61f111 100644 --- a/packages/runner/src/providers.ts +++ b/packages/runner/src/providers.ts @@ -67,8 +67,11 @@ function claudeCommand(c: LaunchContext): string[] { /** * Codex has no Claude-style hooks: Peppa only learns about completed turns through the * `notify` callback, and about crashes, stalls and limits through the watchdog. - * Permission prompts can't be routed to the PM, so it runs in --full-auto by default. + * Permission prompts can't be routed to the PM: like Claude's bypassPermissions (PEP-171 — Codex + * 0.169 removed --full-auto) it runs with no approvals and no sandbox, unless PEPPA_CODEX_MODE says otherwise. */ +export const CODEX_DEFAULT_MODE = "--sandbox danger-full-access --ask-for-approval never"; + function codexCommand(c: LaunchContext): string[] { const toml = (v: unknown) => JSON.stringify(v); return [ @@ -76,7 +79,7 @@ function codexCommand(c: LaunchContext): string[] { "--no-alt-screen", "--cd", c.cwd, - ...(c.permissionMode ?? process.env.PEPPA_CODEX_MODE ?? "--full-auto").split(" ").filter(Boolean), + ...(c.permissionMode ?? process.env.PEPPA_CODEX_MODE ?? CODEX_DEFAULT_MODE).split(" ").filter(Boolean), ...(c.model ? ["--model", c.model] : []), // Codex knows low/medium/high (xhigh/max → high). ...(c.effort ? ["-c", `model_reasoning_effort=${toml(["xhigh", "max"].includes(c.effort) ? "high" : c.effort)}`] : []), diff --git a/packages/testkit/src/mock-agent.ts b/packages/testkit/src/mock-agent.ts index a7e0f3ae..07bd2157 100644 --- a/packages/testkit/src/mock-agent.ts +++ b/packages/testkit/src/mock-agent.ts @@ -70,6 +70,11 @@ function parseArgs(): Args { return a; } +// PEP-171: Codex 0.169 removed --full-auto — the real CLI refuses it and exits with 2. +if (provider === "codex" && argv.includes("--full-auto")) { + process.stderr.write("error: unexpected argument '--full-auto' found\n\n tip: to pass '--full-auto' as a value, use '-- --full-auto'\n\nUsage: codex [OPTIONS] [PROMPT]\n"); + process.exit(2); +} const args = parseArgs(); // OpenCode: rules (instructions) and the peppa MCP server come from the generated config. if (provider === "opencode" && process.env.OPENCODE_CONFIG && existsSync(process.env.OPENCODE_CONFIG)) { diff --git a/packages/testkit/test/limits.test.ts b/packages/testkit/test/limits.test.ts index 4ecb58e5..6705073a 100644 --- a/packages/testkit/test/limits.test.ts +++ b/packages/testkit/test/limits.test.ts @@ -181,3 +181,10 @@ describe("Codex", () => { await runner.stopSession(db, sid); }); }); + +describe("PEP-171: запуск Codex без удалённого флага", () => { + test("по умолчанию — без подтверждений и песочницы, флага --full-auto нет", () => { + assert.equal(runner.CODEX_DEFAULT_MODE, "--sandbox danger-full-access --ask-for-approval never"); + assert.ok(!runner.CODEX_DEFAULT_MODE.includes("--full-auto")); + }); +});