Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(codex): full access no longer stops on dangerous command prompts (FBL-854) #39187

Closedleojkwan(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/39187/headopened View on GitHub

leojkwan(GitHub profile, opens in a new tab)commented

[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 approvalPolicy or sandboxPolicy override. An explicit policy stays authoritative, as it already is in ClaudeAdapterV2.
  • A command request has kind command (or no kind), no networkApprovalContext and no proposedNetworkPolicyAmendments.
  • 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.ts has 8 rows. Two default-policy rows (dangerous command, patch) expect accept on 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 run on CodexAdapterV2.test.ts and CodexReplayFixtures.integration.test.ts passed 238 of 238, including the four fixtures above.
  • vp run check:changed passed 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 accept in 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. Pushed55d29b3

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      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

      Layer / File(s)Summary
      Default-policy acceptance and replay coverage
      apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts, docs/user/permission-modes.md
      The adapter detects full-access turns with no explicit approval or sandbox policy. It auto-accepts command requests without network approval context or proposed network amendments, and file-change requests without a grant root. Replay tests cover policy overrides and requests that still require approval. The file-change approval test now uses auto-accept-edits with an on-request approval policy and workspaceWrite sandbox 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

      • pingdotgg/t3code#39181 — Reports that Full access Codex children stop for shell command approvals. This PR auto-accepts eligible command requests under default full-access policies.
      • pingdotgg/t3code#37298 — Reports command approval cards for cleanup commands under Full access. This PR covers the default-policy command approval path.

      Possibly related PRs

      • pingdotgg/t3code#37611 — Changes Codex Full access acceptance for command and file-change approvals, covering the same adapter behavior with different acceptance rules.
      • pingdotgg/t3code#37306 — Accepts Codex command approvals in Full access. This PR narrows acceptance to turns without explicit policy overrides.
      • pingdotgg/t3code#38783 — Covers the same default-policy acceptance behavior and updates file-change tests.

      Suggested reviewers: juliusmarminge, macroscopeapp

      Merge Risk: Minimal · up to 55d29

      Codex 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: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe 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 f…
      Description checkPassedThe 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 result…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      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)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between c16a79623d9ea6f6509367ccf3614adccd0b7d36 and 55d29b32baf16db0f197b32ff8763dd2fbb58f20.

      Files selected for processing: 2

      • apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
      • docs/user/permission-modes.md

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

    3. 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.

      BeforeAfter
      8d5e0b241d55d29b32ba
      Full access recording: stops at Waiting for approvalFull access recording: completes with exit code 0 without approval
      Approval required: approval appearsApproval required: approval still appears

      Seed script and browser steps

      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.
    4. juliusmarminge added labelstakeover:needs-julius

    5. juliusmarminge removed labelstakeover:in-progress

    6. 64andrewwalker(GitHub profile, opens in a new tab)commented

      I independently verified this on macOS arm64 with Codex CLI 0.171.0. In the original T3 delegated-child trace, thread/start reported approvalPolicy: "never" and dangerFullAccess. T3 then sent the MCP-only granular policy with approvalsReviewer: "user" on turn/start. The child received repeated item/commandExecution/requestApproval requests 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.txt and forced removal of a scratch directory in an EXIT trap prompted once and exited 0 after accept. Ordinary rm ran without prompting. Setting all five granular flags to false still prompted. With never, 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 policy

      I tested this PR's diff at 55d29b32ba on origin/main at 0dc32b5c8b. 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/main passed 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.

    7. 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 approvalPolicy or sandboxPolicy override), 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 under dangerFullAccess. writeStdin is accepted in Full access too.

      Closing in favour of #40773.

    8. juliusmarminge closed this

Sign in to join this conversation.