Skip to content

Commit 383a293

Browse files
authored
revert(ui): keep queued follow-ups attached to the composer (#132294)
Reverts #131909 (b0cb107) per operator product decision after live review — queued messages remain composer-attached; the send-dispatch fix (#131958) is unaffected.
1 parent 19640eb commit 383a293

25 files changed

Lines changed: 222 additions & 580 deletions
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"startupJsGzipBytes": 345371,
3-
"reason": "Queued-send transcript bubbles (#131909), rebuilt on main a79e6517be8: measured 345371 B. Replace the conflicting 348449 B main baseline with this fresh measurement; retain the 512 B growth allowance, 64 B build variance, and 350 KiB ceiling.",
4-
"updatedAt": "2026-08-28"
2+
"startupJsGzipBytes": 344714,
3+
"reason": "Revert queued-send transcript bubbles (#131909) per operator live review; fresh pnpm ui:build measures 344714 B. Retain the 512 B growth allowance, 64 B build variance, and 350 KiB baseline ceiling.",
4+
"updatedAt": "2026-08-29"
55
}

‎docs/web/control-ui.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,8 @@ Chat error banners, including cloud runner failures, keep a compact preview. Ope
616616
- Click **Stop**. Runs with an exact local run ID call `chat.abort`; when selected-session state reports active work but the Control UI has no local run ID, it calls `sessions.abort` instead. For non-global sessions, that selected-session path also discards queued follow-ups so they cannot restart work after the stop.
617617
- While a run is active, normal follow-ups use the Gateway's effective `messages.queue` mode. `steer` injects into the running turn; other modes keep the browser's durable queued delivery. Steering rejection also falls back to that queue. Click **Steer** on a queued message to inject it manually. Text already streamed in an open chat stays before the steering message across history refreshes and reconnects; subsequent updates show only the continuation below it.
618618
- With **Settings → Appearance → Send shortcut** set to **Enter**, **Cmd/Ctrl+Enter** submits the opposite follow-up action while connected to an active run: queue when Enter steers, or steer when Enter queues (including inherited `collect` and `followup` modes). The send button tooltip shows both actions for the current follow-up setting. This affects only that message, not your saved preference. With the **Cmd/Ctrl+Enter** send shortcut selected, modified Enter remains the normal send action and plain Enter inserts a newline. Interrupt mode keeps its normal behavior.
619-
- Queued follow-ups appear immediately as user bubbles at the end of the transcript, after the current run’s content. Their queued status and controls stay beside the bubble until delivery starts; the composer does not repeat their content. Queued local commands remain attached to the composer.
620-
- Reorder the queue from the handle beneath a queued bubble: drag it, or focus it and press the up and down arrow keys. The position is stored with the message, so it survives a reload and decides delivery order, not just what the list looks like. Rows already handed to a run — sending, steering, running a command, awaiting settings, or waiting on an uncertain delivery — hold their place and split the queue: a message moves only among the rows between two of them, so it can never reach the Gateway ahead of work already handed over.
621-
- Edit a queued message from its **More queued message actions** menu, or by double-clicking the bubble. The bubble becomes its own textarea and stays in place while the main composer remains independent, including any separate draft and attachments. Submit replaces the row in the same slot and preserves its attachments; Cancel or Escape discards the row-local draft and restores the queued message. A normal composer send remains a separate queued item even while a row edit is open. The queue behind an edited row waits rather than delivering a message you are still rewriting, so that row splits the queue for reordering the same way an in-flight row does. Queued slash commands keep the discard-and-retype flow.
619+
- Reorder the queue from the handle on the left of a queued message: drag it, or focus it and press the up and down arrow keys. The position is stored with the message, so it survives a reload and decides delivery order, not just what the list looks like. Rows already handed to a run — sending, steering, running a command, awaiting settings, or waiting on an uncertain delivery — hold their place and split the queue: a message moves only among the rows between two of them, so it can never reach the Gateway ahead of work already handed over.
620+
- Edit a queued message with the pencil on its row, or by double-clicking the row. The row becomes its own textarea and stays in place while the main composer remains independent, including any separate draft and attachments. Submit replaces the row in the same slot and preserves its attachments; Cancel or Escape discards the row-local draft and restores the queued message. A normal composer send remains a separate queued item even while a row edit is open. The queue behind an edited row waits rather than delivering a message you are still rewriting, so that row splits the queue for reordering the same way an in-flight row does. Queued slash commands keep the discard-and-retype flow.
622621
- **Settings → Appearance → Chat → Follow-ups while the agent is working** can override that server default for the current browser. The page marks an override explicitly and offers **Reset to server default**. `Steer into the active run` sends follow-ups immediately, while `Queue until the run ends` holds them until the run finishes.
623622
- Type `/stop` (or standalone abort phrases like `stop`, `stop action`, `stop run`, `stop openclaw`, `please stop`) to abort out-of-band.
624623
- `chat.abort` supports `{ sessionKey }` (no `runId`) to abort all active runs for that session. The Control UI uses `sessions.abort` when it has no local run ID.

‎ui/src/e2e/chat-flow.active-run-follow-ups.e2e.test.ts‎

Lines changed: 8 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ suite.define(() => {
642642
await composer.fill(queuedText);
643643
await composer.press("Control+Enter");
644644

645-
const queuedRow = page.locator(".chat-group.user", { hasText: queuedText });
645+
const queuedRow = page.locator(".chat-queue__item", { hasText: queuedText });
646646
await queuedRow.waitFor({ timeout: 10_000 });
647647
await expectRequestCountStable(gateway, "chat.send", 1);
648648
} finally {
@@ -688,16 +688,9 @@ suite.define(() => {
688688
}
689689
});
690690

691-
it("keeps two distinct queued bubbles below streaming and admits the first in place", async () => {
692-
const artifactDir = process.env.OPENCLAW_UI_E2E_ARTIFACT_DIR?.trim();
693-
if (artifactDir) {
694-
await mkdir(artifactDir, { recursive: true });
695-
}
691+
it("sends a queued follow-up after an exact terminal session publication", async () => {
696692
const context = await suite.newBrowserContext({
697693
locale: "en-US",
698-
...(artifactDir
699-
? { recordVideo: { dir: artifactDir, size: { height: 900, width: 1280 } } }
700-
: {}),
701694
serviceWorkers: "block",
702695
viewport: { height: 900, width: 1280 },
703696
});
@@ -721,78 +714,12 @@ suite.define(() => {
721714
const activeSessionKey = requireString(initialSendParams.sessionKey, "active session key");
722715
await page.getByRole("button", { name: "Stop generating" }).waitFor({ timeout: 10_000 });
723716

724-
const transcript = page.locator(".chat-thread-inner");
725-
const streamText = "The current response is still streaming.";
726-
const emitStream = (text: string) =>
727-
gateway.emitGatewayEvent("chat", {
728-
message: { role: "assistant", content: [{ type: "text", text }] },
729-
runId: activeRunId,
730-
sessionKey: activeSessionKey,
731-
state: "delta",
732-
});
733-
const capture = async (name: string) => {
734-
if (artifactDir) {
735-
await page.screenshot({ fullPage: true, path: path.join(artifactDir, name) });
736-
}
737-
};
738-
await emitStream(streamText);
739-
await transcript.getByText(streamText, { exact: true }).waitFor();
740717
const followUp = "send after the missed terminal event";
741-
const secondFollowUp = "then review the next result";
742-
const rowKey = (bubble: Element) =>
743-
bubble.closest("[data-virtual-row-key]")?.getAttribute("data-virtual-row-key");
744-
const sameBubble = (bubble: Element, original: Element | null) => bubble === original;
745-
const firstBubble = transcript
746-
.locator(".chat-group.user", { hasText: followUp })
747-
.locator(".chat-bubble");
748718
await composer.fill(followUp);
749719
await page.getByRole("button", { name: "Queue message" }).click();
750-
await page.getByText(followUp, { exact: true }).waitFor();
751-
await capture("queued-00-submitted.png");
752-
await firstBubble.waitFor({ timeout: 10_000 });
753-
expect(await firstBubble.count()).toBe(1);
754-
const firstElement = await firstBubble.elementHandle();
755-
expect(firstElement).not.toBeNull();
756-
const firstRowKey = await firstBubble.evaluate(rowKey);
757-
expect(firstRowKey).toBeTruthy();
758-
await capture("queued-01-first-follow-up.png");
759-
760-
await composer.fill(secondFollowUp);
761-
await page.getByRole("button", { name: "Queue message" }).click();
762-
const secondGroup = transcript.locator(".chat-group.user", { hasText: secondFollowUp });
763-
const secondBubble = secondGroup.locator(".chat-bubble");
764-
await secondBubble.waitFor({ timeout: 10_000 });
765-
expect(await secondBubble.count()).toBe(1);
766-
const secondElement = await secondBubble.elementHandle();
767-
expect(secondElement).not.toBeNull();
768-
const secondRowKey = await secondBubble.evaluate(rowKey);
769-
expect(secondRowKey).toBeTruthy();
770-
expect(secondRowKey).not.toBe(firstRowKey);
771-
const expectSecondQueuedAtTail = async () => {
772-
await secondGroup.getByText("Queued", { exact: true }).waitFor();
773-
expect(await transcript.locator(".chat-group.user .chat-queue__item").count()).toBe(1);
774-
const tail = transcript.locator(".chat-bubble").last();
775-
expect(await tail.evaluate(sameBubble, secondElement)).toBe(true);
776-
expect(await secondBubble.evaluate(rowKey)).toBe(secondRowKey);
777-
};
778-
await emitStream(`${streamText} More text arrives after both follow-ups.`);
779-
await expect
780-
.poll(() =>
781-
transcript
782-
.locator(".chat-bubble .chat-text")
783-
.evaluateAll((bubbles) => bubbles.map((bubble) => bubble.textContent?.trim() ?? "")),
784-
)
785-
.toEqual([
786-
initialText,
787-
`${streamText} More text arrives after both follow-ups.`,
788-
followUp,
789-
secondFollowUp,
790-
]);
791-
expect(await firstBubble.evaluate(sameBubble, firstElement)).toBe(true);
792-
expect(await page.locator(".chat-queue").count()).toBe(0);
793-
expect(await transcript.locator(".chat-group.user .chat-queue__item").count()).toBe(2);
720+
const queuedRow = page.locator(".chat-queue__item", { hasText: followUp });
721+
await queuedRow.waitFor({ timeout: 10_000 });
794722
await expectRequestCountStable(gateway, "chat.send", 1);
795-
await capture("queued-02-stream-above-follow-ups.png");
796723

797724
await gateway.setHistoryMessages([
798725
{
@@ -818,7 +745,6 @@ suite.define(() => {
818745
await expect
819746
.poll(async () => (await gateway.getRequests("sessions.list")).length)
820747
.toBeGreaterThan(sessionListsBeforeTerminal);
821-
await gateway.deferNext("chat.send");
822748
await gateway.resolveDeferred(
823749
"sessions.list",
824750
chatSessionListResponse([
@@ -836,50 +762,8 @@ suite.define(() => {
836762
);
837763

838764
const sends = await waitForRequests(gateway, "chat.send", 2);
839-
const admitted = requireRecord(sends[1]?.params);
840-
expect(admitted).toMatchObject({ message: followUp });
841-
const admittedRunId = requireString(admitted.idempotencyKey, "admitted queued run id");
842-
expect(await firstBubble.evaluate(sameBubble, firstElement)).toBe(true);
843-
expect(await firstBubble.evaluate(rowKey)).toBe(firstRowKey);
844-
await gateway.resolveDeferred("chat.send", { runId: admittedRunId, status: "started" });
845-
await transcript
846-
.locator(".chat-group.user", { hasText: followUp })
847-
.locator(".chat-queue__item")
848-
.waitFor({ state: "detached" });
849-
expect(await firstBubble.evaluate(sameBubble, firstElement)).toBe(true);
850-
await expectSecondQueuedAtTail();
851-
await capture("queued-03-admitted-in-place.png");
852-
853-
await gateway.emitGatewayEvent("session.message", {
854-
activeRunIds: [admittedRunId],
855-
clientRunId: admittedRunId,
856-
hasActiveRun: true,
857-
message: {
858-
__openclaw: {
859-
id: "queued-follow-up-user",
860-
idempotencyKey: `${admittedRunId}:user`,
861-
seq: 2,
862-
},
863-
role: "user",
864-
content: [{ type: "text", text: followUp }],
865-
timestamp: Date.now(),
866-
},
867-
messageId: "queued-follow-up-user",
868-
messageSeq: 2,
869-
runId: admittedRunId,
870-
sessionKey: activeSessionKey,
871-
});
872-
await expect
873-
.poll(() => firstBubble.getAttribute("data-entry-id"))
874-
.toBe("queued-follow-up-user");
875-
expect(await firstBubble.count()).toBe(1);
876-
expect(await firstBubble.evaluate(sameBubble, firstElement)).toBe(true);
877-
expect(await firstBubble.evaluate(rowKey)).toBe(firstRowKey);
878-
await expectSecondQueuedAtTail();
879-
await expectRequestCountStable(gateway, "chat.send", 2);
880-
await capture("queued-04-history-handoff.png");
881-
await firstElement?.dispose();
882-
await secondElement?.dispose();
765+
expect(requireRecord(sends[1]?.params)).toMatchObject({ message: followUp });
766+
await queuedRow.waitFor({ state: "detached", timeout: 10_000 });
883767
} finally {
884768
await suite.closeBrowserContext(context);
885769
}
@@ -1003,9 +887,7 @@ suite.define(() => {
1003887
const queuedPrompt = "steer this after restoring the queue";
1004888
await page.locator(".agent-chat__composer-combobox textarea").fill(queuedPrompt);
1005889
await page.getByRole("button", { name: "Queue message" }).click();
1006-
await page
1007-
.locator(".chat-group.user", { hasText: queuedPrompt })
1008-
.waitFor({ timeout: 10_000 });
890+
await page.locator(".chat-queue").getByText(queuedPrompt).waitFor({ timeout: 10_000 });
1009891

1010892
await gateway.setMethodResponse(
1011893
"sessions.list",
@@ -1033,7 +915,7 @@ suite.define(() => {
1033915
await page.reload();
1034916
await gateway.waitForRequest("sessions.list");
1035917

1036-
const queue = page.locator(".chat-group.user", { hasText: queuedPrompt });
918+
const queue = page.locator(".chat-queue");
1037919
await queue.getByText(queuedPrompt).waitFor({ timeout: 10_000 });
1038920
await queue.getByRole("button", { name: "Steer" }).click();
1039921

‎ui/src/e2e/chat-flow.composer-shortcuts.e2e.test.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ suite.define(() => {
7474
await composer.press("Control+Enter");
7575

7676
if (followUpMode === "steer") {
77-
const queuedRow = page
78-
.locator(".chat-group.user", { hasText: followUpText })
79-
.locator(".chat-queue__item");
77+
const queuedRow = page.locator(".chat-queue__item", { hasText: followUpText });
8078
await queuedRow.waitFor();
8179
await expectRequestCountStable(gateway, "chat.send", 1);
8280
await gateway.setMethodResponse("chat.history", {

‎ui/src/e2e/chat-flow.history-recovery.e2e.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ suite.define(() => {
876876
expect(sendEnabled).toBe(true);
877877
await send.click();
878878

879-
const queue = page.locator(".chat-group.user:has(.chat-queue__item)", { hasText: prompt });
879+
const queue = page.locator(".chat-queue");
880880
await queue.getByText("Waiting for reconnect").waitFor({ timeout: 10_000 });
881881
await queue.getByText(prompt).waitFor({ timeout: 10_000 });
882882
const requestsBeforeReconnect = await gateway.getRequests("chat.send");

‎ui/src/e2e/chat-flow.models-reasoning.e2e.test.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,7 @@ suite.define(() => {
838838
await page.locator(".chat-queue").getByText("Applying chat settings").waitFor({
839839
timeout: 10_000,
840840
});
841-
await page
842-
.locator(".chat-group.user .chat-bubble")
843-
.getByText(prompt)
844-
.waitFor({ timeout: 10_000 });
841+
await page.locator(".chat-queue").getByText(prompt).waitFor({ timeout: 10_000 });
845842
expect(await gateway.getRequests("chat.send")).toHaveLength(0);
846843

847844
await gateway.resolveDeferred("sessions.patch", {});

0 commit comments

Comments
 (0)