Auto-approve loop bridge MCP tools for Codex#48
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces auto-approval configuration for specific Codex bridge tools by appending approval mode arguments to the MCP server setup. While the logic correctly targets the intended tools, the feedback points out a potential bug where the stringifyToml function might double-quote the approval mode value, which could prevent the configuration from being parsed correctly.
| CODEX_BRIDGE_APPROVAL_MODE | ||
| )}`, |
There was a problem hiding this comment.
The stringifyToml function is incorrectly applied to CODEX_BRIDGE_APPROVAL_MODE. The CODEX_BRIDGE_APPROVAL_MODE constant is already a string that should be directly quoted in the configuration argument. Applying JSON.stringify (which stringifyToml does) results in double-quoting (e.g., ""approve"" instead of "approve"), which could lead to incorrect parsing by the MCP server and prevent the auto-approval from functioning as intended. The tests also expect a single layer of quoting.
To fix this, CODEX_BRIDGE_APPROVAL_MODE should be directly embedded within the string literal, ensuring it is quoted only once.
mcp_servers.${BRIDGE_SERVER}.tools.${tool}.approval_mode="${CODEX_BRIDGE_APPROVAL_MODE}"
Summary
Why
Recent Codex releases gate custom MCP tools through per-tool approval settings under mcp_servers..tools..approval_mode. There is no server-wide trust or approval override for custom MCP servers, so loop needs to pass explicit approve overrides for its bridge tools when it launches Codex.
Verification