Fix Codex MCP error timeline on failed turns
This commit is contained in:
@@ -36,6 +36,7 @@ type TurnState = {
|
|||||||
sawAssistant: boolean;
|
sawAssistant: boolean;
|
||||||
sawReasoning: boolean;
|
sawReasoning: boolean;
|
||||||
sawError: boolean;
|
sawError: boolean;
|
||||||
|
sawErrorTimeline: boolean;
|
||||||
completed: boolean;
|
completed: boolean;
|
||||||
failed: boolean;
|
failed: boolean;
|
||||||
};
|
};
|
||||||
@@ -474,6 +475,7 @@ class CodexMcpAgentSession implements AgentSession {
|
|||||||
sawAssistant: false,
|
sawAssistant: false,
|
||||||
sawReasoning: false,
|
sawReasoning: false,
|
||||||
sawError: false,
|
sawError: false,
|
||||||
|
sawErrorTimeline: false,
|
||||||
completed: false,
|
completed: false,
|
||||||
failed: false,
|
failed: false,
|
||||||
};
|
};
|
||||||
@@ -793,6 +795,12 @@ class CodexMcpAgentSession implements AgentSession {
|
|||||||
if (event.item.type === "reasoning") {
|
if (event.item.type === "reasoning") {
|
||||||
this.turnState && (this.turnState.sawReasoning = true);
|
this.turnState && (this.turnState.sawReasoning = true);
|
||||||
}
|
}
|
||||||
|
if (event.item.type === "error") {
|
||||||
|
if (this.turnState) {
|
||||||
|
this.turnState.sawError = true;
|
||||||
|
this.turnState.sawErrorTimeline = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (event.type === "turn_completed") {
|
if (event.type === "turn_completed") {
|
||||||
this.turnState && (this.turnState.completed = true);
|
this.turnState && (this.turnState.completed = true);
|
||||||
@@ -1149,13 +1157,12 @@ class CodexMcpAgentSession implements AgentSession {
|
|||||||
(event as { error?: { message?: string } }).error ??
|
(event as { error?: { message?: string } }).error ??
|
||||||
((data as { error?: { message?: string } } | null)?.error ?? null);
|
((data as { error?: { message?: string } } | null)?.error ?? null);
|
||||||
const error = errorRecord?.message ?? "Codex MCP turn failed";
|
const error = errorRecord?.message ?? "Codex MCP turn failed";
|
||||||
if (!this.turnState?.sawError) {
|
if (!this.turnState?.sawErrorTimeline) {
|
||||||
this.emitEvent({
|
this.emitEvent({
|
||||||
type: "timeline",
|
type: "timeline",
|
||||||
provider: "codex-mcp",
|
provider: "codex-mcp",
|
||||||
item: { type: "error", message: error },
|
item: { type: "error", message: error },
|
||||||
});
|
});
|
||||||
this.turnState && (this.turnState.sawError = true);
|
|
||||||
}
|
}
|
||||||
this.emitEvent({ type: "turn_failed", provider: "codex-mcp", error });
|
this.emitEvent({ type: "turn_failed", provider: "codex-mcp", error });
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -268,7 +268,8 @@ Build a new Codex MCP provider side‑by‑side with the existing Codex SDK prov
|
|||||||
- [x] **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.
|
- **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).
|
- [x] **Fix**: Codex MCP should emit error timeline items for failed turns (currently none).
|
||||||
|
- **Done (2025-12-24 20:41)**: Tracked error timeline emission separately so failed turns always emit an error item before `turn_failed`.
|
||||||
|
|
||||||
- [ ] **Fix**: Codex MCP persistence/resume should include conversation_id metadata (resume error).
|
- [ ] **Fix**: Codex MCP persistence/resume should include conversation_id metadata (resume error).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user