Repository navigation
fix(desktop): keep a taken-over remote conversation named, and close its writes - #1340
Merged
Merged
Conversation
…its writes Another paired device taking a machine over is a reversible state, not the end of the conversation: the transcript had already been read, and taking control back restores everything. What was wrong was what the state did to the screen. The header lost its title. A conversation is named by the host's catalogue, and a standby client is sent no snapshots and is refused every read, so every row of that host leaves the catalogue — `useRemotePeers` drops them, and has to — and the title fell back to the session id, turning a conversation the reader was in the middle of into `20261022-164713-ea5b…`. The last title and workspace name seen are now remembered per desktop+session (`remoteConversationIdentity`) and read back when the catalogue no longer carries them: display only, the catalogue still wins whenever it has a row, and a conversation never seen still falls back to its id. The same memory covers a failed read, which empties the rows for a round and must not rename anything either. What the state did not do was say so, or stop the writes. The phone put that sentence beside its composer long ago; the desktop offered a send button that ended in the host's own `superseded` refusal. So the conversation now draws the notice (holder's name, "nothing sent from here will arrive", and the takeover the device picker already sends), and the writes it would have lost are closed before they are sent: send, attachment staging, `/compact`, fork, continue and the approval buttons, each with the reason beside it. Nothing exits the conversation: a catalogue that blinks, or a machine someone else holds, keeps the reader's place, which is the rule the delete path already followed (`forgetRemoteConversation`).
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.
另一台设备接管某台电脑后,桌面端正打开着的那条远程会话会失去名字、却仍显示成可写。这条分支补上桌面端缺的两半:留名,和关掉写入口。
现象与链路
useRemotePeers在 standby 状态下不再收到该主机的 catalogue 快照,于是该主机所有会话行消失(这是对的:standby 设备本就不该收到快照)。而桌面端的标题只有一个来源——AppShell从 catalogue 行取session.title,取不到就退化成sessionId:20261022-164713-ea5b…,工作区限定名一起消失;useRemoteTimeline的窗口级快照,不依赖 catalogue 行);superseded拒绝。即「只读又半失效」:读得下去,但不知道自己在读哪条;写不进去,但界面不说为什么。
改动
1. 标题按
desktopId + sessionId记住 —— 新模块remoteConversationIdentity.tscatalogue 仍是权威(改名要能落地),但最后见到的
title/workspaceName会按「主机 + 会话」记住(同一 session id 在另一台主机上是另一条会话,所以键要带desktopId)。读顺序:catalogue 行 → 记住的名字 →sessionId(从未见过标题的会话仍退化成 id,而不是空标题)。2. 会话内横幅 + 取回入口 —— 新组件
RemoteStandbyNotice.tsxcontrol === "standby"时在 composer 上方画一行提示(复用AgentThread的ConnectionNotice同一套warning配色与右置按钮),写明「本机已被 <谁> 接管、从这里发出的内容不会送达」,并给「接管回来」按钮。该按钮走的是设备选择器/远程页同一个takeover命令(AppShell里抽出的takeOverRemotePeer),成功后重读主机。放在审批卡之前:卡里那个人等着回答的决定,是读者第一眼要去点的地方,得先看到「点不了」这句。
3. 写入口一律关闭并给出原因
RemoteComposer:发送(含 Enter 路径,守卫放在两条路径汇合处)、附件暂存、粘贴文件、/compact(直接从斜杠菜单里去掉,而不是画成灰的——斜杠菜单是「你能要什么」的清单);RemoteConversationView:fork / continue、审批卡的 allow/deny(卡仍保留,只是按钮关掉并在旁边写原因——决定仍然欠着,藏起来会让人以为 run 无缘无故停了)。判定只读
control,不读peerHeld:决定这件事的是 host 自己的control(它在被别的设备持有时拒绝业务命令),链路此刻通不通是另一个问题。太旧、不报control的 host 视为自己在用,与全仓其他地方一致。不采用「自动退出会话」
状态可逆,为一时的读不到而清空阅读位置不划算;且仓里已有「不按 catalogue 缺失判断」的先例(
forgetRemoteConversation的注释专门写了这点,因为网络抖动时 catalogue 也会缺);手机端StandbyNotice.tsx早就选择了留在会话里。回归
AppShell.test.tsx的用例锁住,是上面那个先例要防的东西;control缺失(旧 host)不得关闭任何写入口;chrome === "full"下出现(面板格子里没有 composer)。范围
纯 desktop TS,无 Rust、无
cargo/make build。手机端已有StandbyNotice,本次不动;若手机端也存在「standby 时按钮仍可按」的问题,另开单。i18n 新增
heldTitle/heldTitleUnknown/heldCannotSend/heldSendBlocked/heldApprovalBlocked(en + zh)。