Repository navigation
fix(chat): send a queued follow-up with the steer shortcut - #1921
Conversation
A follow-up queued while the turn is running leaves the composer empty, so Alt+Enter found no draft and silently did nothing: the only way to promote that row was its Send now button. With an empty composer the shortcut now promotes the first waiting row through the same store action, so keyboard and pointer reach the same Host delivery path. Rows still awaiting Host admission and already promoted rows are skipped, a visible draft keeps taking precedence over the queue, and a blocked composer promotes nothing.
Readers of the Send now rules should not have to reach §3.5 to learn that the keyboard equivalent exists.
|
CI 里只有 也就是 #1751 那类「探针在 xvfb 下卡住、靠 SIGKILL 兜底」的基础设施超时,和本 PR 的改动(renderer 里 composer 提交路径 + 一份 spec)没有交集。依据:
我没有这个仓库的 actions 权限( |
muzimu217
left a comment
There was a problem hiding this comment.
Checked the new branch against the row button it is meant to stand in for, and the eligibility matches exactly.
ComposerStatus.tsx:62 computes sendNowLocked = approvalPending || actionsLocked, where actionsLocked = promoted || pending (:61). The shortcut path requires steering && !sendBlocked, and sendBlocked is approvalPending || pasting || nativeInputBlocked (Composer.tsx:249), while nextSendableQueuedPrompt skips pending: ids and rows carrying priority (lib/queued-prompts.ts:54-63). So the shortcut promotes precisely the row whose own button would be enabled — no divergence to drift apart later.
Two details that make the change safe in the ways it could have gone wrong:
serializedContentisserializeComposerFileReferences(rawText, activeFileReferences), so a draft holding only an image chip still serializes to a non-empty@path. The new empty branch therefore cannot swallow an attachment-only send; it only runs when the composer is genuinely empty.- The new branch sits after
serializedContentis computed but before the rest of the submit path, and it inheritssendBlocked, so pasting and native-input blocking keep behaving as they do for a normal send.
One question, not a defect: the new branch does not consult steeringAllowed (sessionAllows(capabilitySession, "canSteer")), while the non-empty path does. On a session that cannot steer, Alt+Enter with an empty composer will now promote a queued row where it previously did nothing. That may be exactly what you intend — the row's own Send now is not gated on canSteer either, and the Host decides delivery — but the spec text you added says "the steering shortcut ... promotes the first waiting row" without mentioning the capability, so either gate the branch on steeringAllowed or state in §3.5 that the shortcut degrades to "send the next queued follow-up" when steering is unavailable. The second reading seems more useful to me, and it is the one your current code implements; it just needs the sentence.
…bility The empty-composer shortcut mirrors the row's Send now, which is not gated on canSteer; the Host decides delivery. Say so, so the spec does not read as if the shortcut only works where steering is available.
|
Thanks. I kept the current behavior, so the shortcut is not gated on I also merged the latest |
Exercise the submit hook through its public boundary so the shortcut behavior is proven for empty, blocked, and populated drafts.
fixes #1920
问题
后续消息排队后草稿已被清空,
⌥/Alt+Enter(§3.5 的「立即转向」)找不到草稿就静默返回,等于键盘路径断裂,只能鼠标点队列行的「立即发送」。改动
useComposerSubmit:草稿序列化后为空时,若本次是转向提交且发送未被拦,就把队列中第一条可发送的行交给sendQueuedNow——和行内「立即发送」按钮走完全相同的 store → Host 链路(Host 决定投递为 steering 还是继续排队),不新增 IPC,也不绕过权限/审批。lib/queued-prompts.ts新增纯函数nextSendableQueuedPrompt:跳过等待 Host admission 的pending:行和已提升的行,连按依次提升下一条。sendBlocked(等待审批 / 粘贴中 / 原生输入被拦)时不提升任何行。验证
apps/desktop/test/composer-queued-send-now-shortcut.test.mjs:真实执行nextSendableQueuedPrompt(跳过 pending / promoted / 空队列),并锁定 hook 的转向分支与 Composer 的接线(不可退化为sendPrompt)。pnpm --filter @pi-desktop/desktop test:4427 tests / 0 fail / 3 skipped。pnpm build:js、pnpm --filter @pi-desktop/desktop typecheck、pnpm lint:biome、node scripts/check-architecture.mjs、node scripts/check-style-tokens.mjs、docs check:docs均通过。⌥+Enter,首行变为「等待发送」并进入当前轮;带草稿时仍只推送草稿。未跑:Electron UI E2E(
verify:ui:*/test:e2e:*),按仓库规则需维护者明确要求;本改动不涉及持久化、IPC 协议或权限边界,docs/spec/06-delivery/04-e2e-test-plan.md的 E2E-011f 已补步骤 13/14 待正式 UI 场景执行。