bug(chat): provider-side failed Codex turns store an empty error_message — timeline shows a bare "The agent ran into a problem"
Bug
A Codex Chat turn that ends without a SendTurn error is settled as failed with an empty error_message, so the timeline renders a bare "The agent ran into a problem" with no detail, no cause, and nothing the user can act on.
Reported by: @Ayash-Bera | Analyzed against: 15e9ea971
Confidence: High | Env: Linux 6.19.6-arch1-1 (Arch), AppImage daemon, node v22.22.0

The timeline marker is the entire message. There is no second line, no error activity, and nothing in the turn row to explain it.
Evidence (live ~/.ao/data/ao.db)
sid state error_message requested_at completed_at
agent-orchestrator-13 failed '' 2026-09-12 09:09:33 2026-09-12 09:13:18
agent-orchestrator-13 failed '' 2026-09-12 09:06:19 2026-09-12 09:08:35
wailist-agentmesh-4 failed '' 2026-09-12 09:01:26 2026-09-12 09:13:02
agent-orchestrator-12 failed "You've hit your usage limit. ..." 2026-09-12 06:23:10
Only the last one has a message, and it came from the dispatch-time path. Every provider-side failure stores an empty string.
conversation_provider_events for agent-orchestrator-13:
09:06:19.473 turn.started providerTurnId 7c2750ab turnState ""
09:06:19.474 controller.state busy
09:08:35.782 controller.state stopped <-- host gone mid-turn, no error event
09:09:28.765 turn.completed providerTurnId 7c2750ab turnState "failed" <-- no text, no detail
Root Cause
Two paths write a failed turn, and neither reaches conversation_turns.error_message.
-
backend/internal/adapters/chatdriver/acp/conversation.go:576-592— onerr == nil,turnState(resp.StopReason)(line 622) classifies every stop reason that is notEndTurn/CancelledasTurnStateFailed. That branch emits noChatEventErrorat all, so there is not even an error activity on the timeline. -
backend/internal/adapters/chatdriver/acp/conversation.go:596-599— theChatEventTurnCompletedemit never carriesErr, on either branch:
c.emit(ports.ChatEvent{
Kind: ports.ChatEventTurnCompleted, ProviderEventID: eventID,
ProviderTurnID: turnID, TurnState: state,
})
backend/internal/service/chat/controller.go:2417-2430 derives the stored message from exactly that field:
case ports.ChatEventTurnCompleted:
message := ""
if event.Err != nil {
message = event.Err.Error()
}
Err is always nil there, so message is always "". The ChatEventError emitted on the err != nil branch (line 574) goes to UpsertActivity (controller.go:2741-2754), a separate activity row, never the turn.
frontend/src/renderer/components/chat/ChatTimelineItems.tsx:341rendersfailedas"The agent ran into a problem"withdetail={error}. Empty error, so the user sees the label alone.
backend/internal/service/chat/controller_test.go:4700 asserts the crash-recovery state is failed but never asserts a message, so the gap is untested.
Reproduction
- Run a Codex Chat session and start a long turn.
- Kill the chat host mid-turn (or let it die), or end a turn on any stop reason other than
end_turn. - Reopen the session. The turn shows "The agent ran into a problem" with no cause.
sqlite3 ~/.ao/data/ao.db "SELECT state, quote(error_message) FROM conversation_turns WHERE state='failed' ORDER BY requested_at DESC LIMIT 5;"shows''.
Fix
In acp/conversation.go, carry the failure onto the turn-completed event and give the stop-reason branch an error of its own:
var state domain.TurnState
var failure error
if err != nil {
...
failure = err
c.emit(ports.ChatEvent{Kind: ports.ChatEventError, ProviderTurnID: turnID, Err: err})
} else {
state = turnState(resp.StopReason)
if state == domain.TurnStateFailed {
failure = fmt.Errorf("the agent stopped early (%s)", resp.StopReason)
c.emit(ports.ChatEvent{Kind: ports.ChatEventError, ProviderTurnID: turnID, Err: failure})
}
...
}
c.emit(ports.ChatEvent{
Kind: ports.ChatEventTurnCompleted, ProviderEventID: eventID,
ProviderTurnID: turnID, TurnState: state, Err: failure,
})
controller.go already reads event.Err, so no change is needed there. Worth also distinguishing "host died mid-turn" from "provider returned a failing stop reason" in the copy, since the user has no way to tell them apart today.
Impact
- Every provider-side Codex Chat failure is undiagnosable from the UI.
- Hides real causes (rate limits, auth expiry, host crashes) behind one generic string.
- Users retry blindly because nothing says what to change.
Related
- #4296 — stale OAuth creds after Codex account switch, no auth-failure detection (same blind spot, different trigger)
- #4937 — Claude OAuth expiry bypasses reauth banner
- #4613 — surface retry and connection state for non-Claude coding agents
- #5284 — Codex account switch recovery fence (same session, reported alongside)