Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix: remove explicit queue action from chat input (#10738)
Bohan Jiangff41e7a77010
diff --git a/apps/docs/content/docs/chat.mdx b/apps/docs/content/docs/chat.mdxindex b69f5858fe..b40a09398a 100644--- a/apps/docs/content/docs/chat.mdx+++ b/apps/docs/content/docs/chat.mdx@@ -98,7 +98,7 @@ If the agent hadn't produced anything yet, the message you just sent is taken baYou can keep typing while the agent is replying. **Send** adds a plain text message to the current reply without stopping it, when the runtime supports steering. The agent reads it at its next safe boundary and continues the original task. Upgrade your daemon to enable this.-Use **Queue message** beside Send to save a message for the next turn instead. Messages with attachments, and messages sent before a reply starts or to a runtime without steering support, also enter the queue. If guidance is not delivered before the reply ends, it automatically becomes a queued message; you do not need to resend it. If you stop while delivery is in progress, Chat waits for its result before queuing undelivered guidance. If the reply is retried automatically, guidance stays with the original request so both are processed together. When resuming the same session, guidance already delivered there is not sent again.+Messages with attachments, and messages sent before a reply starts or to a runtime without steering support, enter the queue. If guidance is not delivered before the reply ends, it automatically becomes a queued message; you do not need to resend it. If you stop while delivery is in progress, Chat waits for its result before queuing undelivered guidance. If the reply is retried automatically, guidance stays with the original request so both are processed together. When resuming the same session, guidance already delivered there is not sent again.Queued messages appear above the input and run in order. You can remove them, use **⋯ → Edit queued message** to restore them to the input, or **⋯ → Clear all** to withdraw them. **Send now (stops current reply)** moves a queued message to the front and stops the current reply. It requires an active reply and permission to run the agent.diff --git a/apps/docs/content/docs/chat.zh.mdx b/apps/docs/content/docs/chat.zh.mdxindex 88fac7f7c1..202292f714 100644--- a/apps/docs/content/docs/chat.zh.mdx+++ b/apps/docs/content/docs/chat.zh.mdx@@ -98,7 +98,7 @@ import { ChatDemo } from "@/components/demos/chat-demo";智能体还在回复时,可以继续输入。运行时支持插话时,点**发送**会把纯文本消息插入当前回复,不会停止运行;智能体在下一个安全时机读到消息,继续完成原任务。需要升级 daemon 才能启用。-想留到下一轮,点发送旁边的**排队发送**。带附件的消息、回复尚未开始时发送的消息,以及不支持插话的运行,都会进入队列。如果插话在当前回复结束前没送达,会自动转成排队消息,无需重发。投递过程中点停止,会先等待投递结果,再将未送达的插话排队。如果回复自动重试,插话会保留在原请求中,一起处理;恢复同一会话时,已送达的插话不会再次发送。+带附件的消息、回复尚未开始时发送的消息,以及不支持插话的运行,都会进入队列。如果插话在当前回复结束前没送达,会自动转成排队消息,无需重发。投递过程中点停止,会先等待投递结果,再将未送达的插话排队。如果回复自动重试,插话会保留在原请求中,一起处理;恢复同一会话时,已送达的插话不会再次发送。排队消息显示在输入框上方,按顺序处理。可以删除,通过 **⋯ → 编辑排队消息** 放回输入框,或用 **⋯ → 全部清空** 撤回。**立即发送(停止当前回复)** 会把排队消息提到队首,并停止当前回复;需要当前回复已开始,且你有运行该智能体的权限。diff --git a/packages/views/chat/components/chat-input.test.tsx b/packages/views/chat/components/chat-input.test.tsxindex 19bac4f08c..b05e1594e5 100644--- a/packages/views/chat/components/chat-input.test.tsx+++ b/packages/views/chat/components/chat-input.test.tsx@@ -994,7 +994,7 @@ describe("ChatInput project context", () => {expect(onProjectChange).toHaveBeenCalledWith(null);});- it("offers default Send and an explicit queue action while replying", async () => {+ it("offers a single Send action while replying and restores Stop after sending", async () => {const onSend = vi.fn<ChatInputOnSend>(async () => true);const onStop = vi.fn();renderInput({ isRunning: true, allowSubmitWhileRunning: true, onSend, onStop });@@ -1008,12 +1008,11 @@ describe("ChatInput project context", () => {expect(screen.queryByRole("button", { name: "Stop" })).not.toBeInTheDocument();expect(screen.getByRole("button", { name: "Send" })).not.toBeDisabled();- const queueButton = screen.getByRole("button", { name: "Queue message" });- expect(queueButton).not.toBeDisabled();- fireEvent.click(queueButton);+ expect(screen.queryByRole("button", { name: "Queue message" })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Send" }));await waitFor(() => expect(onSend).toHaveBeenCalledTimes(1));- expect(onSend.mock.calls[0]?.[4]).toEqual({ queue: true });+ expect(onSend).toHaveBeenCalledWith("follow-up", undefined, expect.any(Function), []);await waitFor(() => {expect(screen.getByRole("button", { name: "Stop" })).toBeInTheDocument();});@@ -1026,7 +1025,7 @@ describe("ChatInput project context", () => {fireEvent.change(screen.getByTestId("editor"), { target: { value: "use the new location" } });fireEvent.click(screen.getByRole("button", { name: "Send" }));await waitFor(() => expect(onSend).toHaveBeenCalledTimes(1));- expect(onSend.mock.calls[0]?.[4]).toBeUndefined();+ expect(onSend).toHaveBeenCalledWith("use the new location", undefined, expect.any(Function), []);});it("keeps Stop available while queued content is uploading", async () => {@@ -1040,7 +1039,7 @@ describe("ChatInput project context", () => {fireEvent.change(screen.getByTestId("editor"), {target: { value: "follow-up with attachment" },});- expect(screen.getByRole("button", { name: "Queue message" })).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Send" })).not.toBeDisabled();await act(async () => {dropHandlers.onDrop?.([@@ -1065,7 +1064,7 @@ describe("ChatInput project context", () => {await Promise.resolve();});- expect(await screen.findByRole("button", { name: "Queue message" })).not.toBeDisabled();+ expect(await screen.findByRole("button", { name: "Send" })).not.toBeDisabled();});it("shows only Stop while an older server is running", () => {diff --git a/packages/views/chat/components/chat-input.tsx b/packages/views/chat/components/chat-input.tsxindex ec63390a72..556064603a 100644--- a/packages/views/chat/components/chat-input.tsx+++ b/packages/views/chat/components/chat-input.tsx@@ -2,7 +2,7 @@import type { ReactNode } from "react";import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";-import { ListEnd, Scan, TriangleAlert, X } from "@multica/ui/icons";+import { Scan, TriangleAlert, X } from "@multica/ui/icons";import { IconButton } from "@multica/ui/components/common/icon-button";import { toast } from "sonner";import { cn } from "@multica/ui/lib/utils";@@ -76,7 +76,6 @@ interface ChatInputProps {attachmentIds: string[] | undefined,commitInput: (options?: { extraDraftKeys?: string[]; clearEditor?: boolean }) => void,draftAttachments: Attachment[],- options?: { queue?: boolean },) => void | boolean | Promise<void | boolean>;restoreDraftRequest?: {id: string;@@ -494,7 +493,6 @@ export function ChatInput({// stale `true` behind for the next one.const editorScrubbedRef = useRef(false);- const queueNextSendRef = useRef(false);const { submitting, submit } = useComposerSubmit({editorRef,uploadGate: gate,@@ -510,8 +508,6 @@ export function ChatInput({return hasReplyIntent(raw, current) ? composeAnnotatedReply(raw, current) : "";},onSubmit: async (content: string): Promise<boolean> => {- const queue = queueNextSendRef.current;- queueNextSendRef.current = false;editorScrubbedRef.current = false;// Same tick as `normalize`, so this is exactly what `content` quotes.const annotationKeyAtSend = annotationDraftKey;@@ -626,9 +622,7 @@ export function ChatInput({commitInput,draftAttachments.filter((attachment) => uniqueActiveIds.includes(attachment.id)),] as const;- const accepted = queue- ? await onSend(...sendArgs, { queue: true })- : await onSend(...sendArgs);+ const accepted = await onSend(...sendArgs);// Owner rejected the send (or threw, which useComposerSubmit also treats// as a rejection): the draft was never committed, so it stays put for// retry. Only a commit — here or by the owner — clears it.@@ -921,19 +915,6 @@ export function ChatInput({<Scan /></IconButton>)}- {isRunning && allowSubmitWhileRunning && !hasNothingToSend && !gate.uploading && (- <IconButton- type="button"- label={t(($) => $.input.queue_send_tooltip)}- disabled={submitting || gate.uploading || !!disabled || !!noAgent}- onClick={() => {- queueNextSendRef.current = true;- void submit().finally(() => { queueNextSendRef.current = false; });- }}- >- <ListEnd />- </IconButton>- )}<SubmitButtononClick={submit}disabled={hasNothingToSend || submitting || !!disabled || !!noAgent}