fix!: persist structured chat errors by ethanndickson · Pull Request #24919 · coder/coder
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.
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