feat(site): offer repair and retry when a chat is in an invalid state - #28749
Draft
bpmct wants to merge 1 commit into
Draft
feat(site): offer repair and retry when a chat is in an invalid state#28749bpmct wants to merge 1 commit into
bpmct wants to merge 1 commit into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a chat is stuck in an invalid execution state, every mutation returns a bare 409 (
Chat is in an invalid state.) and the UI dead-ends on an error toast. The recovery endpoint (POST /api/v2/chats/{chat}/reconcile-invalid) exists but is not exposed anywhere in the product, so users end up in support threads (see the linked Discord case, resolved by hand-running curl).This PR wires that recovery path into the archive and unarchive actions: when they fail with the invalid-state 409, the UI opens a "Repair agent state" dialog. Confirming reconciles the chat and retries the original action once. All other mutations keep their existing error handling.
Closes CODAGT-998.
Demo
Full recording
End-to-end reproduction
Validated on a local
./scripts/develop.shinstance withCODER_AI_GATEWAY_ENABLED=true:status='waiting'plus a queued message, the only unarchived invalid combination inchatstate.ClassifyExecutionState).PATCH /api/v2/chats/{chat}witharchived: truereturns the 409.Implementation notes and decisions
isChatInvalidStateErrormatches HTTP 409 plus the exact message because the backend response carries no machine-readable error code for this case; noted in a comment at the constant.site/src/api/queries/chats.tsnext to the archive mutations; the dialog state lives inAgentsPageLayout.tsx, which owns the chat mutations today.Detailhint towriteChatInvalidState, and possibly family-aware reconcile-on-archive) is discussed in CODAGT-998.pnpm exec tsc -p . --noEmit, biome on changed files, Vitest for the helper, and Storybook interaction tests for both dialog paths (repair-and-retry, dismiss).Opened by Coder Agents on behalf of @bpmct.