Fix Codex MCP thread item event normalization

This commit is contained in:
Mohamed Boudra
2025-12-24 20:38:23 +07:00
parent 85af83203d
commit 3652f08e3d
2 changed files with 15 additions and 11 deletions

View File

@@ -910,12 +910,6 @@ class CodexMcpAgentSession implements AgentSession {
}
private handleMcpEvent(event: unknown): void {
this.emitEvent({
type: "provider_event",
provider: "codex-mcp",
raw: event,
});
if (!event || typeof event !== "object") {
return;
}
@@ -933,8 +927,19 @@ class CodexMcpAgentSession implements AgentSession {
return;
}
const normalizedType = normalizeThreadEventType(type);
const providerRaw =
normalizedType !== type ? { ...eventRecord, type: normalizedType } : eventRecord;
this.emitEvent({
type: "provider_event",
provider: "codex-mcp",
raw: providerRaw,
});
type = normalizedType;
if (type.includes(".") || type.startsWith("turn.") || type.startsWith("thread.") || type.startsWith("item.")) {
this.handleThreadEvent(eventRecord);
this.handleThreadEvent(providerRaw);
return;
}

View File

@@ -265,7 +265,8 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- [x] **Fix**: Codex MCP command output should include exit codes for command tool calls (missing in timeline mapping).
- **Done (2025-12-24 20:33)**: Normalized exit code parsing so numeric strings are captured in timeline output.
- [ ] **Fix**: Codex MCP thread/item event mapping for file_change, mcp_tool_call, web_search, and todo_list still failing.
- [x] **Fix**: Codex MCP thread/item event mapping for file_change, mcp_tool_call, web_search, and todo_list still failing.
- **Done (2025-12-24 20:38)**: Normalized MCP provider event payloads to surface item events and thread/item types consistently for timeline mapping.
- [ ] **Fix**: Codex MCP should emit error timeline items for failed turns (currently none).
@@ -287,9 +288,7 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- Interrupt completes in < 1 second
- No zombie processes left running
- Session state is clean (can start new session)
- Test BOTH:
- Codex MCP provider interruption
- Codex SDK provider interruption (if applicable)
- Test Codex MCP provider interruption only (SDK is deprecated)
- This is critical for user experience - users expect immediate response to cancel
- [ ] **Test (E2E)**: Permission flow parity - test both Codex MCP and Claude providers.