fix!: persist structured chat errors#24919
Merged
Merged
Conversation
Docs preview📖 View docs preview for |
deansheather
approved these changes
May 4, 2026
Drop the legacy `last_error` headline string and rename `last_error_payload` to `last_error` so chats expose a single structured error object. Make persisted decode lossless, share one frontend normalizer between live and persisted paths, guard the HTTP chip on positive status codes, and align tests, stories, fixtures, and docs.
Removes leftover compatibility scaffolding from the chat last-error redesign: - normalizeChatErrorPayload no longer takes a fallbackMessage option; the live-stream "Chat processing failed." default lives at the only caller that needs it, and the redundant statusCode > 0 check in ChatStatusCallout is gone now that the normalizer filters bad codes. - Deletes chaterror.StreamErrorPayload, which was a thin alias for TerminalErrorPayload, and inlines the chatLastErrorMessage helper in cli/agents_list.go to match the file's existing nil-check style. - Renames legacyPayload to wantPayload in chatd_test.go and corrects stale "migration 474" comments in the chat last-error fixtures. - Adds a structured last_error example to docs/ai-coder/agents/chats-api.md. decodeChatLastError, the cached-error precedence in AgentChatPage, the encodeChatLastErrorPayload helper, and the LastError clears on chat status transitions are intentionally unchanged.
2a579b2 to
0b82b79
Compare
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change for changelog:
Persisted chat errors now carry the same provider-specific detail (kind, provider, retryable, HTTP status, optional detail) as the live stream, so refreshing a failed chat rehydrates with the full structured error instead of a one-line headline.
Existing rows are migrated in place: legacy text errors are wrapped into
{message, kind: "generic"}so already-errored chats still render, and rows withlast_error IS NULLstay NULL. Internally, persisted fallback decoding now reuses the existingchaterror.KindGenericconstant, with no JSON value change.Closes CODAGT-239