From 6efdd000f040ae6355846399a7f15b964ea2da52 Mon Sep 17 00:00:00 2001 From: roboomp Date: Wed, 1 Jul 2026 05:22:47 +0000 Subject: [PATCH] fix(collab): preserved editor ask responses verbatim Dropped trim and empty gating in the collab web composer so custom ask editor responses ship exactly what the user typed, matching HookEditor's local submit. --- packages/collab-web/src/components/shell/Composer.tsx | 7 +++---- packages/collab-web/test/composer.test.tsx | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/collab-web/src/components/shell/Composer.tsx b/packages/collab-web/src/components/shell/Composer.tsx index 119fd9e19..282b47a83 100644 --- a/packages/collab-web/src/components/shell/Composer.tsx +++ b/packages/collab-web/src/components/shell/Composer.tsx @@ -32,7 +32,7 @@ export function Composer({ client, snapshot }: ComposerProps): ReactNode { const busy = snapshot.working || (snapshot.state?.isStreaming ?? false); const queued = snapshot.state?.queuedMessageCount ?? 0; const canSend = canPrompt && text.trim().length > 0; - const canSubmitUiDraft = canPrompt && uiRequest?.kind === "editor" && uiDraft.trim().length > 0; + const canSubmitUiDraft = canPrompt && uiRequest?.kind === "editor"; useEffect(() => { setUiDraft(uiRequest?.kind === "editor" ? (uiRequestPrefill ?? "") : ""); @@ -55,9 +55,8 @@ export function Composer({ client, snapshot }: ComposerProps): ReactNode { }, [client, live, readOnly, text]); const submitUiDraft = useCallback((): void => { - const trimmed = uiDraft.trim(); - if (!trimmed || !canPrompt || uiRequest?.kind !== "editor") return; - client.sendUiResponse(uiRequest.reqId, trimmed); + if (!canPrompt || uiRequest?.kind !== "editor") return; + client.sendUiResponse(uiRequest.reqId, uiDraft); setUiDraft(""); }, [canPrompt, client, uiDraft, uiRequest]); diff --git a/packages/collab-web/test/composer.test.tsx b/packages/collab-web/test/composer.test.tsx index 8805dcf83..0447b2380 100644 --- a/packages/collab-web/test/composer.test.tsx +++ b/packages/collab-web/test/composer.test.tsx @@ -57,4 +57,13 @@ describe("Composer host UI requests", () => { expect(html).toContain("draft"); expect(html).toContain("Submit"); }); + + it("keeps the editor submit enabled for whitespace-only drafts", () => { + const html = renderToStaticMarkup( + , + ); + + expect(html).toContain('title="submit response"'); + expect(html).not.toMatch(/title="submit response"[^>]*disabled/); + }); });