Skip to content

fix(chat): branch a history edit only when it is sent - #1009

Merged
agegr merged 5 commits into
mainfrom
claude/pr-967-defer-history-edit
Sep 30, 2026
Merged

agegr merged 5 commits into
mainfrom
claude/pr-967-defer-history-edit

Conversation

@agegr

@agegr agegr commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Replaces #967 by @uvforce. Fixes #958. Their commits are kept. This branch reverts one of them and resolves the conflict with current main.

What

"Edit from here" called navigate_tree on click. For a user message, pi moves the leaf to the message's parent and persists that, so:

  • There was no way to back out.
  • After a reload, the conversation looked cut off at the edited message. The later turns are only reachable through the branch navigator.

Changes

  • From fix(chat): branch a history edit only when it is sent #967:
    • Clicking "Edit from here" only prefills the composer and records the target entry. The composer shows an "Edit from here · Cancel" banner.
    • Sending first navigates, then prompts. If the navigation fails, the draft and the pending edit are restored and no prompt is sent.
    • A pending edit is never sent as steer or follow-up.
  • Review changes:
    • Revert "expose history edit actions on touch screens". Always showing Copy / Edit / New session at 44px under every user message on phones is a separate layout change, not part of this fix. A tap already reveals those actions.
    • Merge main and resolve the ChatInput props conflict with the default-model star (defaultModel, onSetDefaultModel) by keeping both.

Known limitation (from the original PR): navigate and prompt are still two RPCs.

Verification

tsc --noEmit, eslint, and the full unit suite (1324/1324) pass on this branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ


Generated by Claude Code

wayne.luo and others added 4 commits September 26, 2026 09:32
"Edit from here" called navigate_tree on click, which persisted a leaf
move before the user committed to the edit. There was no way back, and
a reload showed the conversation cut off at the edited message (#958).

Clicking now only prefills the composer and records the target entry in
useAgentSession. The composer shows an edit banner with Cancel, which
clears the prefill without touching the session. Sending navigates first
and then takes the normal prompt path; a failed navigation restores the
draft and the edit state. The pending edit follows the session's
in-memory draft across session switches, and a pending edit is never
sent as steer or follow-up.

Navigation and prompt remain two RPCs, so a prompt rejected after the
navigation keeps the new leaf.
Always showing Copy / Edit from here / New session at 44px under every
user message on phones is a separate design change from deferring the
history-edit branch, and it costs a lot of vertical space per turn. A tap
on the message already reveals the actions (mobile browsers emulate
mouseenter on tap), so leave that layout as it is here.

This reverts commit 8931c5a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ
Resolve the ChatInput props conflict with the default-model star
(defaultModel, onSetDefaultModel) by keeping both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ
Resolve the MessageView props conflict with #968: keep dropping
onNavigate (the edit branches on send now) and take the new
onCompact / isCompacting / compactError props.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ
@agegr
agegr merged commit 7303179 into main Sep 30, 2026
2 checks passed
@agegr
agegr deleted the claude/pr-967-defer-history-edit branch October 1, 2026 13:28
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
…#907 agegr#941 agegr#946 agegr#961 agegr#968 agegr#969 agegr#1007 agegr#1008 agegr#1009 agegr#1010)

上游已把我们提前摘取的 agegr#884 / agegr#871 / agegr#996 / agegr#961 原样合并(agegr#961 逐字节相同),
agegr#967 与 agegr#963 由上游的 agegr#1009 / agegr#1008 接管。

冲突解决:
- demo/ 对齐上游 fe288c0,撤销 agegr#963 对 demo 的两处改动(`@/lib/chat-phase-label`
  在 demo/lib 下不存在,会打断 Pages 构建)。
- AGENTS.md:保留我们的 default-project 条目,open-folder 换成上游的
  open-in-explorer。
- MessageView.tsx / SessionSidebar.tsx / FileExplorer.tsx:以上游为准,
  DismissButton 采用上游的独立文件,保留我们的思考卡片与文件管理改动。
- SessionSidebar 移除引用已删函数的旧 agegr#951 工作区按钮(agegr#951 的其他入口另行收尾)。
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
agegr#967 / agegr#963 已由上游的 agegr#1009 / agegr#1008 落地,agegr#961 上游原样合并(逐字节相同),
agegr#951 已收敛到上游的 agegr#907,agegr#960 上下游都拒绝——这些都与上游一致,按台账规则删行。
agegr#899 上游关闭但本地保留,状态注明为永久分叉。
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 6, 2026
* fix(chat): branch a history edit only when it is sent

"Edit from here" called navigate_tree on click, which persisted a leaf
move before the user committed to the edit. There was no way back, and
a reload showed the conversation cut off at the edited message (agegr#958).

Clicking now only prefills the composer and records the target entry in
useAgentSession. The composer shows an edit banner with Cancel, which
clears the prefill without touching the session. Sending navigates first
and then takes the normal prompt path; a failed navigation restores the
draft and the edit state. The pending edit follows the session's
in-memory draft across session switches, and a pending edit is never
sent as steer or follow-up.

Navigation and prompt remain two RPCs, so a prompt rejected after the
navigation keeps the new leaf.

* fix(chat): expose history edit actions on touch screens

* revert(chat): keep user-message actions on hover for touch screens

Always showing Copy / Edit from here / New session at 44px under every
user message on phones is a separate design change from deferring the
history-edit branch, and it costs a lot of vertical space per turn. A tap
on the message already reveals the actions (mobile browsers emulate
mouseenter on tap), so leave that layout as it is here.

This reverts commit 8931c5a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

---------

Co-authored-by: wayne.luo <[email protected]>
Co-authored-by: Claude <[email protected]>
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 8, 2026
* fix(chat): branch a history edit only when it is sent

"Edit from here" called navigate_tree on click, which persisted a leaf
move before the user committed to the edit. There was no way back, and
a reload showed the conversation cut off at the edited message (agegr#958).

Clicking now only prefills the composer and records the target entry in
useAgentSession. The composer shows an edit banner with Cancel, which
clears the prefill without touching the session. Sending navigates first
and then takes the normal prompt path; a failed navigation restores the
draft and the edit state. The pending edit follows the session's
in-memory draft across session switches, and a pending edit is never
sent as steer or follow-up.

Navigation and prompt remain two RPCs, so a prompt rejected after the
navigation keeps the new leaf.

* fix(chat): expose history edit actions on touch screens

* revert(chat): keep user-message actions on hover for touch screens

Always showing Copy / Edit from here / New session at 44px under every
user message on phones is a separate design change from deferring the
history-edit branch, and it costs a lot of vertical space per turn. A tap
on the message already reveals the actions (mobile browsers emulate
mouseenter on tap), so leave that layout as it is here.

This reverts commit 8931c5a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

---------

Co-authored-by: wayne.luo <[email protected]>
Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

「从此处编辑」后无法取消,刷新后其后整段对话从视图消失

2 participants