Repository navigation
fix(chat): edit-resend rewrites the current conversation instead of branching - #1140
Merged
Merged
Conversation
…ranching Editing a sent message and resending used to fork a new K-brain session before running, leaving a near-duplicate conversation in the sidebar each time. Resend now rewrites the open conversation in place: the send preflight already calls K-brain's /edit endpoint, which truncates history after the edited message and replaces it before the run starts. - Drop the branching prepareEditResend step from ChatPage, useEditResend and the gateway edit_resend path. - Remove the now-unused "resent in a new branch" toast strings. - Explicit "branch conversation" from the message menu is 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
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.
Linked issue
Closes #1139
Summary
Editing a sent message and resending used to fork a new K-brain session before the run, so every edit left another same-titled conversation in the sidebar. Resend now rewrites the open conversation in place.
No backend change is needed. The send preflight (
useSendChatTurn→replaceConversationAtMessage→editKBrainHistory) already calls K-brainPOST /v1/sessions/{id}/edit, which truncates history after the edited user message and replaces it before the run starts. The branched flow was running that same edit on the forked child. This PR only drops the fork step.The explicit "branch conversation" action in the message menu is unchanged.
Change scope
crates/agent-gui/src/pages/ChatPage.tsx: removedprepareEditResend(fork + child activation + "resent in a new branch" toast)crates/agent-gui/src/pages/chat/hooks/useEditResend.ts: always sends to the current conversation with the original anchorcrates/agent-gui/src/pages/chat/gateway/useGatewayBridgeListeners.ts,gatewayBridgeTypes.ts: the gatewayedit_resendpath no longer forks eithercrates/agent-ui/src/i18n/translations/{zhCN,enUS}Common.ts: removed the unused toast stringsScreenshots / preview
N/A. This removes behavior and adds no UI: after an edit-resend the sidebar no longer gains a branch row and the "已在新分支中重发" toast no longer appears. The PR is labeled
governance-exemptfor that reason.Verification
pnpm typecheckandpnpm lintincrates/agent-gui: passnode --test test/chat/edit-resend-atomic.test.mjs test/chat/history-revision-conflict-reload.test.mjs: 16/16 pass. The edit-resend test now asserts the resend targets the current conversation and the original message ref.Pre-submit checklist