Skip to content

feat(chatd): persist last_error on chats table#22436

Merged
kylecarbs merged 3 commits intomainfrom
add-chat-last-error
Feb 28, 2026
Merged

feat(chatd): persist last_error on chats table#22436
kylecarbs merged 3 commits intomainfrom
add-chat-last-error

Conversation

@kylecarbs
Copy link
Copy Markdown
Member

Adds a nullable last_error column to the chats table so error reasons survive page reloads.

Backend:

  • Migration adds last_error TEXT (nullable) to chats
  • UpdateChatStatus writes the error reason when status transitions to error, clears it (NULL) on recovery
  • convertChat maps sql.NullString to *string in the SDK

Frontend:

  • Sidebar falls back to chat.last_error when no stream error reason is cached
  • Chat detail page does the same for persistedErrorReason
  • Fixtures updated for new required field

Adds a last_error column to the chats table so that when a chat
transitions to error status, the error reason is stored in the
database and returned in the Chat API payload. Previously the error
was only published as an ephemeral SSE stream event and lost if the
client wasn't connected.

The UpdateChatStatus query now accepts a last_error parameter. All
non-error status transitions pass an empty string, which clears any
previous error. The two error paths (panic recovery and runChat
failure) capture the error message into lastError before persisting.

The SDK Chat struct gains a LastError field (omitted from JSON when
empty) and convertChat maps it from the database row.
@kylecarbs kylecarbs merged commit 0ad2f9e into main Feb 28, 2026
55 of 58 checks passed
@kylecarbs kylecarbs deleted the add-chat-last-error branch February 28, 2026 17:27
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant