Repository navigation
fix(remote): keep send out of the composer while a run is still going - #1330
Merged
Merged
Conversation
The remote composer handed Send back as soon as the field had text, while the host answers one prompt at a time and refuses a second with 'This session is still running; wait for it to finish or abort it first'. That refusal lands after the prompt is written down, so the press became an error over a message the reader meant to send. Stop now replaces Send for as long as the run streams, whatever the field holds -- the local composer's rule and the phone's, which both block sending while a reply is in flight -- and Enter meets the same guard inside send(), where the button and the key meet. A draft typed meanwhile stays in the field and goes once the run settles. The screenshot scenario that watches a streamed run now types a follow-up mid-run and asserts the composer offers Stop and no Send; it fails with the previous condition.
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.
问题
远程会话的输入框在运行中只要输入框里有文字,就把「发送」重新换出来。注释的理由是不想让用户的下一条消息丢掉,但 host 一次只回答一个 prompt:第二条会以
This session is still running; wait for it to finish or abort it first被拒,而且拒绝发生在 prompt 已经写入之后,于是每发一次都会在 host 上留下一条永远不会被回答的孤儿 prompt。改动
desktop/src/features/remote-peer/RemoteComposer.tsx运行中只保留停止(abort);点击停止、或它本轮结束之后才重新可以发送。Enter 走同一个
send(),因此键盘路径也一起被拦住;草稿保留——可以随时回来的地方在,只是暂时不能发。判定收在 Composer 自己的canSend上,而不是让调用方各自判一遍。验证
RemoteComposer.test.tsx:流式期间的 Send 按钮、Enter 提交、草稿保留三个行为各加了断言(+35 行)。remote-streaming场景:先发一轮再敲一句,断言只有 Stop、没有 Send、草稿还在。改前跑该场景是红的(a run in flight still offers Send),改后绿。tsc --noEmit、eslint(remote-peer/layout/i18n)、1697 个前端测试全绿。分支说明
dev-huichen已 rebase 到origin/main(b51c05d8)之上,本 PR 只含 2 个提交、3 个文件。上游pr/huichen是上一版 #1329 的冻结分支(已随 squash 合并失效),更新它需要强推,交由仓库所有者决定。