Skip to content

Regression in 0.118.0: apply_patch enters patch-approval loop (command failed; retry without sandbox?) while 0.117.0 works #16407

@jasny

Description

@jasny

Summary

apply_patch appears to regress in codex-cli 0.118.0 on my machine: patch edits are previewed, then UI asks:

Reason: command failed; retry without sandbox?

If rejected, session records aborted by user after ....

The same workflow works on 0.117.0 (no escalation prompt, patch applies successfully).

Regression window

  • Last known good: codex-cli 0.117.0
  • First known bad: codex-cli 0.118.0

Environment

  • OS: Ubuntu 24.04.4 LTS (Noble)
  • Kernel: Linux carbon 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64
  • Shell: /bin/bash

Repro (interactive)

  1. Start codex in a writable repo (workspace-write sandbox).
  2. Ask Codex to apply a small apply_patch edit to an existing file.
  3. Observe that patch preview is shown, then prompt appears:
    • Reason: command failed; retry without sandbox?
  4. Reject escalation.
  5. Session records custom_tool_call_output: "aborted by user after ...".

Expected

apply_patch should apply the patch in sandbox (as it does in 0.117.0), or return a concrete underlying error (not just escalation fallback).

Actual

In 0.118.0, apply_patch repeatedly routes into patch approval/escalation flow.

Evidence from logs (0.118.0 run)

Session metadata shows 0.118.0:

  • ~/.codex/sessions/2026/04/01/rollout-2026-04-01T09-16-29-019d47e6-a041-7600-99af-0233fda42b43.jsonl line 1 ("cli_version":"0.118.0")

apply_patch call + output:

  • same file line 32: custom_tool_call (name":"apply_patch")
  • line 34: custom_tool_call_output => "aborted by user after 33.0s"
  • line 63 + 65: repeated same behavior
  • line 136 + 137: repeated same behavior on relative path patch

Runtime sequence around each attempt (codex-tui.log):

  • ToolCall: apply_patch then
  • op.dispatch.patch_approval then
  • interrupt received: abort current task

Example lines:

  • ~/.codex/log/codex-tui.log:291197
  • ~/.codex/log/codex-tui.log:291211
  • ~/.codex/log/codex-tui.log:291212
  • repeats at 291279/291280, 291439/291440

Additional note

I can confirm in my current environment that apply_patch succeeds under codex-cli 0.117.0 with the same style of patch edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxingtool-callsIssues related to tool calling

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions