Skip to content

Codex sandbox_permissions approval doesn't get surfaced through app-server #21982

Open

Description

@amirbarak

What issue are you seeing?

While integrating Codex through codex app-server, I saw a codex turn stall on a permission/escalation prompt that appeared in the codex session transcript, but no matching app-server item/*/requestApproval server request over JSON-RPC.

This leaves app-server clients unable to display or resolve the approval. The turn appears active but cannot progress until the hidden approval times out.

  • Codex CLI: 0.130.0
  • Mode: codex app-server --listen stdio://
  • Approval policy: on-request
  • Sandbox: workspace-write
  • Platform: Linux

What steps can reproduce the bug?

  1. Start app-server:

codex app-server --listen stdio://
-c 'model="gpt-5.5"'
-c 'approval_policy="on-request"'
-c 'thread_sandbox="workspace-write"'
-c 'turn_sandbox_policy="workspace-write"'

  1. Initialize app-server over stdio.
  2. Start a thread in a git worktree whose .git metadata lives outside the sandbox writable roots.
  3. Start a turn asking Codex to stage/commit changes, or otherwise run a command that requires sandbox escalation, for example git add .... This should trigger codex for sandbox_permissions approval.
  4. Observe the app-server JSON-RPC stream.
  5. Compare it with the saved Codex session transcript under ~/.codex/sessions/....

What is the expected behavior?

I expect app-server to surface a item/*/requestApproval as with other approval requests.

Additional information

Here's what it looked like for me:

session transcript:

{
"type": "function_call",
"name": "exec_command",
"arguments": {
"cmd": "git add foobar",
"workdir": "/tmp/testbranch1",
"yield_time_ms": 1000,
"max_output_tokens": 12000,
"sandbox_permissions": "require_escalated",
"justification": "Allow staging the test file in this git worktree; the git metadata lives under /home/... outside the writable sandbox.",
"prefix_rule": ["git", "add"]
}
}

After 300 seconds, the session transcript recorded:

{
"type": "function_call_output",
"output": "aborted by user after 300.0s"
}

But the app-server client never received an approval request it could answer.

Activity

  1. added
    bug
    on May 9, 2026
  2. added
    app-server
    sandbox
    on May 9, 2026
  3. clucluclu commented on May 10, 2026

    @clucluclu

    Just leaving a note here as I am absolutely invested in the outcome for this - without it only options within paseo are full access permissions, which is too unsafe to be able to use in my case..really keen to see this one resolved. Linux daemon and codex server runtime .130 - win 11 and ios paseo clients latest as of today).

  4. etraut-openai commented on May 18, 2026

    @etraut-openai
    Contributor

    Thanks for the detailed report. I investigated this path and I don’t think this is an app-server bug.

    The important detail is that approval_policy = "on-request" is not, by itself, enough to guarantee that escalation requests are surfaced to the app-server client as item/commandExecution/requestApproval. If the session is configured with an automatic approvals reviewer, such as guardian_subagent / auto-review, the escalation is handled by that reviewer instead of being routed to the client for manual approval.

    I was able to exercise the repro shape directly: app-server over stdio, workspace-write, on-request, a git worktree whose .git metadata points outside the writable root, and an exec_command call with sandbox_permissions = "require_escalated". When approvals_reviewer = "user" was set, app-server correctly emitted item/commandExecution/requestApproval.

    So the behavior described here is most likely explained by the session using an automatic approvals reviewer, not by app-server dropping the approval request.

    If you still believe this is a bug, please provide a raw JSON-RPC trace that includes the thread/start response, especially the approvalsReviewer value, plus the subsequent turn events. Without that, this looks like a configuration/client expectation issue rather than a Codex defect.

  5. amirbarak commented on May 18, 2026

    @amirbarak
    Author

    Hi @etraut-openai, thanks for looking into this!

    Edit: just noticed you asked for the subsequent turn event logs as well, my bad. I'm attaching PII-redacted logs here:

    Codex:
    codex-session-transcript-excerpt-public-redacted.json

    App-server:

    app-server-full-stream-public-redacted.json

    Main things I'm seeing from these two logs:

    1. The Codex transcript has a normal git add <changed-files> call that fails with:
      fatal: Unable to create '/repo/.git/worktrees/<worktree>/index.lock': Read-only file system
    2. The same transcript then records an escalated exec_command call with:
      • sandbox_permissions: "require_escalated"
      • prefix_rule: ["git", "add"]
      • a user-facing approval justification
    3. The app-server stdout JSON-RPC stream has no requestApproval entry and no waitingOnApproval status transition.
    4. The full app-server stream includes stderr:
      failed to record rollout items: thread <opaque-id> not found
    5. The full app-server stream then terminates after the external 300s no-activity timeout.
    6. approvalsReviewer is set to "user".

    Thanks again!

  6. Necmttn commented on Jun 21, 2026

    @Necmttn

    Even if an automatic reviewer handles an escalation, app-server clients still need an event for the pending state.

    I would stream an approval lifecycle item with correlation id, command/tool call id, sandbox policy, requested permission, reviewer route (client vs auto), final decision, and timeout/error state. Then clients can render handled by auto reviewer instead of looking stalled with no resolvable approval.


    Generated with ax.

  7. frankigalee-hash commented on Sep 9, 2026

    @frankigalee-hash

    I'm hitting a very similar symptom on a newer CLI version, but I want to flag upfront that my approvals_reviewer was already user (not auto_review), so this isn't the explanation already ruled out earlier in this thread. Posting in case it's the same underlying bug on a different code path, or a separate-but-related issue.

    Environment

    • Codex CLI: 0.153.4 (originator: codex-tui)
    • approval_policy=on-request
    • approvals_reviewer=user
    • Network: restricted
    • Platform: Linux

    Symptom
    A turn requesting sandbox_permissions: require_escalated execution stalls and eventually ends with aborted by user after 257.6s, with no error surfaced to the client beforehand and no confirmation that the underlying process ever started.

    What the session-side logs show
    Across 5 separate escalation requests in this session, all end in the same ExecApproval { decision: Abort } outcome, recorded in codex_core::session::handlers (handlers.rs:537). In none of the 5 cases is there a preceding client-side event (click, keypress, disconnect, channel close) in the logs that would explain the decision — the log simply shows the approval request, then the Abort decision, then turn interruption.

    The time-to-abort across the 5 requests is not consistent, which argues against a fixed timeout:

    • 11,333.7s
    • 271.5s
    • 523.7s
    • 21.8s
    • 257.6s

    What I could not confirm
    I don't have client-side (app-server) instrumentation for this session, so I can't confirm whether the serverRequest/approval request ever reached the client, the way #21982's original report shows for the auto_review-adjacent case. I'm not claiming this is the same root cause — just that the surface symptom (escalation request stalls, resolves to an unexplained Abort/timeout with no user-visible prompt, aborted by user after N.Ns in the transcript) matches closely enough that it seemed worth reporting here rather than opening a fresh issue blind.

    Happy to pull additional fragments from logs_2.sqlite or the session rollout JSONL if that's useful for triage — let me know what would help narrow it down (e.g. whether the app-server ever emitted item/*/requestApproval for these specific requests on my end).

  8. madawei2699 commented on Sep 20, 2026

    @madawei2699

    Sanitized current-version evidence: codex-acp 1.12.0 with its resolved Codex app-server 0.154.0, INITIAL_AGENT_MODE=read-only, approval_policy=on-request, approvals_reviewer=user, and workspace-write sandbox (no additional writable roots). A harmless touch targeting a path outside the session workspace caused app-server to emit item/commandExecution/requestApproval; codex-acp forwarded it as ACP session/request_permission.

    This bounded case does not reproduce a missing app-server request and confirms that the explicit user reviewer surfaced it. Free4Chat then rejected one 175-character native option label before creating a Room request; the command did not execute. This does not resolve the separate 0.153.4 report or establish behavior for every escalation path.

  9. frankigalee-hash commented on Sep 20, 2026

    @frankigalee-hash

    Thanks for the additional investigation and for explicitly documenting its limits. I’ve read Free4Chat #426, merged PR #432, and the updated compatibility notes in #297.

    The successful approval round trips are useful evidence. My earlier report, however, came from Codex CLI 0.153.4 with originator: codex-tui, approval_policy=on-request, and approvals_reviewer=user. It was not a Free4Chat/codex-acp reproduction, so the Free4Chat fixes do not establish whether my reported failure is resolved.

    The remaining question in my case is what produced the ExecApproval { decision: Abort } outcomes and whether the approval prompt reached the TUI. The logs I examined did not identify a corresponding user action; that is not proof that no such event occurred.

    For the Codex maintainers: which specific log events or narrowly scoped, sanitized excerpts would help distinguish approval delivery/rendering failure from cancellation or another interruption in the TUI path? I previously offered fragments from logs_2.sqlite and the session rollout JSONL, but would appreciate guidance on the relevant fields and correlation identifiers.

    I have not yet verified whether this symptom reproduces on a newer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-serverbugsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions