Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix: deliver Chat steering and show current-run hint (MUL-9410) (#10743)
Bohan Jianga1b8052d8f2a
diff --git a/apps/docs/content/docs/chat.fr.mdx b/apps/docs/content/docs/chat.fr.mdxindex 645911974a..a21f59a9e5 100644--- a/apps/docs/content/docs/chat.fr.mdx+++ b/apps/docs/content/docs/chat.fr.mdx@@ -98,7 +98,9 @@ Si l'agent n'avait encore rien produit, le message que vous venez d'envoyer estVous pouvez écrire pendant que l’agent répond. Si le runtime le permet, **Envoyer** ajoute un message texte à la réponse en cours sans arrêter l’exécution. L’agent le lit au prochain moment approprié et poursuit la tâche initiale. Mettez votre daemon à jour pour activer cette fonction.-Pour attendre le prochain tour, utilisez **Mettre le message en file d’attente** à côté d’Envoyer. Les pièces jointes, les messages envoyés avant le début de la réponse et les runtimes incompatibles utilisent aussi la file. Un message non transmis avant la fin de la réponse rejoint automatiquement la file ; inutile de le renvoyer. Si vous arrêtez pendant la transmission, Chat attend son résultat avant de mettre les messages non transmis en file. En cas de nouvelle tentative automatique, les instructions supplémentaires restent associées à la demande initiale pour être traitées ensemble. Lors de la reprise de la même session, les instructions déjà transmises ne sont pas renvoyées.+Sur le web et sur ordinateur, **Ajouter à l'exécution en cours** au-dessus du brouillon indique que votre texte rejoindra la réponse en cours. **Démarrer après cette exécution** indique que le message sera mis en file, par exemple s'il contient des pièces jointes ou si l'exécution ne prend pas en charge cette fonction.++Les messages avec pièces jointes, envoyés avant le début de la réponse ou à un runtime incompatible sont automatiquement mis en file. Un message non transmis avant la fin de la réponse rejoint automatiquement la file ; inutile de le renvoyer. Si vous arrêtez pendant la transmission, Chat attend son résultat avant de mettre les messages non transmis en file. En cas de nouvelle tentative automatique, les instructions supplémentaires restent associées à la demande initiale pour être traitées ensemble. Lors de la reprise de la même session, les instructions déjà transmises ne sont pas renvoyées.La file apparaît au-dessus du champ de saisie et suit l’ordre des messages. Vous pouvez supprimer un message, le modifier via **⋯**, ou vider la file. **Envoyer maintenant (arrête la réponse)** place le message en tête et arrête la réponse en cours. Cette action nécessite une réponse démarrée et le droit d’exécuter l’agent.diff --git a/apps/docs/content/docs/chat.ja.mdx b/apps/docs/content/docs/chat.ja.mdxindex 79a27c79e2..4ec086282d 100644--- a/apps/docs/content/docs/chat.ja.mdx+++ b/apps/docs/content/docs/chat.ja.mdx@@ -98,7 +98,9 @@ Multica で作成したダイレクトチャットを読めるのは作成者だエージェントの返信中も入力できます。ランタイムが対応していれば、**送信**でテキストを現在の返信に追加できます。実行は停止せず、エージェントは次の安全なタイミングで読み取り、元のタスクを続けます。この機能には daemon の更新が必要です。-次のターンに回すには、送信の横の**キューに追加**を使います。添付ファイル付きのメッセージ、返信開始前のメッセージ、非対応ランタイムへのメッセージもキューに入ります。返信終了までに追加メッセージが届かなかった場合は自動的にキューに戻るので、再送は不要です。配信中に停止した場合、配信結果を待ってから未配信のメッセージをキューに戻します。返信が自動再試行される場合、追加メッセージは元のリクエストと一緒に処理されます。同じセッションを再開する際は、配信済みの追加メッセージを再送しません。+ウェブ版とデスクトップ版では、下書きの上に**現在の実行に追加**と表示されていれば、テキストは現在の返信に追加されます。**この実行の後に開始**は、添付ファイルがある場合や現在の実行が非対応の場合など、メッセージがキューに入ることを示します。++添付ファイル付きのメッセージ、返信開始前のメッセージ、非対応ランタイムへのメッセージは自動的にキューに入ります。返信終了までに追加メッセージが届かなかった場合は自動的にキューに戻るので、再送は不要です。配信中に停止した場合、配信結果を待ってから未配信のメッセージをキューに戻します。返信が自動再試行される場合、追加メッセージは元のリクエストと一緒に処理されます。同じセッションを再開する際は、配信済みの追加メッセージを再送しません。キューは入力欄の上に表示され、順番に処理されます。削除、**⋯** からの編集や全消去も可能です。**今すぐ送信(現在の返信を停止)** はキュー内のメッセージを先頭に移し、現在の返信を停止します。返信が開始済みで、実行権限が必要です。diff --git a/apps/docs/content/docs/chat.ko.mdx b/apps/docs/content/docs/chat.ko.mdxindex 3004a70989..d2c07e1aa2 100644--- a/apps/docs/content/docs/chat.ko.mdx+++ b/apps/docs/content/docs/chat.ko.mdx@@ -98,7 +98,9 @@ Multica에서 만든 직접 대화는 만든 사람만 읽을 수 있고, 다른에이전트가 응답하는 동안에도 입력할 수 있습니다. 런타임이 지원하면 **보내기**로 텍스트 메시지를 현재 응답에 추가합니다. 실행을 중지하지 않으며 에이전트가 다음 안전한 시점에 읽고 원래 작업을 계속합니다. 사용하려면 daemon을 업그레이드하세요.-다음 차례에 처리하려면 보내기 옆의 **대기열에 추가**를 사용하세요. 첨부 파일이 있는 메시지, 응답 시작 전의 메시지, 미지원 런타임에 보내는 메시지도 대기열에 들어갑니다. 현재 응답이 끝날 때까지 전달되지 않은 메시지는 자동으로 대기열로 이동하므로 다시 보낼 필요가 없습니다. 전달 중에 중지하면 전달 결과를 기다린 후 미전달 메시지를 대기열에 넣습니다. 응답을 자동으로 재시도하면 추가 메시지도 원래 요청과 함께 처리됩니다. 같은 세션을 재개할 때 이미 전달된 추가 메시지는 다시 보내지 않습니다.+웹과 데스크톱에서는 초안 위의 **현재 실행에 추가**가 텍스트를 현재 응답에 추가한다는 뜻입니다. **이번 실행 후 시작**은 첨부 파일이 있거나 현재 실행이 지원하지 않는 경우처럼 메시지가 대기열에 들어간다는 뜻입니다.++첨부 파일이 있는 메시지, 응답 시작 전의 메시지, 미지원 런타임에 보내는 메시지는 자동으로 대기열에 들어갑니다. 현재 응답이 끝날 때까지 전달되지 않은 메시지는 자동으로 대기열로 이동하므로 다시 보낼 필요가 없습니다. 전달 중에 중지하면 전달 결과를 기다린 후 미전달 메시지를 대기열에 넣습니다. 응답을 자동으로 재시도하면 추가 메시지도 원래 요청과 함께 처리됩니다. 같은 세션을 재개할 때 이미 전달된 추가 메시지는 다시 보내지 않습니다.대기열은 입력창 위에 표시되며 순서대로 처리됩니다. 삭제하거나 **⋯** 에서 편집 또는 전체 삭제할 수 있습니다. **지금 보내기 (현재 응답 중지)** 는 메시지를 맨 앞으로 옮기고 현재 응답을 중지합니다. 응답이 시작된 상태이고 에이전트 실행 권한이 있어야 합니다.diff --git a/apps/docs/content/docs/chat.mdx b/apps/docs/content/docs/chat.mdxindex b40a09398a..b1a51d49fd 100644--- a/apps/docs/content/docs/chat.mdx+++ b/apps/docs/content/docs/chat.mdx@@ -98,6 +98,8 @@ 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.+On web and desktop, **Add to current run** above your draft means your text will join the running reply. **Start after this run** means the message will be queued, for example when it has files or the current run doesn't support steering.+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-Hant.mdx b/apps/docs/content/docs/chat.zh-Hant.mdxindex 367d8dfa51..7b67feefc9 100644--- a/apps/docs/content/docs/chat.zh-Hant.mdx+++ b/apps/docs/content/docs/chat.zh-Hant.mdx@@ -98,7 +98,9 @@ AI 代理執行時,介面會顯示當前階段和工具活動。展開**檢視智能體仍在回覆時,可以繼續輸入。執行階段支援插話時,按**傳送**會把純文字訊息加入目前回覆,不會停止執行;智能體在下一個安全時機讀到訊息,繼續完成原任務。需要升級 daemon 才能啟用。-想留到下一輪,按傳送旁的**排隊傳送**。含附件的訊息、回覆尚未開始時傳送的訊息,以及不支援插話的執行,都會進入佇列。插話若未在目前回覆結束前送達,會自動轉成排隊訊息,無需重送。投遞過程中按停止,會先等待投遞結果,再將未送達的插話排隊。如果回覆自動重試,插話會保留在原請求中,一起處理;恢復同一會話時,已送達的插話不會再次傳送。+在網頁版和桌面版,輸入時顯示的**插話到當前執行**表示文字會加入目前回覆;**本輪結束後開始**表示訊息會排隊,例如帶有附件或目前執行不支援插話時。++含附件的訊息、回覆尚未開始時傳送的訊息,以及不支援插話的執行,都會自動進入佇列。插話若未在目前回覆結束前送達,會自動轉成排隊訊息,無需重送。投遞過程中按停止,會先等待投遞結果,再將未送達的插話排隊。如果回覆自動重試,插話會保留在原請求中,一起處理;恢復同一會話時,已送達的插話不會再次傳送。佇列顯示在輸入框上方,依序處理。可以移除、透過 **⋯ → 編輯排隊訊息** 放回輸入框,或用 **⋯ → 全部清空** 撤回。**立即傳送(停止目前回覆)** 會將訊息移到最前並停止目前回覆;需要回覆已開始,且你有執行該智能體的權限。diff --git a/apps/docs/content/docs/chat.zh.mdx b/apps/docs/content/docs/chat.zh.mdxindex 202292f714..33cfb7cead 100644--- a/apps/docs/content/docs/chat.zh.mdx+++ b/apps/docs/content/docs/chat.zh.mdx@@ -98,6 +98,8 @@ import { ChatDemo } from "@/components/demos/chat-demo";智能体还在回复时,可以继续输入。运行时支持插话时,点**发送**会把纯文本消息插入当前回复,不会停止运行;智能体在下一个安全时机读到消息,继续完成原任务。需要升级 daemon 才能启用。+在网页端和桌面端,输入时显示的**插话到当前运行**表示文字会加入当前回复;**本轮结束后开始**表示消息会排队,例如带有附件或当前运行不支持插话时。+带附件的消息、回复尚未开始时发送的消息,以及不支持插话的运行,都会进入队列。如果插话在当前回复结束前没送达,会自动转成排队消息,无需重发。投递过程中点停止,会先等待投递结果,再将未送达的插话排队。如果回复自动重试,插话会保留在原请求中,一起处理;恢复同一会话时,已送达的插话不会再次发送。排队消息显示在输入框上方,按顺序处理。可以删除,通过 **⋯ → 编辑排队消息** 放回输入框,或用 **⋯ → 全部清空** 撤回。**立即发送(停止当前回复)** 会把排队消息提到队首,并停止当前回复;需要当前回复已开始,且你有运行该智能体的权限。diff --git a/apps/docs/content/docs/mentioning-agents.fr.mdx b/apps/docs/content/docs/mentioning-agents.fr.mdxindex 84d0f9bffb..54b1ae9435 100644--- a/apps/docs/content/docs/mentioning-agents.fr.mdx+++ b/apps/docs/content/docs/mentioning-agents.fr.mdx@@ -67,7 +67,7 @@ Après l'envoi, le commentaire affiche d'abord « En attente de lecture par …- Seul du texte peut rejoindre une exécution en cours. Un message avec des pièces jointes est traité après la fin de l'exécution.- La réorientation doit être prise en charge par l'outil de codage IA de l'agent. Sinon, « Ajouter à l'exécution en cours » n'est pas proposé.- Le choix par défaut se règle dans **Paramètres → Préférences**, sous **En répondant à un agent en cours d'exécution**. Vous pouvez toujours le modifier pour chaque message avant l'envoi.-- Dans un Chat compatible, envoyer un texte pendant une réponse l’ajoute à cette réponse sans l’arrêter. Utilisez **Mettre le message en file d’attente** pour le prochain tour ; voir [Chat](/chat#envoyer-des-messages-pendant-une-réponse).+- Dans un Chat compatible, envoyer un texte pendant une réponse l’ajoute à cette réponse sans l’arrêter. Les messages avec pièces jointes, envoyés avant le début de la réponse ou à un runtime incompatible sont automatiquement mis en file ; voir [Chat](/chat#envoyer-des-messages-pendant-une-réponse).## Regroupement des commentaires consécutifsdiff --git a/apps/docs/content/docs/mentioning-agents.ja.mdx b/apps/docs/content/docs/mentioning-agents.ja.mdxindex 012ba18309..756b230a00 100644--- a/apps/docs/content/docs/mentioning-agents.ja.mdx+++ b/apps/docs/content/docs/mentioning-agents.ja.mdx@@ -67,7 +67,7 @@ import { SteerDemo } from "@/components/demos/steer-demo";- 実行中に追加できるのはテキストだけです。ファイル付きのメッセージは、この実行の後に処理されます。- 割り込みには、エージェントが使う AI コーディングツールの対応が必要です。対応していない場合、「現在の実行に追加」は選択肢に表示されません。- 既定の選択肢は **設定 → 環境設定** の **実行中のエージェントに返信するとき** で変えられます。メッセージごとに送信前に変更することもできます。-- 対応する Chat の返信中にテキストを送信すると、実行を止めずに現在の返信に追加します。次のターンに回すには**キューに追加**を使います。[チャット](/chat#返信中に続けてメッセージを送る)を参照してください。+- 対応する Chat の返信中にテキストを送信すると、実行を止めずに現在の返信に追加します。添付ファイル付きのメッセージ、返信開始前のメッセージ、非対応ランタイムへのメッセージは自動的にキューに入ります。[チャット](/chat#返信中に続けてメッセージを送る)を参照してください。## 連続コメントの統合diff --git a/apps/docs/content/docs/mentioning-agents.ko.mdx b/apps/docs/content/docs/mentioning-agents.ko.mdxindex 4f42679f34..fa3d3f6ede 100644--- a/apps/docs/content/docs/mentioning-agents.ko.mdx+++ b/apps/docs/content/docs/mentioning-agents.ko.mdx@@ -67,7 +67,7 @@ import { SteerDemo } from "@/components/demos/steer-demo";- 실행 중에는 텍스트만 추가할 수 있습니다. 첨부 파일이 있는 메시지는 이번 실행이 끝난 뒤 처리됩니다.- 끼어들기는 에이전트가 쓰는 AI 코딩 도구가 지원해야 합니다. 지원하지 않으면 '현재 실행에 추가'가 옵션에 나오지 않습니다.- 기본 옵션은 **설정 → 환경설정**의 **실행 중인 에이전트에 답장할 때**에서 바꿀 수 있고, 메시지마다 보내기 전에 따로 바꿀 수도 있습니다.-- 지원되는 Chat 응답 중에 텍스트를 보내면 실행을 중지하지 않고 현재 응답에 추가합니다. 다음 차례에 처리하려면 **대기열에 추가**를 사용하세요. [채팅](/chat#답변-중에-메시지-이어서-보내기)을 참고하세요.+- 지원되는 Chat 응답 중에 텍스트를 보내면 실행을 중지하지 않고 현재 응답에 추가합니다. 첨부 파일이 있거나 응답이 아직 시작되지 않았거나 런타임이 지원하지 않는 경우에는 메시지가 자동으로 대기열에 들어갑니다. [채팅](/chat#답변-중에-메시지-이어서-보내기)을 참고하세요.## 연속 댓글 합치기diff --git a/apps/docs/content/docs/mentioning-agents.mdx b/apps/docs/content/docs/mentioning-agents.mdxindex a3d27da0a8..45cb6fa39f 100644--- a/apps/docs/content/docs/mentioning-agents.mdx+++ b/apps/docs/content/docs/mentioning-agents.mdx@@ -67,7 +67,7 @@ After you send, the comment shows "Waiting for … to read it", which changes to- Only text can join a running run. A message with attachments is handled after the run ends.- Steering needs support from the agent's AI coding tool. Without it, **Add to current run** isn't offered.- Set the default in **Settings → Preferences** under **When replying to a running agent**. You can still change it for any message before sending.-- In Chat, sending a text message during a supported reply steers that reply without stopping it. Use **Queue message** to wait for the next turn; see [Chat](/chat#send-messages-while-a-reply-is-in-progress).+- In Chat, sending a text message during a supported reply steers that reply without stopping it. Messages with attachments, messages sent before the reply starts, and messages sent to runtimes without steering support are queued automatically; see [Chat](/chat#send-messages-while-a-reply-is-in-progress).## Coalescing consecutive commentsdiff --git a/apps/docs/content/docs/mentioning-agents.zh-Hant.mdx b/apps/docs/content/docs/mentioning-agents.zh-Hant.mdxindex 4c4257e4d5..9c239ed0d9 100644--- a/apps/docs/content/docs/mentioning-agents.zh-Hant.mdx+++ b/apps/docs/content/docs/mentioning-agents.zh-Hant.mdx@@ -67,7 +67,7 @@ AI 代理做到一半、方向不對時,不必停下來重來。在評論框- 插話只支援文字。帶附件的訊息會在本輪結束後處理。- 插話需要 AI 代理使用的 AI 程式設計工具支援;不支援時,選項裡不會出現"插話到當前執行"。- 預設選項在設定的**回覆正在執行的 AI 代理時**中調整,每條訊息傳送前仍可單獨修改。-- 一般 Chat 支援插話時,回覆中直接傳送文字就會加入目前回覆,不會停止執行;也可以選擇**排隊傳送**留到下一輪,見[聊天](/chat#回覆還沒結束時繼續發訊息)。+- 一般 Chat 支援插話時,回覆中直接傳送文字就會加入目前回覆,不會停止執行。帶附件、回覆尚未開始或執行階段不支援插話時,訊息會自動排隊,見[聊天](/chat#回覆還沒結束時繼續發訊息)。## 連續評論的合併diff --git a/apps/docs/content/docs/mentioning-agents.zh.mdx b/apps/docs/content/docs/mentioning-agents.zh.mdxindex debc351293..9ecff40b4c 100644--- a/apps/docs/content/docs/mentioning-agents.zh.mdx+++ b/apps/docs/content/docs/mentioning-agents.zh.mdx@@ -67,7 +67,7 @@ import { SteerDemo } from "@/components/demos/steer-demo";- 插话只支持文字。带附件的消息会在本轮结束后处理。- 插话需要智能体使用的 AI 编程工具支持;不支持时,选项里不会出现"插话到当前运行"。- 默认选项在设置的**回复正在运行的智能体时**中调整,每条消息发送前仍可单独修改。-- 普通 Chat 支持插话时,回复中直接发送文本就会插入当前回复,不会停止运行;也可以选择**排队发送**留到下一轮,见[聊天](/chat#回复还没结束时继续发消息)。+- 普通 Chat 支持插话时,回复中直接发送文字就会加入当前回复,不会停止运行。带附件、回复尚未开始或运行时不支持插话时,消息会自动排队,见[聊天](/chat#回复还没结束时继续发消息)。## 连续评论的合并diff --git a/packages/core/api/schemas.test.ts b/packages/core/api/schemas.test.tsindex 4abc80e884..9d40749e41 100644--- a/packages/core/api/schemas.test.ts+++ b/packages/core/api/schemas.test.ts@@ -875,6 +875,13 @@ describe("ChatPendingTaskSchema", () => {status: "running",});expect(parsed.queued_tasks).toBeUndefined();+ expect(parsed.can_supplement).toBeUndefined();+ });++ it("accepts explicit steering capability and ignores malformed values", () => {+ expect(ChatPendingTaskSchema.parse({ can_supplement: true }).can_supplement).toBe(true);+ expect(ChatPendingTaskSchema.parse({ can_supplement: false }).can_supplement).toBe(false);+ expect(ChatPendingTaskSchema.parse({ can_supplement: "yes" }).can_supplement).toBeUndefined();});it("parses queued task summaries", () => {diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.tsindex 58cae25e9b..5dee562816 100644--- a/packages/core/api/schemas.ts+++ b/packages/core/api/schemas.ts@@ -2619,6 +2619,7 @@ export const ChatPendingTaskSchema: z.ZodType<ChatPendingTask> = z.object({status: z.string().optional(),created_at: z.string().optional(),supports_queue: z.boolean().optional(),+ can_supplement: z.boolean().optional().catch(undefined),queued_tasks: ChatQueuedTasksSchema.optional(),}).loose();diff --git a/packages/core/types/chat.ts b/packages/core/types/chat.tsindex 76d2038959..bf62509939 100644--- a/packages/core/types/chat.ts+++ b/packages/core/types/chat.ts@@ -308,6 +308,8 @@ export interface ChatPendingTask {wait_reason?: string;/** Explicit capability gate; absent on servers predating follow-up queues. */supports_queue?: boolean;+ /** This caller can add text to the exact running turn; absent on older servers. */+ can_supplement?: boolean;/*** Ordered follow-ups behind the root task. The root may itself still have* database status `queued` before claim, but is never duplicated here.diff --git a/packages/views/chat/chat-page.tsx b/packages/views/chat/chat-page.tsxindex 8e6001000d..1ce7eae8c3 100644--- a/packages/views/chat/chat-page.tsx+++ b/packages/views/chat/chat-page.tsx@@ -405,6 +405,7 @@ export function ChatPage() {onStop={c.handleStop}isRunning={!!c.pendingTaskId}allowSubmitWhileRunning={c.pendingTask?.supports_queue === true}+ canSteerWhileRunning={c.pendingTask?.can_supplement}disabled={c.isSessionArchived ||c.isAgentArchived ||diff --git a/packages/views/chat/components/chat-input.test.tsx b/packages/views/chat/components/chat-input.test.tsxindex b05e1594e5..b325b4892c 100644--- a/packages/views/chat/components/chat-input.test.tsx+++ b/packages/views/chat/components/chat-input.test.tsx@@ -1028,18 +1028,32 @@ describe("ChatInput project context", () => {expect(onSend).toHaveBeenCalledWith("use the new location", undefined, expect.any(Function), []);});- it("keeps Stop available while queued content is uploading", async () => {+ it("shows whether a draft will join the current run", () => {+ const props = { isRunning: true, allowSubmitWhileRunning: true, canSteerWhileRunning: true };+ const { rerender } = renderInput(props);+ expect(screen.queryByText("Add to current run")).not.toBeInTheDocument();+ fireEvent.change(screen.getByTestId("editor"), { target: { value: "also check this" } });+ expect(screen.getByRole("status")).toHaveTextContent("Add to current run");+ rerender(element({ ...props, canSteerWhileRunning: false }));+ expect(screen.getByRole("status")).toHaveTextContent("Start after this run");+ rerender(element({ ...props, canSteerWhileRunning: undefined }));+ expect(screen.queryByText("Add to current run")).not.toBeInTheDocument();+ expect(screen.queryByText("Start after this run")).not.toBeInTheDocument();+ });++ it("keeps Stop available and explains queuing while content is uploading", async () => {let resolveUpload!: (value: UploadResult) => void;mockApiUploadFile.mockImplementation(() => new Promise<UploadResult>((resolve) => (resolveUpload = resolve)),);const onStop = vi.fn();- renderInput({ isRunning: true, allowSubmitWhileRunning: true, onStop });+ renderInput({ isRunning: true, allowSubmitWhileRunning: true, canSteerWhileRunning: true, onStop });fireEvent.change(screen.getByTestId("editor"), {target: { value: "follow-up with attachment" },});expect(screen.getByRole("button", { name: "Send" })).not.toBeDisabled();+ expect(screen.getByRole("status")).toHaveTextContent("Add to current run");await act(async () => {dropHandlers.onDrop?.([@@ -1049,6 +1063,7 @@ describe("ChatInput project context", () => {});const stopButton = await screen.findByRole("button", { name: "Stop" });+ expect(screen.getByRole("status")).toHaveTextContent("Start after this run");expect(screen.queryByRole("button", { name: "Queue message" })).not.toBeInTheDocument();fireEvent.click(stopButton);expect(onStop).toHaveBeenCalledTimes(1);diff --git a/packages/views/chat/components/chat-input.tsx b/packages/views/chat/components/chat-input.tsxindex 556064603a..bd36934bea 100644--- a/packages/views/chat/components/chat-input.tsx+++ b/packages/views/chat/components/chat-input.tsx@@ -115,6 +115,8 @@ interface ChatInputProps {isRunning?: boolean;/** Enabled only after the server explicitly advertises follow-up queues. */allowSubmitWhileRunning?: boolean;+ /** Server-confirmed permission and capability for this exact running turn. */+ canSteerWhileRunning?: boolean;disabled?: boolean;/** True when the user has no agent available — disables the editor and* surfaces a distinct placeholder. Kept separate from `disabled` so@@ -184,6 +186,7 @@ export function ChatInput({onStop,isRunning,allowSubmitWhileRunning,+ canSteerWhileRunning,disabled,noAgent,agentArchived,@@ -206,6 +209,7 @@ export function ChatInput({}: ChatInputProps) {const { t } = useT("chat");const { t: tEditor } = useT("editor");+ const { t: tIssues } = useT("issues");const sendShortcut = useShortcut("send");const editorRef = useRef<ContentEditorRef>(null);const editorAreaRef = useRef<HTMLDivElement>(null);@@ -708,6 +712,9 @@ export function ChatInput({!isProjectUpdating;const selectedProject = projects.find((project) => project.id === projectId);const canSubmitNow = !disabled && !noAgent && (!isRunning || !!allowSubmitWhileRunning);+ const showRunHint = isRunning && allowSubmitWhileRunning && canSteerWhileRunning !== undefined+ && !hasNothingToSend && !disabled && !noAgent;+ const willSteer = canSteerWhileRunning && draftUploads.length === 0;const voice = useComposerVoice({insert: (text) => editorRef.current?.insertText(text) ?? false,submit: canSubmitNow ? () => void submit() : undefined,@@ -784,6 +791,13 @@ export function ChatInput({togglePageContext();}}>+ {showRunHint && (+ <p role="status" className={cn("px-3 pt-2 text-caption", willSteer ? "text-brand" : "text-muted-foreground")}>+ {willSteer+ ? tIssues(($) => $.comment.recipient_steer)+ : tIssues(($) => $.comment.recipient_after_run)}+ </p>+ )}{annotationDraftKey && annotations.length > 0 && (<div className="px-3 pt-2"><ReplyAnnotations draftKey={annotationDraftKey} annotations={annotations} disabled={submitting}diff --git a/packages/views/chat/components/chat-window.tsx b/packages/views/chat/components/chat-window.tsxindex 495ea0fe9c..0ac5d98d08 100644--- a/packages/views/chat/components/chat-window.tsx+++ b/packages/views/chat/components/chat-window.tsx@@ -423,6 +423,7 @@ export function ChatWindow() {onStop={c.handleStop}isRunning={!!pendingTaskId}allowSubmitWhileRunning={pendingTask?.supports_queue === true}+ canSteerWhileRunning={pendingTask?.can_supplement}disabled={c.isSessionArchived ||c.isAgentArchived ||diff --git a/server/internal/handler/chat.go b/server/internal/handler/chat.goindex f954f45355..06fdd6e6d6 100644--- a/server/internal/handler/chat.go+++ b/server/internal/handler/chat.go@@ -1356,6 +1356,7 @@ type PendingChatTaskResponse struct {// as today's bare "Waiting for local directory".WaitReason string `json:"wait_reason,omitempty"`SupportsQueue bool `json:"supports_queue"`+ CanSupplement bool `json:"can_supplement"`QueuedTasks []QueuedChatTaskResponse `json:"queued_tasks,omitempty"`}@@ -1713,10 +1714,31 @@ func (h *Handler) GetPendingChatTask(w http.ResponseWriter, r *http.Request) {CreatedAt: timestampToString(head.CreatedAt),WaitReason: waitReasonForStatus(head.Status, head.WaitReason),SupportsQueue: true,+ CanSupplement: h.canSupplementChatTask(r, session, head.ID, head.Status),QueuedTasks: queued,})}+func (h *Handler) canSupplementChatTask(r *http.Request, session db.ChatSession, taskID pgtype.UUID, status string) bool {+ if status != "running" {+ return false+ }+ if _, err := h.Queries.GetChannelChatSessionBindingBySessionAny(r.Context(), session.ID); !errors.Is(err, pgx.ErrNoRows) {+ return false+ }+ capability, err := h.Queries.GetTaskSupplementCapability(r.Context(), taskID)+ if err != nil || capability.Capability != protocol.DaemonCapabilityTaskSupplementV1 {+ return false+ }+ userID := requestUserID(r)+ actorType, actorID := h.resolveActor(r, userID, uuidToString(session.WorkspaceID))+ if actorType != "member" {+ return false+ }+ agent, err := h.Queries.GetAgent(r.Context(), session.AgentID)+ return err == nil && h.canInvokeAgent(r.Context(), agent, actorType, actorID, userID, uuidToString(session.WorkspaceID))+}+// PrioritizeQueuedChatTask moves one queued follow-up ahead of its FIFO peers.// The client then cancels the current task through the existing cancellation// endpoint, preserving that path's transcript and draft-restore semantics.diff --git a/server/internal/handler/chat_supplement_test.go b/server/internal/handler/chat_supplement_test.goindex 8262303f85..aa9c23c978 100644--- a/server/internal/handler/chat_supplement_test.go+++ b/server/internal/handler/chat_supplement_test.go@@ -1,14 +1,17 @@package handlerimport (+ "fmt""net/http""strings""testing"+ "time""github.com/google/uuid""github.com/multica-ai/multica/server/internal/service""github.com/multica-ai/multica/server/internal/testutil"db "github.com/multica-ai/multica/server/pkg/db/generated"+ "github.com/multica-ai/multica/server/pkg/protocol")func newChatSupplementFixture(t *testing.T, negotiated bool) (string, string, string) {@@ -22,13 +25,20 @@ func newChatSupplementFixture(t *testing.T, negotiated bool) (string, string, sttaskID := dbfx.Task(t, agentID, testutil.Cols{"runtime_id": runtimeID, "chat_session_id": sessionID, "issue_id": nil, "status": "dispatched"})dbfx.Exec(t, `UPDATE agent_task_queue SET chat_input_task_id=id WHERE id=$1`, taskID)dbfx.Insert(t, "chat_message", testutil.Cols{"chat_session_id": sessionID, "task_id": taskID, "role": "user", "content": "original objective"})- if _, err := testHandler.TaskService.StartTask(t.Context(), parseUUID(taskID), service.TaskStartCapabilities{Supplement: negotiated}); err != nil {- t.Fatal(err)- }dbfx.Cleanup(t, `DELETE FROM chat_task_supplement WHERE chat_session_id=$1`, sessionID)dbfx.Cleanup(t, `DELETE FROM task_supplement_capability WHERE task_id=$1`, taskID)dbfx.Cleanup(t, `DELETE FROM agent_task_queue WHERE chat_session_id=$1 AND id<>$2`, sessionID, taskID)dbfx.Cleanup(t, `DELETE FROM task_supplement_capability WHERE task_id IN (SELECT id FROM agent_task_queue WHERE chat_session_id=$1)`, sessionID)+ var capabilities []string+ if negotiated {+ capabilities = append(capabilities, protocol.DaemonCapabilityTaskSupplementV1)+ }+ var started AgentTaskResponse+ req := withURLParam(newOwnerDaemonRequest(http.MethodPost, "/start", map[string]any{"capabilities": capabilities}), "taskId", taskID)+ testutil.Call(t, testHandler.StartTask, req).Want(http.StatusOK).JSON(&started)+ if negotiated && started.SupplementCapability != protocol.DaemonCapabilityTaskSupplementV1 {+ t.Fatalf("chat start did not echo its negotiated capability: %q", started.SupplementCapability)+ }return sessionID, taskID, agentID}@@ -40,6 +50,73 @@ func sendChatGuidance(t *testing.T, sessionID string, body map[string]any) SendCreturn response}+func TestChatSupplementStartReplayAndBurst(t *testing.T) {+ sessionID, taskID, _ := newChatSupplementFixture(t, true)+ task, err := testHandler.Queries.GetAgentTask(t.Context(), parseUUID(taskID))+ if err != nil {+ t.Fatal(err)+ }+ generation := time.Date(2026, 11, 16, 0, 0, 0, 0, time.UTC)+ dbfx.Exec(t, `UPDATE agent_task_queue SET dispatched_at=$2 WHERE id=$1`, taskID, generation)+ for range 2 {+ var started AgentTaskResponse+ req := withURLParam(newOwnerDaemonRequest(http.MethodPost, "/start", map[string]any{+ "runtime_id": uuidToString(task.RuntimeID), "dispatched_at": generation.Format(time.RFC3339Nano),+ "capabilities": []string{protocol.DaemonCapabilityTaskSupplementV1},+ }), "taskId", taskID)+ testutil.Call(t, testHandler.StartTask, req).Want(http.StatusOK).JSON(&started)+ if started.SupplementCapability != protocol.DaemonCapabilityTaskSupplementV1 {+ t.Fatal("chat start replay lost steering negotiation")+ }+ }+ const count = 5+ var sent []SendChatMessageResponse+ for i := range count {+ sent = append(sent, sendChatGuidance(t, sessionID, map[string]any{"steer": true, "content": fmt.Sprintf("guidance %d", i)}))+ if !sent[i].Steered || sent[i].Queued || sent[i].TaskID != taskID {+ t.Fatalf("guidance %d created a separate turn: %+v", i, sent[i])+ }+ }+ for _, message := range sent {+ var claimed struct {+ MessageID string `json:"comment_id"`+ }+ req := withURLParam(newOwnerDaemonRequest(http.MethodPost, "/claim", nil), "taskId", taskID)+ testutil.Call(t, testHandler.ClaimTaskSupplement, req).Want(http.StatusOK).JSON(&claimed)+ if claimed.MessageID != message.MessageID {+ t.Fatalf("guidance order: got %s, want %s", claimed.MessageID, message.MessageID)+ }+ req = withURLParams(newOwnerDaemonRequest(http.MethodPost, "/ack", map[string]any{"delivered": true}), "taskId", taskID, "commentId", message.MessageID)+ testutil.Call(t, testHandler.AckTaskSupplement, req).Want(http.StatusOK)+ }+ if w := completeTaskViaHandler(t, taskID, "one answer covering every addition"); w.Code != http.StatusOK {+ t.Fatal(w.Body.String())+ }+ if n := dbfx.Count(t, `SELECT count(*) FROM agent_task_queue WHERE chat_session_id=$1`, sessionID); n != 1 {+ t.Fatalf("burst produced %d turns", n)+ }+ if n := dbfx.Count(t, `SELECT count(*) FROM chat_message WHERE chat_session_id=$1 AND role='assistant'`, sessionID); n != 1 {+ t.Fatalf("burst produced %d replies", n)+ }+}++func TestChatSupplementPendingCapability(t *testing.T) {+ for _, negotiated := range []bool{false, true} {+ t.Run(fmt.Sprintf("negotiated=%v", negotiated), func(t *testing.T) {+ sessionID, taskID, _ := newChatSupplementFixture(t, negotiated)+ for _, status := range []string{"running", "dispatched", "queued"} {+ dbfx.Exec(t, `UPDATE agent_task_queue SET status=$2 WHERE id=$1`, taskID, status)+ var pending PendingChatTaskResponse+ req := withURLParam(withChatTestWorkspaceCtx(t, newRequest(http.MethodGet, "/pending-task", nil)), "sessionId", sessionID)+ testutil.Call(t, testHandler.GetPendingChatTask, req).Want(http.StatusOK).JSON(&pending)+ if want := negotiated && status == "running"; pending.CanSupplement != want {+ t.Fatalf("%s: can_supplement=%v, want %v", status, pending.CanSupplement, want)+ }+ }+ })+ }+}+func TestChatSupplementSendClaimAck(t *testing.T) {sessionID, taskID, _ := newChatSupplementFixture(t, true)key := uuid.NewString()@@ -544,6 +621,13 @@ func TestChatSupplementPermissionAndSessionDeletion(t *testing.T) {sent := sendChatGuidance(t, sessionID, map[string]any{"steer": true, "content": "pending"})dbfx.Exec(t, `UPDATE agent_runtime SET visibility='public' WHERE id=(SELECT runtime_id FROM agent WHERE id=$1)`, agentID)dbfx.Exec(t, `UPDATE agent SET permission_mode='private', owner_id=$2 WHERE id=$1`, agentID, dbfx.User(t, "Other", "other-"+uuid.NewString()+"@test.local"))+ session, err := testHandler.Queries.GetChatSession(t.Context(), parseUUID(sessionID))+ if err != nil {+ t.Fatal(err)+ }+ if testHandler.canSupplementChatTask(newRequest(http.MethodGet, "/pending-task", nil), session, parseUUID(taskID), "running") {+ t.Fatal("revoked caller was offered steering")+ }req := withURLParam(withChatTestWorkspaceCtx(t, newRequest(http.MethodPost, "/messages", map[string]any{"steer": true, "content": "forbidden"})), "sessionId", sessionID)testutil.Call(t, testHandler.SendChatMessage, req).Want(http.StatusForbidden)if n := dbfx.Count(t, `SELECT count(*) FROM chat_task_supplement WHERE task_id=$1`, taskID); n != 1 {diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex 8069a27c16..6aebc6b7e3 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -4848,7 +4848,7 @@ func (h *Handler) StartTask(w http.ResponseWriter, r *http.Request) {// A daemon must use this response rather than its own offer: an old server// ignores the offer and omits the field, which keeps daemon-first rollouts// fail closed without requiring synchronized deployment.- if task.IssueID.Valid {+ if task.IssueID.Valid || task.ChatSessionID.Valid {if capability, capabilityErr := h.Queries.GetTaskSupplementCapability(r.Context(), task.ID); capabilityErr == nil {resp.SupplementCapability = capability.Capability} else if !errors.Is(capabilityErr, pgx.ErrNoRows) {