spawn_agent forces approval_policy=never; breaks collab thread navigation and blocks sandbox escalation

Resolved 💬 5 comments Opened Feb 24, 2026 by palvaleri Closed Feb 26, 2026
💡 Likely answer: A maintainer (jif-oai, contributor) responded on this thread — see the highlighted reply below.

Problem

spawn_agent (thread-spawned subagents used by Collab / multi-agent TUI) currently clamps the spawned thread's approval_policy to never.

This causes two practical breakages:
1) Config mismatch errors when navigating/resuming subagent threads (e.g. in the TUI /agents view) if the parent session is started with -a on-request (or any non-never policy). The error looks like:

  • OnRequest is not in the allowed set [Never]

2) Spawned agents can't request sandbox escalation approvals (e.g. running Playwright on macOS in workspace-write sandbox often requires escalation to launch Chromium/WebKit/Firefox). With approval_policy=never, the agent can never ask, which forces users to switch to danger-full-access as a workaround.

Root cause

In codex-rs/core/src/tools/handlers/multi_agents.rs, apply_spawn_agent_overrides does:

config.permissions.approval_policy = Constrained::allow_only(AskForApproval::Never);

So the spawned thread is permanently constrained to never even when the parent session is interactive and explicitly configured to use on-request.

Expected

Spawned threads should inherit the parent session's effective approval policy (and constraints) by default.

Non-interactive exec already uses approval_policy=never, so inheriting it keeps the current behavior for headless runs.

Actual

Spawned threads are forced to never, producing the mismatch error above and preventing escalation approvals.

Environment / repro

  • Codex CLI: 0.101.0+ (observed in 0.104.0 and main)
  • macOS (arm64)
  • Start Codex TUI with --full-auto (or -a on-request), spawn an agent, then navigate to the spawned thread via /agents.

Proposed fix

Remove the hard override and let the spawned thread inherit the parent approval policy.

(Background subagents created by other systems can continue to clamp approval_policy=never if needed.)

View original on GitHub ↗

5 Comments

palvaleri · 6 months ago

Thanks — sharing a ready-to-cherry-pick patch for this issue.

PR #12714 was automatically closed because contributions are invitation-only, but the minimal fix is implemented here:

Patch summary:

  • stop clamping spawned threads to approval_policy=never in apply_spawn_agent_overrides (multi_agents handler)
  • spawned subagents now inherit the parent thread’s effective approval policy (and allowed set)
  • tests updated accordingly

Minimal diff:

fn apply_spawn_agent_overrides(config: &mut Config, child_depth: i32) {
-    config.permissions.approval_policy = Constrained::allow_only(AskForApproval::Never);
     let max_depth = max_thread_spawn_depth(config.agent_max_spawn_depth);
     if exceeds_thread_spawn_depth_limit(child_depth + 1, max_depth) {
         config.features.disable(Feature::Collab);
     }
}

Why this matters in practice:

  • interactive Collab users running -a on-request hit OnRequest is not in the allowed set [Never] when navigating/resuming spawned agent threads
  • on macOS workspace-write sandbox, Playwright/Chromium frequently requires sandbox escalation; with approval_policy=never, spawned agents can never request it, forcing danger-full-access as a workaround

If you want to keep the current default for safety, a follow-up alternative is to make this behavior configurable (default: clamp, opt-in: inherit), but the above commit is the smallest behaviorally-correct fix for interactive Collab.

jif-oai contributor · 6 months ago

This will be removed once the UX is good enough such the approval requests are correctly piped to you. In the meantime we keep it like this on purpose

palvaleri · 6 months ago

Thanks for confirming this is intentional for now.

Even if spawned threads are clamped to approval_policy=never, the current UX is rough for interactive Collab sessions started with -a on-request:

1) Switching to a spawned agent thread from the TUI (/agents) and sending a message often triggers OnRequest is not in the allowed set [Never]. Sometimes the thread becomes “stuck” at the final message / you can’t continue the conversation.
2) This is especially painful on macOS workspace-write where Playwright/Chromium frequently needs sandbox escalation; with never the subagent can’t request it, pushing users to danger-full-access.

Suggested improvements (keeping the safety clamp):

  • When attaching/resuming a thread, the client should use the thread’s own allowed set and silently clamp the effective policy for that thread (or show a one-time banner), rather than emitting a confusing validation error and/or failing send_input.
  • In /agents, show each agent thread’s effective approval_policy (and maybe sandbox_mode) so the user understands why approvals won’t happen.
  • If the long-term plan is “pipe approvals to the user via parent”, it would help to document current workarounds (e.g. configuring rules/allowlists for common tools like Playwright), so Collab remains usable without danger-full-access.

Happy to provide a minimal repro script / rollouts if useful.

palvaleri · 6 months ago

One more clarifying point on severity: in the current TUI Collab flow this is not just a warning—after switching to a spawned agent via /agents, attempting to send any message can fail immediately with the allowed-set mismatch (send_input errored / UI rejects the turn). In other words: sometimes you can’t even ask the subagent a question, making Collab effectively unusable in interactive (-a on-request) sessions.

palvaleri · 6 months ago

Workaround we found (Codex CLI 0.106.0, interactive Collab TUI):

  • Start the manager/parent session with -a never (or re-attach/resume the manager SID with -a never before spawning / switching to agents).
  • Once the parent is never, /agents navigation + sending messages to spawned agents works reliably (no OnRequest is not in the allowed set [Never] / no immediate send_input failure), because the whole tree shares allowed-set [Never].

Tradeoff: no interactive approvals anywhere, so for things like Playwright on macOS workspace-write you need to pre-allow the required command prefixes via rules/allowlists (or use a higher permission preset).