Repository navigation
Description
Bug Description
All MCP tool calls are immediately cancelled when using `codex exec` mode. This affects every MCP server, not just specific ones.
Reproduction
1. Any MCP server in `~/.codex/config.toml`:
```toml
[mcp_servers.minimal]
command = "node"
args = ["/path/to/any-mcp-server.js"]
```
2. Run exec mode:
```bash
codex exec --json --full-auto "Call the MCP tool"
```
3. Observed JSONL output:
```json
{"type":"item.started","item":{"type":"mcp_tool_call","server":"minimal","tool":"count","status":"in_progress"}}
{"type":"item.completed","item":{"type":"mcp_tool_call","server":"minimal","tool":"count","status":"failed","error":{"message":"user cancelled MCP tool call"}}}
```
Key Evidence
- Reproduces with the trivial MCP SDK example server (the `count` tool from `@modelcontextprotocol/sdk/examples/server/progressExample.js`) — not specific to any particular MCP server
- Direct stdio MCP client calls to the same servers succeed — the servers themselves are healthy
- Removing all hooks and AGENTS instructions doesn't change the behavior — hooks are not involved
- Codex log outputs: `request_user_input is not supported in exec mode`
- `codex features list` shows `codex_hooks = false`
Diagnosis
Codex exec mode appears to hit an MCP elicitation/user-input path during tool invocation. Since exec mode doesn't support interactive input, this triggers cancellation of the MCP tool call.
The cancellation happens very quickly after the tool call starts — it's not a timeout, it's an early abort.
Environment
- codex-cli 0.118.0
- macOS (Apple Silicon)
- Node.js v22.22.0
- Multiple MCP servers tested (context-mode, minimal SDK example)
Full Session Report
Detailed investigation with exact commands, outputs, and chronology:
https://gist.github.com/murataslan1/e0290cb0862f57fff4a0e2936b6a77d8
Activity
github-actions commentedon Apr 3, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
murataslan1 commentedon Apr 3, 2026
After reviewing the flagged duplicates:
Regression: non-codex_apps MCP tool calls block on app-tool approval prompt #15824 looks like the same root cause — MCP tool calls entering the
RequestUserInputapproval flow ("Approve app tool call?") which blocks/cancels in non-interactive contexts. That issue reports it from the test suite side (cargo testtimeouts), this issue reports it fromcodex execmode (where it surfaces asuser cancelled MCP tool call). Same underlying path:maybe_request_mcp_tool_approval()called unconditionally inmcp_tool_call.rs."danger-full-access" keeps asking for MCP permissions #16394 is different (closed, was about
danger-full-accesspermission prompts).If maintainers consider this a duplicate of #15824, happy to close. The exec-mode reproduction and the
request_user_input is not supported in exec modelog from this issue might still be useful as additional signal on #15824.docs: Codex hooks ready but dispatch not yet active (Stage::UnderDeve…
etraut-openai commentedon Apr 3, 2026
Thanks for the bug report. Do you have reason to suspect that this is a recent regression (e.g. in 0.117.0 or 0.118.0)? If you roll back to 0.116.0, are you able to repro the problem? I ask for a couple of reasons. First, this influences the priority of the fix. Second, this is the first report of this that we've received, which seems odd if this is a general problem. That might mean that it's related specifically to your configuration or the MCP server that you're using.
murataslan1 commentedon Apr 3, 2026
@etraut-openai Yes — this is a regression. Rolled back to 0.116.0 and the same minimal MCP server works fine:
0.116.0 — MCP tool call succeeds:
{"type":"item.started","item":{"type":"mcp_tool_call","server":"minimal","tool":"ping","status":"in_progress"}} {"type":"item.completed","item":{"type":"mcp_tool_call","server":"minimal","tool":"ping","result":{"content":[{"type":"text","text":"pong"}]},"status":"completed"}}0.118.0 — same server, same config, MCP tool call cancelled:
{"type":"item.started","item":{"type":"mcp_tool_call","server":"minimal","tool":"ping","status":"in_progress"}} {"type":"item.completed","item":{"type":"mcp_tool_call","server":"minimal","tool":"ping","status":"failed","error":{"message":"user cancelled MCP tool call"}}}The minimal server is a trivial
ping→pongtool using@modelcontextprotocol/sdk— nothing config-specific.Potentially relevant feature flag change between versions:
tool_call_mcp_elicitation = falsetool_call_mcp_elicitation = true(now stable)This suggests the regression may be related to the MCP elicitation feature becoming default-on between these versions.
Full regression test report with exact commands and JSONL output:
https://gist.github.com/murataslan1/e0290cb0862f57fff4a0e2936b6a77d8#file-codex-mcp-regression-test-0-116-0-2026-04-03-md
etraut-openai commentedon Apr 3, 2026
OK, thanks for the confirmation. Very helpful!
docs: pin Codex ≤0.116.0 for exec-mode MCP, add version check to debu…
7 remaining items
njakubiak commentedon May 21, 2026
I am able to work around this issue using the argument "-s danger-full-access"
fix(library): Codex backend works end-to-end — stdin, strict schema, …
Fix Codex MCP tool calls being auto-cancelled
feat: codex CLI bridge harness mode — codex runs Forge's tools via MC…
feat: codex CLI bridge harness mode — codex runs Forge's tools via MC…
Support codex exec as a second agent
Pre-approve Codex MCP tools so unattended runs can call them
Phase 1 完成:TASK-101~105 + GATE-1 通过
TunaTung commentedon Aug 1, 2026
Another data point that likely shares a root cause with the models.json tool-surface bug (#36382): on 0.146.0 + DeepSeek official setup (supports_search_tool=true + tool_mode=null), MCP tool calls either never reached the model (tools hidden) or collapsed into cancellation. After setting
supports_search_tool: falseon the deepseek models, exec-mode MCP calls complete normally — our hermes-teamask_agentreturned a real answer in 29s. On this configuration the "user cancelled" behavior was downstream of the hidden-tool bug, not just the approval flow. Also noting the regression timeline you confirmed (0.116 OK / 0.117+ broken) matches when the tool-surface handling changed.fix(r2): readOnlyHint on status/result tools + codex exec approval mo…
Make Codex and the API engines actually reach the vault
消えたモデル名で 404 になるのを直し、Codex が MCP を引けないことを書き残す
Agent bar with Codex: tools that are not cancelled, entry written first
etraut-openai commentedon Nov 29, 2026
(Response from codex)
I tested an unannotated MCP tool on 0.172.0. With approval policy
never, exec now reports why approval was denied. Settingapproval_mode = "approve"under[mcp_servers.minimal.tools.count]let that specific tool run. Only preapprove tools you trust. Closing this since the unconditional cancellation and misleading user-cancelled message no longer describe the current behavior.