Skip to content

Codex Desktop Ask for approval silently disables shell escalation in projectless tasks #32563

Open

Description

@0xdevalias

What version of the Codex App are you using (From “About Codex” dialog)?

Codex Desktop 26.707.51957 (bundle 5175), bundled codex-cli 0.144.0-alpha.4.

What subscription do you have?

Pro

What platform is your computer?

macOS / Darwin arm64

What issue are you seeing?

In a newly created projectless Codex Desktop task, selecting Ask for approval silently replaces the configured approval_policy = "on-request" with a granular policy that has sandbox_approval = false:

GranularApprovalConfig {
    sandbox_approval: false,
    rules: false,
    skill_approval: false,
    request_permissions: true,
    mcp_elicitations: true
}

This is a regression from the previous interactive approval behavior: the agent can still see and attempt the normal exec_command escalation interface, but sandbox_permissions = "require_escalated" is rejected before an approval prompt can be created. This has effectively broken existing chats/workflows that previously let Codex ask for approval and retry a blocked tool call.

The alternative request_permissions mechanism is not an adequate transparent replacement in the current product contract:

  • the UI still calls the mode Ask for approval and says it will “Always ask to edit external files and use the internet”;
  • the effective policy and the reason ordinary shell escalation is disabled are not shown;
  • the agent still has an exec_command schema containing sandbox_permissions = "require_escalated";
  • existing prompts, workflows, and user requests naturally direct the agent to use that interface;
  • the user's explicit approval_policy = "on-request" is overridden;
  • neither the user nor apparently the agent is told how all previously approval-gated command cases should be translated into a separate pre-grant request.

This creates a user-visible contradiction: Approve for me supports the ordinary escalation path, while Ask for approval rejects it before the user can be asked.

Deterministic A/B reproduction

The same task and same harmless command were used for both modes:

curl --max-time 2 --silent --show-error http://127.0.0.1:9229/json/list

The tool call included:

{
  "sandbox_permissions": "require_escalated",
  "justification": "May I run the same read-only localhost probe to verify the effective approval behavior?"
}

With Ask for approval, Desktop injected the granular policy above and rejected the call before prompting:

approval policy is Granular(GranularApprovalConfig { sandbox_approval: false, rules: false, skill_approval: false, request_permissions: true, mcp_elicitations: true }); reject command — you cannot ask for escalated permissions if the approval policy is Granular(GranularApprovalConfig { sandbox_approval: false, rules: false, skill_approval: false, request_permissions: true, mcp_elicitations: true })

With Approve for me, the effective state changed to approval_policy = "on-request" with an automatic reviewer. The identical escalated command executed successfully and returned the local Electron Node inspector entry.

Switching back to Ask for approval restored the granular policy and reproduced the exact pre-prompt rejection.

Local configuration

Relevant ~/.codex/config.toml:

approval_policy = "on-request"
approvals_reviewer = "user"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
writable_roots = [
  "~/.npm",
  "~/.cache/clang/ModuleCache",
]

The Desktop task host overrides this approval policy when Ask for approval is selected.

Desktop bundle source trace

The installed archive was extracted read-only for inspection:

/Applications/Codex.app/Contents/Resources/app.asar
SHA-256: 26708d5be316b43786ba00ea8581317426e44ff508e0d5cce40f53181582e027
Size: 195,064,103 bytes

Because the production renderer chunks are minified to one physical line, line numbers are not useful. The table below gives the exact archive member, complete SHA-256, file size, and zero-based byte offset for every cited symbol/string.

Evidence Exact archive member under app.asar SHA-256 Size Byte offset
Projectless tasks select granular: function Z1t(...) webview/assets/app-initial~app-main~new-thread-panel-page~appgen-library-page~hotkey-window-thread-page~ho~iufn7mg3-k1satKyX.js 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 2,685,902
Permission override construction: function a1t(...) same ...k1satKyX.js member 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 2,676,285
Turn-start permission resolution: function svt(...) same ...k1satKyX.js member 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 2,204,506
“Ask for approval” click handler: let Ge=()=>{...} same ...k1satKyX.js member 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 8,287,625
“Ask for approval” displayed label same ...k1satKyX.js member 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 8,285,540 and 8,291,885
“Always ask to edit external files and use the internet” description same ...k1satKyX.js member 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac 8,856,468 8,291,630
Agent-mode-to-policy mapping: function nS(...) webview/assets/app-initial~app-main~projects-index-page~hotkey-window-thread-page~local-environments-setti~jjjs6eag-De99_ILj.js b557f54f16bbb4d4e2176d63ded3fd310ca38d91f9d32124a55d96a5e477e6c1 443,446 347,743
Hard-coded granular policy: hS={granular:...} same ...De99_ILj.js member b557f54f16bbb4d4e2176d63ded3fd310ca38d91f9d32124a55d96a5e477e6c1 443,446 349,527

The offsets can be reproduced after extracting the archive with commands such as:

rg --byte-offset -o 'function Z1t\(' '<extracted-asar>/webview/assets/app-initial~app-main~new-thread-panel-page~appgen-library-page~hotkey-window-thread-page~ho~iufn7mg3-k1satKyX.js'
rg --byte-offset -o 'hS=\{granular:' '<extracted-asar>/webview/assets/app-initial~app-main~projects-index-page~hotkey-window-thread-page~local-environments-setti~jjjs6eag-De99_ILj.js'

The renderer source shows that projectless tasks deliberately default to granular rather than auto:

function Z1t({isProjectless:e,requirements:t}) {
  return e && sr(`granular`,t) ? `granular` : `auto`
}

The Ask for approval click handler selects that computed default (se):

let Ge = () => {
  Ve(se)
  Se(null)
  W(se)
  L(!1)
}

The renderer hard-codes the granular policy:

hS = {
  granular: {
    sandbox_approval: false,
    rules: false,
    skill_approval: false,
    request_permissions: true,
    mcp_elicitations: true
  }
}

and maps that mode to a workspace sandbox with the explicit granular override:

case `granular`:
  return Qx(workspaceRoots, void 0, hS)

Relevant extracted chunks:

webview/assets/app-initial~app-main~projects-index-page~hotkey-window-thread-page~local-environments-setti~jjjs6eag-De99_ILj.js
SHA-256: b557f54f16bbb4d4e2176d63ded3fd310ca38d91f9d32124a55d96a5e477e6c1

webview/assets/app-initial~app-main~new-thread-panel-page~appgen-library-page~hotkey-window-thread-page~ho~iufn7mg3-k1satKyX.js
SHA-256: 4bd5e9614579174f1d612786cc693a3f1babd3dd1884d8949c6fea59091e19ac

Runtime source trace

The upstream references below are pinned to repository commit 9e552e9d15ba52bed7077d5357f3e18e330f8f38, rather than floating main links:

Evidence Repository file Git blob SHA-1 Size Lines
Explicit shell escalation rejection outside OnRequest codex-rs/core/src/tools/handlers/shell.rs 87a9301093453a5c3ab4545cc3f62e0a861e7c98 8,738 122–138
Granular prompt/category and request_permissions routing codex-rs/prompts/src/permissions_instructions.rs 1c19d008cf33833e1c7d509e6f32e61ddb8a6499 15,555 332–400

Current Codex runtime source explicitly rejects a fresh shell sandbox override under every policy other than OnRequest:

// Approval policy guard for explicit escalation in non-OnRequest modes.
// Sticky turn permissions have already been approved, so they should
// continue through the normal exec approval flow for the command.
if effective_additional_permissions
.sandbox_permissions
.requests_sandbox_override()
&& !effective_additional_permissions.permissions_preapproved
&& !matches!(
turn.approval_policy.value(),
codex_protocol::protocol::AskForApproval::OnRequest
)
{
let approval_policy = turn.approval_policy.value();
return Err(FunctionCallError::RespondToModel(format!(
"approval policy is {approval_policy:?}; reject command — you should not ask for escalated permissions if the approval policy is {approval_policy:?}"
)));
}

if effective_additional_permissions
    .sandbox_permissions
    .requests_sandbox_override()
    && !effective_additional_permissions.permissions_preapproved
    && !matches!(
        turn.approval_policy.value(),
        codex_protocol::protocol::AskForApproval::OnRequest
    )
{
    // reject before creating an approval
}

The permission-instruction generator confirms that granular mode exposes direct shell permission requests only when sandbox_approval is enabled, while this Desktop policy instead enables request_permissions:

fn granular_prompt_intro_text() -> &'static str {
"# Approval Requests\n\nApproval policy is `granular`. Categories set to `false` are automatically rejected instead of prompting the user."
}
fn request_permissions_tool_prompt_section() -> &'static str {
"# request_permissions Tool\n\nThe built-in `request_permissions` tool is available in this session. Invoke it when you need to request additional `network` or `file_system` permissions before later shell-like commands need them. Request only the specific permissions required for the task."
}
fn granular_instructions(
granular_config: GranularApprovalConfig,
exec_policy: &Policy,
exec_permission_approvals_enabled: bool,
request_permissions_tool_enabled: bool,
) -> String {
let sandbox_approval_prompts_allowed = granular_config.allows_sandbox_approval();
let shell_permission_requests_available =
exec_permission_approvals_enabled && sandbox_approval_prompts_allowed;
let request_permissions_tool_prompts_allowed =
request_permissions_tool_enabled && granular_config.allows_request_permissions();
let categories = [
Some((
granular_config.allows_sandbox_approval(),
"`sandbox_approval`",
)),
Some((granular_config.allows_rules_approval(), "`rules`")),
Some((granular_config.allows_skill_approval(), "`skill_approval`")),
request_permissions_tool_enabled.then_some((
granular_config.allows_request_permissions(),
"`request_permissions`",
)),
Some((
granular_config.allows_mcp_elicitations(),
"`mcp_elicitations`",
)),
];
let prompted_categories = categories
.iter()
.flatten()
.filter(|&&(is_allowed, _)| is_allowed)
.map(|&(_, category)| format!("- {category}"))
.collect::<Vec<_>>();
let rejected_categories = categories
.iter()
.flatten()
.filter(|&&(is_allowed, _)| !is_allowed)
.map(|&(_, category)| format!("- {category}"))
.collect::<Vec<_>>();
let mut sections = vec![granular_prompt_intro_text().to_string()];
if !prompted_categories.is_empty() {
sections.push(format!(
"These approval categories may still prompt the user when needed:\n{}",
prompted_categories.join("\n")
));
}
if !rejected_categories.is_empty() {
sections.push(format!(
"These approval categories are automatically rejected instead of prompting the user:\n{}",
rejected_categories.join("\n")
));
}
if shell_permission_requests_available {
sections.push(APPROVAL_POLICY_ON_REQUEST_RULE_REQUEST_PERMISSION.to_string());
}
if request_permissions_tool_prompts_allowed {
sections.push(request_permissions_tool_prompt_section().to_string());

let shell_permission_requests_available =
    exec_permission_approvals_enabled && sandbox_approval_prompts_allowed;
let request_permissions_tool_prompts_allowed =
    request_permissions_tool_enabled && granular_config.allows_request_permissions();

So the runtime rejection is internally consistent with the policy Desktop selected. The regression/product bug is the Desktop mapping and resulting contract: a UI mode named Ask for approval silently stops supporting the established shell approval flow, overrides explicit on-request configuration, and leaves both users and agents facing an exposed escalation interface that cannot work.

What steps can reproduce the bug?

  1. Set the relevant config values:

    approval_policy = "on-request"
    approvals_reviewer = "user"
    sandbox_mode = "workspace-write"
  2. Create a fresh projectless task in Codex Desktop.

  3. Select Ask for approval in the composer permission menu.

  4. Inspect the effective developer permission instructions or rollout context. Observe GranularApprovalConfig with sandbox_approval: false.

  5. Ask Codex to perform a harmless command using sandbox_permissions = "require_escalated".

  6. Observe that the runtime rejects it before displaying an approval prompt.

  7. Switch the same task to Approve for me.

  8. Retry the identical call. Observe that the effective policy becomes on-request with automatic review and the escalation path works.

  9. Switch back to Ask for approval and observe the granular pre-prompt rejection again.

What is the expected behavior?

Ask for approval should preserve the established interactive approval behavior and the user's configured approval_policy = "on-request", including allowing Codex to request approval for a blocked command and retry it.

If projectless tasks must use granular permissions instead, the product needs a complete and unambiguous contract:

  1. clearly distinguish granular permission grants from ordinary command approval in the UI;
  2. do not expose or recommend sandbox_permissions = "require_escalated" when it is guaranteed to fail;
  3. ensure the agent reliably translates every relevant blocked filesystem/network operation into request_permissions before retrying;
  4. explain why explicit approval_policy = "on-request" configuration is being overridden;
  5. provide a migration path for existing chats and workflows that relied on interactive shell escalation.

Regression impact

  • Existing chats that previously escalated blocked commands now fail before prompting.
  • The agent may repeatedly choose an escalation interface that the host has made unusable.
  • Users cannot tell from the Ask for approval label that the underlying approval model has changed.
  • Per-command approval is important because it lets the user inspect the exact requested action; silently replacing it with a different capability-grant workflow changes the security and UX contract.
  • The behavior makes projectless Desktop chats feel broken even though the UI still advertises approval-based operation.

Related issues

Activity

  1. added
    bug
    app
    sandbox
    config
    tool-calls
    on Jul 12, 2026
  2. claell commented on Jul 19, 2026

    @claell

    I filed #34182 for a distinct existing-task lifecycle variant of this policy failure.

    On Windows Desktop 26.715.4045.0, the same general-chat/projectless task first started a turn with requestApprovalPolicy=null, resolved to on-request, and successfully produced ordinary approval prompts. A later turn, without a permission-mode change, was started by the renderer with an explicit granular policy containing sandbox_approval:false and useAppServerPermissionDefault=false. The runtime then rejected every shell escalation before prompting.

    Restarting Desktop restored on-request temporarily, but the same existing task later regressed to the granular profile again. #34182 contains the renderer and rollout timestamps. This appears to share the lower-level mapping problem reported here while adding a persistence/resume transition that is not covered by the fresh-task reproduction.

  3. SeanEricKnight commented on Oct 9, 2026

    @SeanEricKnight

    Adding a macOS reproduction from October 9, 2026.

    Environment

    • Codex Desktop 26.1007.21159 (confirmed installed; updating did not resolve the issue)
    • macOS 27.0.1 (26A434), Apple Silicon (M5 MacBook Pro)
    • Execution sandbox: workspace-write
    • Effective policy: approval_policy.granular.sandbox_approval = false
    • No corresponding explicit restriction found in the user's local Codex configuration

    Reproduction / impact

    In an existing local Codex task, I asked the agent to migrate GitHub CLI to Homebrew and perform validation. Homebrew bottle extraction failed inside the sandbox with:

    sandbox_apply: Operation not permitted
    

    Codex then tried the supported unsandboxed/escalated execution request. It was rejected before the command ran or an approval prompt appeared:

    sandbox_approval: false
    reject command — you cannot ask for escalated permissions
    

    The agent identified the active granular policy as the blocker. The user tried the app's permission-mode settings and updated Codex to 26.1007.21159, but the effective sandbox_approval=false behavior persisted. Filesystem/network grants did not permit escalated execution. We did not disable SIP or macOS sandbox controls or enable Full access.

    Result

    The Homebrew gh migration remains incomplete: /opt/homebrew/bin/gh was not created and brew list still showed only uv. The existing GitHub CLI at /usr/local/bin/gh remains functional and authenticated. The agent verified that the preexisting Python installation, shell profile, GitHub executable and credential/configuration files had not changed.

    Expected: With Ask for approval, Codex should be able to present a user approval request for the specific command requiring execution outside the sandbox, rather than rejecting the request before prompting.

    This appears consistent with the issue's reported mismatch between the visible approval mode and the effective granular policy. I have not isolated whether the projectless-task condition described in the original report is necessary for this reproduction.

  4. sayam commented on Oct 13, 2026

    @sayam

    Additional Linux impact report from 2026-10-13: local Incus access is blocked, and this session has no exposed permission-request path.

    Follow-up (same date): The user resumed the same conversation from a host terminal with codex -C /home/adminu/Documents/projects/codex/review-asked-twice --sandbox danger-full-access --ask-for-approval never resume 01a133e1-3faf-74a3-86f6-97120efae40a. The new command executor successfully connected: incus version returned client and server version 6.0.3 (exit 0), and incus query /1.0 returned auth: trusted, auth_user_method: unix, server_version: 6.0.3 (exit 0). This confirms that the same host and Incus daemon are reachable from Codex with the unrestricted execution setting; the permission-request gap described below remains specific to the prior restricted session. No instances were changed.

    Environment and scope

    • Gentoo Linux, kernel 6.12.25-gentoo-dist, x86_64.
    • Installed CLI reports codex-cli 0.162.1; the frontend/app-server build and UI permission mode were not independently captured.
    • Local command execution uses a restricted workspace-write sandbox and a managed permissions profile.
    • The current session instructions specify granular approval with sandbox_approval: false, rules: false, and skill_approval: false. A direct require_escalated request made after this report was first posted returned the complete effective policy: sandbox_approval: false, rules: false, skill_approval: false, request_permissions: true, mcp_elicitations: true.
    • The exposed exec_command schema still accepts sandbox_permissions: "use_default" | "require_escalated". There is no exposed request_permissions tool. A separate codex features list invocation reports request_permissions_tool and exec_permission_approvals as under development and false; these are CLI defaults, not proof of live app-server feature overrides.

    Read-only reproduction

    All probes below ran through the current session's ordinary command executor, with default sandbox permissions:

    $ incus version
    Client version: 6.0.3
    Server version: unreachable
    exit=0
    
    $ incus query /1.0
    Error: Get "http://unix.socket/1.0": dial unix /var/lib/incus/unix.socket: connect: operation not permitted
    exit=1
    
    $ incus --force-local query /1.0
    Error: Get "http://unix.socket/1.0": dial unix /var/lib/incus/unix.socket: connect: operation not permitted
    exit=1
    

    A Python socket probe creates socket(AF_UNIX, SOCK_STREAM) successfully, but connect("/var/lib/incus/unix.socket") fails with errno 1 (EPERM). An independent curl Unix-socket probe also fails, exit 7, reporting getsockname() failed with errno 1: Operation not permitted. Curl's message is included literally; it is not being described as the same syscall as the Python failure.

    The command process has NoNewPrivs: 1, Seccomp: 2, and Seccomp_filters: 1. The socket exists with mode 0660. Supplementary groups and socket owners appear as nobody inside the user namespace; that display alone does not establish dropped host groups or a DAC failure.

    Impact and limits

    The user supplied same-host guides recording Incus server 6.0.3 access from other agent applications. Those are comparison reports, not an independently repeated host-terminal control in this session.

    The user explicitly authorized trying Incus and reporting the failure upstream. The current session cannot perform even a minimal daemon API read, cannot request ordinary shell escalation under its supplied policy, and has no exposed alternative permission-request tool.

    I then submitted exactly one read-only incus version call with sandbox_permissions: "require_escalated", after the user explicitly reconfirmed authorization. Codex rejected it before the command ran or any user approval prompt appeared:

    approval policy is Granular(GranularApprovalConfig { sandbox_approval: false, rules: false, skill_approval: false, request_permissions: true, mcp_elicitations: true }); reject command — you cannot ask for escalated permissions if the approval policy is Granular(...)
    

    A separate fresh Codex task using the same available permissions also returned Server version: unreachable and the same EPERM on incus query /1.0. There was no UI A/B test, so this does not establish the original report's projectless-task trigger or Desktop mapping on this host.

    Current documentation also describes permissions.<name>.network.unix_sockets. I have not activated or verified that alternative on this Linux runtime, and it should not be presented as an already tested fix.

    Requested clarification/fix

    Please ensure that a session disabling shell escalation either exposes a usable, policy-compliant permission-request mechanism or clearly identifies that access cannot be requested. Please also clarify the supported Linux path for an explicitly approved local daemon socket such as Incus while retaining workspace filesystem restrictions.

    No instances were enumerated, created, or modified; no daemon, group, socket, or host configuration was changed.

  5. rine1898 commented on Oct 25, 2026

    @rine1898

    Additional Windows report, observed 2026-10-25. The user explicitly asked the assistant to report this problem.

    Environment:

    • Windows build 26200, x64.
    • Installed Windows package: OpenAI.Codex 26.1021.3705.0 (ChatGPT.exe).
    • Local projectless chat, Windows-native PowerShell execution.

    Observed behavior:

    1. The user requested deletion of a specific obsolete application directory on a secondary drive, explicitly preserving the new installation.
    2. The active permission context was workspace-write with granular approvals: sandbox_approval=false, rules=false, skill_approval=false, request_permissions=true, mcp_elicitations=true.
    3. The assistant called the built-in request_permissions tool for write access to only that obsolete directory. The user approved it. The tool returned the exact requested write path with scope=session.
    4. A subsequent exec_command using native PowerShell Remove-Item -LiteralPath against that directory was rejected before execution, despite the grant. The command did NOT specify sandbox_permissions=require_escalated. It also included read-only safety checks of the resolved directory, reparse points, installed application registration, processes, and possible user data.
    5. Exact error: Rejected("approval required by policy, but AskForApproval::Granular.sandbox_approval is false").

    Configuration/UI observations:

    • The user added approval_policy = "on-request" and approvals_reviewer = "user" at the root of the local config.toml; the resulting file was validated with Python tomllib.
    • After restarting the desktop app, the user reported that no Custom/config.toml option was available in the permissions selector. The chat's effective policy remained granular at that point.
    • Earlier attempts in Full access returned only blocked by policy; that generic error does not establish which policy layer rejected them.
    • Ordinary desktop clicking and keyboard navigation were separately verified to work. This report is specifically about approval/grant handling, not general Computer Use failure.

    Expected behavior:
    An explicitly approved per-directory grant should provide a usable execution path for a command within that scope. If another capability is required, identify the missing scope/category and provide an available approval mechanism. The UI should make the effective policy and config override source visible, and troubleshooting should not direct users to a missing Custom option.

    The internal cause is unconfirmed. This Windows case adds a successful request_permissions grant followed by a rejection of a non-escalated exec_command, rather than only the explicit escalation failure in the original report.

    Privacy: personal directory names, usernames, account details, complete config files, and session logs are omitted. The obsolete directory was not deleted by the rejected command.

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

    appbugconfigsandboxtool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions