Repository navigation
Feature: implement editable assistant messages - #6397
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request introduces inline-editing capabilities for assistant messages in the chat interface, adding an edit button to the action bar, managing the editing state via the global chat runtime store, and implementing utility functions to convert structured message content to tagged text and back. Feedback on these changes highlights several critical issues: structured content like tool calls is stripped during editing and deleted upon saving, which requires a merge strategy to preserve non-editable parts; retrieving the thread ID via aui.thread() fails because it returns the store instance rather than the state; a backend sync failure leaves the UI in an inconsistent state, requiring a rollback mechanism; the custom window event listener for refreshing messages is redundant; and an Escape key handler should be added to the textarea for better UX.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Completed a full pass of the implementation to address all feedback from the code review and resolve several critical edge cases discovered during testing. Key Improvements & Fixes:
|
|
CI passes on staging CI fork except for failing tests inherited from main, I also resolved a html preview regression and tested the assistant message editing manually. good first PR @CelesteHeartsong, merging. |
This PR introduces the ability for users to edit assistant messages directly within the thread.
Key Technical Implementation:
<THINK>...</THINK>and<TOOL>...</TOOL>) when entering edit mode.ThreadMessage["content"]format required by@assistant-ui/react.ChatRuntimeStore(editingMessageId). This ensures a single source of truth and avoids the use of global window events, aligning with the project's existing state patterns.MessagePrimitive.Partsfor rendering. This ensures that edited messages maintain the exact same professional styling, Markdown rendering, and component hierarchy as original AI responses.__LOCALID_). Edits to incognito chats are updated in the local memory store but skip the backend sync to prevent 404 errors, as these threads are intentionally not persisted.Changes:
chat-runtime-store.ts: AddededitingMessageIdstate andsetEditingMessageIdaction.update-thread-message.ts: Added utility functions for parsing/extracting tagged text and a handler to sync updates to the backend viasaveChatMessage.thread.tsx: Implemented the inline edit UI, a height-adjusting textarea, and the edit trigger in the assistant action bar.How to Test:
<THINK>or<TOOL>tags correctly updates the respective reasoning/tool blocks in the final rendered message.