mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
Previously, editing a past user message in Agents chat waited for the PATCH round-trip and cache reconciliation before the conversation visibly settled. The edited bubble and truncated tail could briefly fall back to older fetched state, and a failed edit did not restore the full local editing context cleanly. Keep history editing optimistic end-to-end: update the edited user bubble and truncate the tail immediately, preserve that visible conversation until the authoritative replacement message and cache catch up, and restore the draft/editor/attachment state on failure. The route already scopes each `agentId` to a keyed `AgentChatPage` instance with its own store/cache-writing closures, so navigating between chats does not need an extra post-await active-chat guard to keep one chat's edit response out of another chat.