Repository navigation
fix: keep failed turns in saved history from breaking the chat - #54
Conversation
|
Needs a fix before merge. The |
155706a to
aa53c02
Compare
aa53c02 to
45f00bc
Compare
|
Addressed the review: the replay flag is now a per-load counter, and the description states that a live-run failure after a reload is swallowed. CI is green now. |
45f00bc to
25a468d
Compare
Connecting to a Rich Threads conversation replays its saved events,
including RUN_ERROR from any earlier failed turn. CopilotKit reports
those through onError as agent_run_error_event, so one failed reply
made the conversation fail to load ("Could not load conversation")
on every visit and showed a stale error banner.
While history replays, ignore agent_run_error_event only. Connection
failures (agent_connect_failed) still block loading, and errors from
new turns still stop the run and the follow-up queue.
25a468d to
2bac728
Compare
jerelvelarde
left a comment
There was a problem hiding this comment.
Value: historical failed turns no longer permanently prevent loading saved conversations. Filtering retains connection failures and new-turn failures. Three real SDK regressions passed. Template: clear verification/platform limits; please add the required UI screenshot or recording. The disclosed live reconnect-error banner limitation is understood. Updated-main diff reviewed; no actionable security finding. Merge after required CI.
What changed
When one chat turn fails (for example, a provider rejects the API key), the main conversation stays broken afterwards:
Connecting to a Rich Threads conversation replays its saved events, including the
RUN_ERRORfrom the earlier failed turn. CopilotKit core reports replayed run errors throughonErrorwith codeagent_run_error_event.hydrate()treated any error duringconnectAgentas a failed load, and the chat-wideonErrorsubscriber showed it as a new error.Now:
runConversationTurnaccepts error codes to ignore.hydrate()and the chat error subscriber ignore onlyagent_run_error_event.agent_connect_failed) still block loading. Errors from new turns still stop the run and pause the follow-up queue, as before.Behavior change: if a live run fails while a reload is reconnecting to it, that error is now swallowed like a replayed one. No banner is shown; the failed turn stays in the transcript.
Verification
tests/conversation-sdk.test.tsuse the realCopilotKitCore:RUN_ERRORrejects without the ignore list, which reproduces the bug, and resolves with it.pnpm typecheckpasses.biome cipasses on the changed files.pnpm test: 200 passed, 0 failed, 1 skipped (POSIX-only).Integration limits
chat.tsx.