Repository navigation
Conversation
"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.
Kano-u
added a commit
to Kano-u/pi-web
that referenced
this pull request
Sep 26, 2026
Owner
|
Thanks @uvforce! #958 is real, and deferring the branch until send is the right fix. It's better than navigating back on Cancel, for the reload reason you gave. I couldn't push to your fork, so it continues in #1009 with your commits kept, plus two changes:
Closing in favor of #1009. Generated by Claude Code |
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 上游关闭但本地保留,状态注明为永久分叉。
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.
Fixes #958.
Problem
"Edit from here" calls
navigate_treeas soon as it is clicked. For a user message, pi moves the session leaf to that message's parent and persists the move, so the session is already on the new branch before the user has decided to send anything.replaceMessagerefuses to overwrite it, but the navigation has already happened.Fix
Branch only when the edit is actually sent.
useAgentSession. No RPC is sent. If the composer already has text or images, nothing happens:replaceMessagenow reports whether it prefilled, and the edit starts only when it did.promptpath. If the navigation fails, the draft and the pending edit are restored and no prompt is sent.ChatWindowonly rewires the hook callbacks.MessageViewno longer receivesonNavigate; the edit button is shown whenonEditContentis present.Known limitation
Navigation and the prompt are still two RPCs. If the prompt is rejected after the navigation succeeded, the leaf stays on the new branch; making both atomic needs a server-side change and is out of scope here.
Alternative considered
The patch attached to #958 keeps the navigation on click and adds a Cancel that navigates back to the previous leaf. That still loses the view if the page is reloaded, closed or crashes before Cancel, and navigating back to a user-message leaf lands on its parent again, because
navigateTreetreats a user message as "edit from here".Verification
npm test(1308/1308),tsc --noEmitandnpm run lintpass on this branch. A new source test covers the click, Cancel and send paths./api/agentrequests intercepted: a rejectednavigate_treerestores the edited text and the banner without sending a prompt; a successful send issuesnavigate_treeand thenprompt, in that order.