Skip to content

fix(chat): edit-resend rewrites the current conversation instead of branching - #1140

Merged
xiaozhou26 merged 1 commit into
mainfrom
fix/edit-resend-in-place
Nov 3, 2026
Merged

xiaozhou26 merged 1 commit into
mainfrom
fix/edit-resend-in-place

Conversation

@xiaozhou26

Copy link
Copy Markdown
Contributor

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-brain POST /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

  • Modules: agent-gui, agent-ui (i18n)
  • Key paths:
    • crates/agent-gui/src/pages/ChatPage.tsx: removed prepareEditResend (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 anchor
    • crates/agent-gui/src/pages/chat/gateway/useGatewayBridgeListeners.ts, gatewayBridgeTypes.ts: the gateway edit_resend path no longer forks either
    • crates/agent-ui/src/i18n/translations/{zhCN,enUS}Common.ts: removed the unused toast strings

Screenshots / 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-exempt for that reason.

Verification

  • pnpm typecheck and pnpm lint in crates/agent-gui: pass
  • node --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.
  • Full frontend suite: 3872 pass. 4 fail, all real-K-brain-process integration tests that hit the 120s timeout locally; none of them touch edit-resend.

Pre-submit checklist

  • A requirement issue is linked (or this is a trivial fix that needs no issue, as explained in the summary).
  • Synced with the target branch; no merge conflicts.
  • The change is focused, with no unrelated modifications.
  • No secrets, tokens, or personal data included.
  • Docs are updated for changes affecting user behavior, deployment, or configuration.

…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.
@xiaozhou26 xiaozhou26 added the governance-exempt Skip PR governance checks label Nov 3, 2026
@xiaozhou26
xiaozhou26 merged commit 9f4f4e9 into main Nov 3, 2026
12 checks passed
@xiaozhou26
xiaozhou26 deleted the fix/edit-resend-in-place branch November 3, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

governance-exempt Skip PR governance checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 编辑重发直接在原会话中重发,不再新建分支

1 participant