Fix Codex MCP permission elicitation parity

This commit is contained in:
Mohamed Boudra
2025-12-24 18:53:59 +07:00
parent 5b971dba69
commit 75c2a96068
2 changed files with 9 additions and 3 deletions

View File

@@ -362,13 +362,18 @@ class CodexMcpAgentSession implements AgentSession {
}
const response = await new Promise<ElicitResponse>((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,

View File

@@ -52,11 +52,12 @@ Build a new Codex MCP provider sidebyside 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.