Repository navigation
Closed
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- Open a thread in the web app where an agent is waiting for an answer that accepts custom text and attachments.
- Type an answer in the composer.
- Paste a large screenshot into the answer.
- Click Stop generation while the screenshot still says Preparing.
Expected behavior
The answer returns to the thread draft, and the screenshot appears there when preparation finishes.
Actual behavior
The answer returns to the thread draft, but the screenshot disappears even when there is room for it.
Impact
Major degradation or frequent failure. People who stop while a question attachment is preparing have to find and paste their screenshot again.
Version or commit
main at 59651c1761. The cause is at apps/web/src/questionAttachments.ts:188.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
Preview screenshot.pngAutomated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/scripts/scenarios/stopped-question-keeps-preparing-image.e2e.ts b/scripts/scenarios/stopped-question-keeps-preparing-image.e2e.ts
new file mode 100644
index 0000000000..235c2724fb
--- /dev/null
+++ b/scripts/scenarios/stopped-question-keeps-preparing-image.e2e.ts
@@ -0,0 +1,128 @@
+// @effect-diagnostics nodeBuiltinImport:off -- The scenario starts a local ACP fixture.
+import * as NodePath from "node:path";
+
+import { ProviderDriverKind, ProviderInstanceId } from "@t3tools/contracts";
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+
+import { T3_HOME } from "../e2e.config.ts";
+import {
+ expectHeldImageCompressions,
+ finishImageCompression,
+ holdImageCompression,
+ pasteWideScreenshot,
+} from "./image-compression-hold.ts";
+import { makeState, rpcClient, runPromise, test, WEB } from "./t3.ts";
+
+const ACP = `
+import { createInterface } from "node:readline";
+
+const sessionId = "image-question-session";
+const send = (message) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\\n");
+let promptId;
+for await (const line of createInterface({ input: process.stdin })) {
+ const { id, method } = JSON.parse(line);
+ if (method === "session/cancel" && promptId !== undefined) {
+ send({ id: promptId, result: { stopReason: "cancelled" } });
+ promptId = undefined;
+ }
+ if (id === undefined || method === undefined) continue;
+ if (method === "initialize") {
+ send({ id, result: { protocolVersion: 1, agentCapabilities: { promptCapabilities: { image: true } }, authMethods: [],
+ agentInfo: { name: "Question fixture", version: "1.0.0" } } });
+ } else if (method === "session/new") {
+ send({ id, result: { sessionId } });
+ } else if (method === "session/prompt") {
+ promptId = id;
+ send({
+ id: "ask-image-question",
+ method: "elicitation/create",
+ params: {
+ sessionId,
+ mode: "form",
+ message: "What should we look at?",
+ requestedSchema: {
+ type: "object",
+ properties: { answer: { type: "string", title: "Screenshot question" } },
+ required: ["answer"],
+ },
+ },
+ });
+ } else {
+ send({ id, error: { code: -32601, message: "Method not found" } });
+ }
+}
+`;
+
+test(
+ "Stopping an unanswered question keeps a screenshot that is still preparing",
+ WEB,
+ async ({ t3, app, browser }) => {
+ await holdImageCompression(browser);
+ const project = await t3.project("demo", { "question-agent.mjs": ACP });
+ const instanceId = ProviderInstanceId.make("scenario-question-agent");
+ await runPromise(
+ Effect.gen(function* () {
+ const client = yield* rpcClient(T3_HOME, app.baseUrl ?? "");
+ yield* client["server.updateSettings"]({
+ patch: {},
+ providerInstanceMutation: {
+ operation: "upsert",
+ instanceId,
+ instance: {
+ driver: ProviderDriverKind.make("acpRegistry"),
+ displayName: "Question fixture",
+ enabled: true,
+ config: {
+ source: "local",
+ commandPath: process.execPath,
+ commandArgs: [NodePath.join(project, "question-agent.mjs")],
+ },
+ },
+ },
+ });
+ }).pipe(Effect.scoped),
+ );
+ const { cli } = makeState(T3_HOME);
+ const started = await runPromise(
+ cli(
+ [
+ "thread",
+ "start",
+ project,
+ "Ask for a screenshot.",
+ "--title",
+ "Screenshot question thread",
+ "--provider",
+ instanceId,
+ "--model",
+ "default",
+ "--wait",
+ "--json",
+ ],
+ [2],
+ ),
+ );
+ const { threadId } = JSON.parse(started.stdout) as { threadId: string };
+ await t3.open({ threadId });
+
+ const composer = browser.locator('[data-chat-composer-form="true"]');
+ const question = browser.locator(
+ '[data-chat-composer-form="true"] [data-pending-user-input-toggle]',
+ );
+ await question.waitFor({ timeout: 60_000 });
+ await composer.getByRole("textbox").fill("Here is the screenshot.");
+ await pasteWideScreenshot(browser);
+ await expectHeldImageCompressions(browser, 1);
+ await composer.getByRole("button", "Stop generation").tap();
+ await question.waitFor({ state: "hidden" });
+
+ await finishImageCompression(browser);
+ await app.screenshot("draft-after-stopping-question");
+ await expect(
+ browser.locator(
+ '[data-chat-composer-form="true"] button[aria-label="Preview screenshot.png"]:enabled',
+ ),
+ ).toBeVisible();
+ },
+);pnpm scenarios:prove scripts/scenarios/stopped-question-keeps-preparing-image.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity