diff --git a/packages/server/src/server/agent/providers/codex-mcp-agent.ts b/packages/server/src/server/agent/providers/codex-mcp-agent.ts index 3a06fdb0d..4e75417db 100644 --- a/packages/server/src/server/agent/providers/codex-mcp-agent.ts +++ b/packages/server/src/server/agent/providers/codex-mcp-agent.ts @@ -362,13 +362,18 @@ class CodexMcpAgentSession implements AgentSession { } const response = await new Promise((resolve, reject) => { + const hasPending = + this.pendingPermissions.has(permission.id) || + this.pendingPermissionHandlers.has(permission.id); this.pendingPermissions.set(permission.id, permission); this.pendingPermissionHandlers.set(permission.id, { request: permission, resolve, reject, }); - this.emitPermissionRequested(permission); + if (!hasPending) { + this.emitPermissionRequested(permission); + } }); return response; @@ -1351,7 +1356,7 @@ class CodexMcpAgentSession implements AgentSession { return { id: requestId, provider: "codex-mcp" as AgentPermissionRequest["provider"], - name: "exec_command", + name: "CodexBash", kind: "tool", title: commandText ? `Run command: ${commandText}` : "Run shell command", description: message, diff --git a/plan.md b/plan.md index c5e6cec44..91d23bc32 100644 --- a/plan.md +++ b/plan.md @@ -52,11 +52,12 @@ Build a new Codex MCP provider side‑by‑side with the existing Codex SDK prov - [x] **Fix**: Investigate Codex MCP permission elicitation behavior for `approval-policy=on-request` and `untrusted` (no permission_requested events). - **Done (2025-12-24 19:16)**: Added permission gating fallback for exec approval events, queued command events until approval, and flush/dropped queued events on resolution. -- [ ] **Fix**: Compare permission elicitation with happy-cli reference implementation. +- [x] **Fix**: Compare permission elicitation with happy-cli reference implementation. - Read `/Users/moboudra/dev/voice-dev/.tmp/happy-cli/src/codex/` to understand how elicitation works there. - Identify what's different in `codex-mcp-agent.ts` vs the reference. - The reference supports permissions - copy the working approach. + - **Done (2025-12-24 18:53)**: Matched happy-cli elicitation flow by avoiding duplicate permission requests when exec events pre-seed pending entries and aligned permission tool naming with CodexBash. - [ ] **Fix**: Use valid model instead of gpt-4.1.