Fix error timeline for failed Codex MCP turns

This commit is contained in:
Mohamed Boudra
2025-12-24 19:43:05 +07:00
parent 383870687f
commit 055a1bcefe
2 changed files with 10 additions and 1 deletions

View File

@@ -1216,6 +1216,14 @@ class CodexMcpAgentSession implements AgentSession {
(event as { error?: { message?: string } }).error ??
((data as { error?: { message?: string } } | null)?.error ?? null);
const error = errorRecord?.message ?? "Codex MCP turn failed";
if (!this.turnState?.sawError) {
this.emitEvent({
type: "timeline",
provider: "codex-mcp",
item: { type: "error", message: error },
});
this.turnState && (this.turnState.sawError = true);
}
this.emitEvent({ type: "turn_failed", provider: "codex-mcp", error });
break;
}

View File

@@ -121,7 +121,8 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- [x] **Fix**: Codex MCP thread/item event mapping should capture file_change, mcp_tool_call, web_search, and todo_list.
- **Done (2025-12-24 19:40)**: Normalized thread event types and added data fallback so item events map to timeline entries.
- [ ] **Fix**: Codex MCP should emit error timeline items for failed turns.
- [x] **Fix**: Codex MCP should emit error timeline items for failed turns.
- **Done (2025-12-24 19:42)**: Emitted error timeline item on `turn.failed` when no prior error was recorded.
- [ ] **Fix**: Codex MCP persistence should include conversationId metadata for resume.