Skip to content

fix(remote): keep send out of the composer while a run is still going - #1330

Merged
huichen merged 2 commits into
mainfrom
dev-huichen
Oct 23, 2026
Merged

huichen merged 2 commits into
mainfrom
dev-huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

问题

远程会话的输入框在运行中只要输入框里有文字,就把「发送」重新换出来。注释的理由是不想让用户的下一条消息丢掉,但 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 行)。
  • 截图 harness 新增 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 合并失效),更新它需要强推,交由仓库所有者决定。

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.
@huichen
huichen merged commit 9732bf9 into main Oct 23, 2026
10 checks passed
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.

1 participant