fix(codex): full access no longer stops on dangerous command prompts (FBL-854) #39187
main fromrefs/pull/39187/head·opened View on GitHub[Codex Studio, chat]
Problem#
Full access in T3 Code still stops Codex turns on approval cards. Since #37104, Full access starts Codex with a granular approval policy (only mcp_elicitations on) so browser and app prompts still reach T3. Under that policy Codex still sends item/commandExecution/requestApproval for commands it judges dangerous, such as rm -rf of a temporary directory. T3 turns each one into a card, so unattended Full access threads and delegated children wait for someone to click Approve.
The stock signed v0.1.10 app reproduces this in a separate T3 home. The Codex thread shows one pending runtime request of kind command, networkApprovalContext null, offering accept or cancel.
Fix#
The command and file-change approval handlers in CodexAdapterV2 answer accept themselves only when every one of these holds:
- The turn is Full access with T3's own defaults, meaning no explicit
approvalPolicyorsandboxPolicyoverride. An explicit policy stays authoritative, as it already is inClaudeAdapterV2. - A command request has kind
command(or no kind), nonetworkApprovalContextand noproposedNetworkPolicyAmendments. - A file-change request has no
grantRoot, which asks for session-wide writes.
Everything else still reaches the user, including terminal input (writeStdin), managed-network prompts and grant-root writes. The turn policy sent to Codex does not change, so the browser and app access fix from #37104 is unaffected, and the MCP elicitation and permissions handlers are unchanged. availableDecisions is not in the generated Codex 0.170 schema, so the adapter cannot read it.
The earlier commit on this branch accepted every command and patch approval in Full access, which overrode explicit policies. That broke the subagent_v2_approval, subagent_v2_nested_approval, tool_call_read_only_on_request and tool_call_restricted_granular replay fixtures. The fix gates on the default policy, which restores them.
Verification#
- One table test in
CodexAdapterV2.test.tshas 8 rows. Two default-policy rows (dangerous command, patch) expectaccepton the wire and no pending runtime request. Six rows expect the request to reach the user: approval policy override, sandbox policy override, managed-network context, network policy amendment,writeStdin, and a patch with a grant root. Against the previous commit 2b0dc50e75, the six protection rows fail and the two default rows pass. - The two existing file-change card tests now start in
auto-accept-edits, the supervised path they exercise. vp test runonCodexAdapterV2.test.tsandCodexReplayFixtures.integration.test.tspassed 238 of 238, including the four fixtures above.vp run check:changedpassed format, lint, knip, graphql, typecheck and tests.- A release-matched backport of the adapter and test changes to v0.1.10 passed 207 adapter tests. In isolated T3 homes, the signed release left a real Codex command approval pending. With the identical patch applied to the release, the same request received
acceptin 1 ms, the command exited 0 and the turn completed with zero pending requests. Repeating it with Approval required on the patched build left one pending request. File-change coverage comes from replay. - All 19 executed GitHub checks on this PR passed, including the aggregate Check gate.
Related work in #39044 and #38783 addresses the same regression. This change also distinguishes ordinary command and file approvals from managed-network requests, terminal-input requests and grants for a wider write root.
Fixes FBL-854.
Code written by Claude Opus in the Codex desktop app.
- 1
- 2
- 3
Pushed55d29b3
Evidence#
Real web app, Chromium, dark theme, 1440×900 CSS pixels; fresh isolated databases; Codex 0.170.0, GPT-6.1-Sol Low; no matching command-allow rules or explicit policy overrides.
In default Full access, submit:
Execute the shell command rm -rf ./absent-repro-target exactly, then report its exit code.Do not answer an approval card. Repeat in Approval required mode, labelled Supervised in the UI.Not shown:
- Patch approvals and delegated children were not exercised; the captured reproduction covers top-level dangerous-command approvals.
- Explicit approval/sandbox overrides, managed-network requests, terminal input, and folder-wide write grants were not exercised.
juliusmarminge added labelstakeover:needs-julius
juliusmarminge removed labelstakeover:in-progress
I independently verified this on macOS arm64 with Codex CLI 0.171.0. In the original T3 delegated-child trace,
thread/startreportedapprovalPolicy: "never"anddangerFullAccess. T3 then sent the MCP-only granular policy withapprovalsReviewer: "user"onturn/start. The child received repeateditem/commandExecution/requestApprovalrequests offering only["accept", "cancel"].A scratch app-server probe used an isolated Codex home and a deterministic loopback model response. With T3's granular policy, both
touch ./scratch-probe.txt && rm -f ./scratch-probe.txtand forced removal of a scratch directory in anEXITtrap prompted once and exited 0 afteraccept. Ordinaryrmran without prompting. Setting all five granular flags to false still prompted. Withnever, Codex refused the forced removal before starting the command and declined a local MCP form elicitation before the client saw it. The granular policy forwarded the same elicitation. The 0.171.0 turn schema exposes no separate setting for the command heuristic. Codex 0.171.0 exec policyI tested this PR's diff at
55d29b32baonorigin/mainat0dc32b5c8b. With the PR's tests and the base adapter, the two default Full access rows failed because the command and patch each surfaced a pending request. With the patch, all 253 adapter, Codex replay, and MCP elicitation tests passed. This includes explicit approval policies and the protected network, terminal input, and write-grant cases.vp run check:changed origin/mainpassed format, lint, knip, GraphQL, typecheck, and tests.The wider macOS server run had 9,364 passes and 13 failures. Eight failed the same way on the base checkout. The remaining five cleared on focused reruns with the pinned Chromium installed or on rerunning the theme suite.
Thanks for this one. It spotted that managed-network asks (
networkApprovalContext,proposedNetworkPolicyAmendments) enforce the user's allowlist and must keep asking. #40773 keeps that exception.It's taken over in #40773, which covers the same regression in one place: when a Full access turn runs T3's own defaults (no
approvalPolicyorsandboxPolicyoverride), the Codex command-approval handler accepts Codex's dangerous-command prompts itself. Managed-network asks still reach the user. I compared this diff against #40773; the file-change and grant-root handling were left out, because Codex doesn't send those underdangerFullAccess.writeStdinis accepted in Full access too.Closing in favour of #40773.
juliusmarminge closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review.
Walkthrough
CodexAdapterV2 now auto-accepts eligible command and file-change approval requests under default full-access policies. Requests with policy overrides or specified exceptions continue through the existing approval flow. Replay tests cover these cases.
Changes: Codex approval handling
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts,apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts,docs/user/permission-modes.mdauto-accept-editswith anon-requestapproval policy andworkspaceWritesandbox policy. The permission-mode documentation lists network access, terminal input, and whole-folder write access as approval cases in Full access.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
Possibly related PRs
Suggested reviewers:
juliusmarminge,macroscopeappMerge Risk:
Minimal · up to
55d29Codex Full access turns no longer wait on ordinary command and file-change approval cards, while explicit policy overrides, network prompts, terminal input and wider-root writes still go to the user. No concrete merge-blocking defect was established. One edge case, a resumed subagent keeping an older restricted policy, depends on Codex behavior outside this repository.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the fix (Codex full access no longer stops on dangerous command prompts) and the scope (codex), which matches the main change in CodexAdapterV2 that auto-accepts ordinary command and file-change approvals under default full-access policies. It uses the conventional commit format from the template. The ticket reference is extra detail and does not reduce clarity.
Full details: Description check
Explanation
The description follows the template closely. It has Problem, Fix (Change), Scope (linked ticket FBL-854 and a bug-fix framing), and a detailed Verification section with focused tests, observed results, and a model attribution line. It explains the reasoning, the gating conditions, and what is excluded. The Scope section does not explicitly say why no issue link is needed beyond the ticket reference, and the Problem section gives reproduction steps. Overall it is mostly complete.
Finishing Touches
Generate unit tests (beta)
ced72542-ff11-4f82-8f5e-43642ca4385bReviewing files that changed from the base of the PR and between c16a79623d9ea6f6509367ccf3614adccd0b7d36 and 55d29b32baf16db0f197b32ff8763dd2fbb58f20.
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.tsdocs/user/permission-modes.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.