Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat: edit queued prompts with persistent drafts

Rach Pradhan8a0c02089954
diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml
index 9f7e354f..fff4e02b 100644
--- a/.github/workflows/desktop.yml
+++ b/.github/workflows/desktop.yml
@@ -23,6 +23,8 @@ jobs:
- run: bun install --frozen-lockfile
- run: bun run test:desktop
- run: bun run build
+ - run: bunx playwright install chromium
+ - run: bun run test:queue
- run: bun run test:turns
- run: bun run test:tab-drag
- run: bun run test:stream-performance
diff --git a/apps/native/app/visual-tests/queue/fixture.tsx b/apps/native/app/visual-tests/queue/fixture.tsx
new file mode 100644
index 00000000..73c5d14d
--- /dev/null
+++ b/apps/native/app/visual-tests/queue/fixture.tsx
@@ -0,0 +1,37 @@
+"use client";
+import { useRef, useState } from "react";
+import PromptQueue from "@/components/site/PromptQueue";
+import { usePromptQueue } from "@/components/site/usePromptQueue";
+
+const image = "@[/tmp/graff-native-attachments/queued-image.png]";
+export default function Fixture() {
+ const queue = usePromptQueue();
+ const running = useRef(true);
+ const [busy, setBusy] = useState(true);
+ const [open, setOpen] = useState(true);
+ const [sent, setSent] = useState<string[]>([]);
+ const start = () => {
+ queue.setQueue(1, [{ id: 1, text: "First follow-up" }, { id: 2, text: `Look at this\n${image}` }]);
+ running.current = true; setBusy(true); setOpen(true); setSent([]);
+ };
+ const resume = () => {
+ if (running.current) return;
+ const next = queue.take(1);
+ if (next) { running.current = true; setBusy(true); setSent(current => [...current, next.text]); }
+ };
+ return <main className="mx-auto max-w-[720px] p-6">
+ <button type="button" onClick={start}>Start fixture</button>
+ <button type="button" onClick={() => { running.current = false; setBusy(false); resume(); }}>Finish turn</button>
+ <button type="button" onClick={() => setOpen(value => !value)}>{open ? "Hide chat" : "Return to chat"}</button>
+ <button type="button" onClick={() => { queue.setQueue(1, []); running.current = false; setBusy(false); setOpen(false); }}>Close chat</button>
+ {open && <PromptQueue items={queue.queues[1] ?? []} busy={busy} error="Could not interrupt the current turn"
+ onSteer={() => {}}
+ onBeginEdit={item => queue.beginEdit(1, item)}
+ onChangeEdit={(item, draft) => queue.changeEdit(1, item, draft)}
+ onCancelEdit={item => { queue.cancelEdit(1, item); resume(); }}
+ onEdit={(item, text) => { queue.edit(1, item, text); resume(); }}
+ onRemove={item => { queue.remove(1, item); resume(); }} />}
+ <output aria-label="Sent messages">{JSON.stringify(sent)}</output>
+ <output aria-label="Queue state">{JSON.stringify(queue.queues)}</output>
+ </main>;
+}
diff --git a/apps/native/app/visual-tests/queue/page.tsx b/apps/native/app/visual-tests/queue/page.tsx
new file mode 100644
index 00000000..4db8c32b
--- /dev/null
+++ b/apps/native/app/visual-tests/queue/page.tsx
@@ -0,0 +1,7 @@
+import { notFound } from "next/navigation";
+import Fixture from "./fixture";
+export const dynamic = "force-dynamic";
+export default function Page() {
+ if (process.env.GRAFF_VISUAL_TESTS !== "1") notFound();
+ return <Fixture />;
+}
diff --git a/apps/native/components/site/ChatBubbles.tsx b/apps/native/components/site/ChatBubbles.tsx
index e9d387e6..0a859241 100644
--- a/apps/native/components/site/ChatBubbles.tsx
+++ b/apps/native/components/site/ChatBubbles.tsx
@@ -8,6 +8,7 @@ import TurnActivity from "./TurnActivity";
import HtmlArtifact from "./HtmlArtifact";
import McpAppResult from "./McpAppResult";
import SnapshotView from "./SnapshotView";
+import { markerName, splitImageMarkers } from "@/lib/attachments";
import { pinScrollerTail } from "@/lib/follow-scroll";
import { turnBlocks, type AssistantTurn } from "@/lib/acp";
import { useSmoothStream } from "./useSmoothStream";
@@ -58,7 +59,7 @@ function PastedImage({ name }: { name: string }) {
}
export const UserBubble = memo(function UserBubble({ text }: { text: string }) {
- const parts = text.split(/(@\[[^\]\n]*\/graff-native-attachments\/[^/\]\n]+\.(?:png|jpe?g|gif|webp|avif|bmp)\])/gi);
+ const parts = splitImageMarkers(text);
return (
<div className="flex justify-end pl-10 sm:pl-24" style={{ animation: "fade-up 300ms cubic-bezier(0.23,1,0.32,1) both" }}>
<div
@@ -66,7 +67,7 @@ export const UserBubble = memo(function UserBubble({ text }: { text: string }) {
style={{ background: "color-mix(in oklab, var(--accent) 12%, var(--surface))" }}
>
{parts.map((part, index) => index % 2 === 1
- ? <PastedImage key={`${index}-${part}`} name={part.slice(part.lastIndexOf("/") + 1, -1)} />
+ ? <PastedImage key={`${index}-${part}`} name={markerName(part)} />
: part)}
</div>
</div>
diff --git a/apps/native/components/site/GraffHarness.tsx b/apps/native/components/site/GraffHarness.tsx
index 7d33895a..54a194e6 100644
--- a/apps/native/components/site/GraffHarness.tsx
+++ b/apps/native/components/site/GraffHarness.tsx
@@ -1,5 +1,6 @@
"use client";
import { useHarnessSessions } from "./useHarnessSessions";
+import { resumeQueuedPrompt } from "@/lib/prompt-queue-resume";
import { createPromptRunner } from "./harness-prompt-runner";
import { workspaceActions } from "./harness-workspace-actions";
@@ -132,9 +133,10 @@ export default function GraffHarness() {
const panesRef = useRef<number[]>([]);
panesRef.current = panes;
const [, setFollowing] = useState(true);
- const { queuesRef, queues, queueIdRef, setQueue, steerer, steerStatus, remove: removeQueued } = usePromptQueue();
+ const { queuesRef, queues, queueIdRef, setQueue, steerer, steerStatus, remove: removeQueued, edit: editQueued, beginEdit, cancelEdit, changeEdit, take: takeQueuedPrompt } = usePromptQueue();
const [cancelError, setCancelError] = useState<Record<number, string>>({});
const runningRef = useRef(new Set<number>());
+ const queueResumesRef = useRef(new Set<number>());
// Closed tabs, oldest first, for the reopen shortcut.
const closedRef = useRef<{ session: string | null; cwd?: string; resumable: boolean }[]>([]);
@@ -194,7 +196,7 @@ export default function GraffHarness() {
};
const runPrompt = createPromptRunner({
- runningRef, steerer, setFollowing, chatsRef, model, msgIdRef, setChats, setBusyFor, setHistory, pinsRef, handleOf, setPins, requireSession, adoptCatalog, refreshStored, queuesRef, setQueue, setCancelError
+ runningRef, steerer, setFollowing, chatsRef, model, msgIdRef, setChats, setBusyFor, setHistory, pinsRef, handleOf, setPins, requireSession, adoptCatalog, refreshStored, takeQueuedPrompt, setCancelError
});
const settings = useQuietSettings({ requireSession, handleOf, running: runningRef.current, apply: (catalog) => setModels(catalog.models) });
@@ -398,6 +400,12 @@ export default function GraffHarness() {
const sidebarWorkspace = activeWorkspace ?? (activePath ? { path: activePath, name: basename(activePath) } : undefined);
const footerTitle = sessionFooterTitle(chatThread.session, sessionId, chatCwd);
+ const resumeQueue = (chatId: number) => void resumeQueuedPrompt(chatId, {
+ pending: queueResumesRef.current,
+ canStart: id => !runningRef.current.has(id) && chatsRef.current.some(chat => chat.id === id),
+ wait: settings.wait, take: takeQueuedPrompt, run: runPrompt,
+ });
+
const columnBody = (thread: Chat) => <ChatColumn key={thread.id} thread={thread}
compact={columnIds.length > 1} following={tailing[thread.id] ?? true} register={paneRef(thread.id)}
onOpenPath={openPath} onReview={openChanges}
@@ -423,7 +431,11 @@ export default function GraffHarness() {
},
}}
queue={{ items: queues[thread.id] ?? [], busy: busyIds.has(thread.id), status: steerStatus[thread.id], error: cancelError[thread.id],
- onRemove: item => removeQueued(thread.id, item), onSteer: item => steerer.steer(thread.id, item, () => {
+ onBeginEdit: item => beginEdit(thread.id, item),
+ onChangeEdit: (item, draft) => changeEdit(thread.id, item, draft),
+ onEdit: (item, text) => { editQueued(thread.id, item, text); resumeQueue(thread.id); },
+ onCancelEdit: item => { cancelEdit(thread.id, item); resumeQueue(thread.id); },
+ onRemove: item => { removeQueued(thread.id, item); resumeQueue(thread.id); }, onSteer: item => steerer.steer(thread.id, item, () => {
const session = sessionsRef.current.get(thread.id);
if (!session) return Promise.reject(new Error("Session unavailable"));
return cancel(handleOf(thread.id), session);
diff --git a/apps/native/components/site/PromptQueue.tsx b/apps/native/components/site/PromptQueue.tsx
index c53898a8..99fd8f25 100644
--- a/apps/native/components/site/PromptQueue.tsx
+++ b/apps/native/components/site/PromptQueue.tsx
@@ -1,41 +1,125 @@
"use client";
+import { useEffect, useRef, useState } from "react";
+import { markerName, splitImageMarkers } from "@/lib/attachments";
import type { QueuedPrompt } from "@/lib/prompt-queue";
import type { SteerStatus } from "@/lib/prompt-queue-steer";
-export default function PromptQueue({ items, busy, status, error, onSteer, onRemove }: {
+/** The pixels behind a queued `@[…]` marker, from the staged file `/api/attach`
+ * serves back — the same image the sent bubble shows, sized for the row, and
+ * named like the composer's own chip so the file is never ambiguous. */
+function QueuedImage({ name }: { name: string }) {
+ const [failed, setFailed] = useState(false);
+ const src = `/api/attach?name=${encodeURIComponent(name)}`;
+ return (
+ <a href={src} target="_blank" rel="noreferrer" title={`Open ${name}`}
+ className="flex shrink-0 items-center gap-1 rounded-[5px] bg-field py-0.5 pr-1.5 pl-0.5 text-[11.5px] text-ink-2">
+ {!failed && (
+ /* Local staged pixels: no remote image optimizer or expiring object URL. */
+ /* eslint-disable-next-line @next/next/no-img-element */
+ <img src={src} alt="" loading="lazy" onError={() => setFailed(true)} className="size-5 rounded-[4px] object-cover" />
+ )}
+ <span className="max-w-28 truncate">{name}</span>
+ </a>
+ );
+}
+
+export default function PromptQueue({ items, busy, status, error, onSteer, onRemove, onEdit, onBeginEdit, onCancelEdit, onChangeEdit }: {
items: QueuedPrompt[];
busy: boolean;
status?: SteerStatus;
error?: string;
onSteer: (id: number) => void;
onRemove: (id: number) => void;
+ onEdit: (id: number, text: string) => void;
+ onBeginEdit: (id: number) => void;
+ onCancelEdit: (id: number) => void;
+ onChangeEdit: (id: number, draft: string) => void;
}) {
+ // The queue owns drafts, so switching tabs or zooming panes cannot discard
+ // an edit or release its hold. Only explicit actions change queue state.
+ const editor = items.find(item => item.editing);
+ const editing = editor?.id;
+ const draft = editor?.draft ?? "";
+ const inputRef = useRef<HTMLTextAreaElement>(null);
+ useEffect(() => {
+ // Opening the editor hands the caret the row's own text, ready to replace.
+ if (editing !== undefined) { inputRef.current?.focus(); inputRef.current?.select(); }
+ }, [editing]);
const alert = error || status?.error;
if (!items.length && !alert) return null;
const pending = status?.pending !== undefined;
+ const commit = (id: number) => onEdit(id, draft);
return (
<div className="mb-2">
{alert && <p role="alert" className="mb-2 rounded-[8px] border border-line bg-surface px-2.5 py-2 text-[12px] text-ink">{alert}</p>}
<ul aria-label="Queued messages" className="flex flex-col gap-1">
- {items.map(item => (
- <li key={item.id} className="flex flex-wrap items-center gap-2 rounded-[8px] bg-surface px-2.5 py-1.5 text-[12.5px] text-ink-2 shadow-hairline">
+ {items.map(item => {
+ const parts = splitImageMarkers(item.text);
+ const held = status?.pending === item.id;
+ // The words without their markers; a marker never renders as a path.
+ const label = parts.filter((_, index) => index % 2 === 0).join("").replace(/\s+/g, " ").trim();
+ return (
+ <li key={item.id} data-queued-prompt={item.id} className="flex flex-wrap items-center gap-2 rounded-[8px] bg-surface px-2.5 py-1.5 text-[12.5px] text-ink-2 shadow-hairline">
<span className="shrink-0 text-[11px] font-medium tracking-wide text-ink-3 uppercase">Queued</span>
- <span className="min-w-0 flex-1 truncate text-ink" title={item.text}>{item.text}</span>
- <button type="button" disabled={!busy || pending} onClick={() => onSteer(item.id)}
- title="Interrupt the current turn and send this message next"
- className="shrink-0 rounded px-1.5 py-0.5 text-[11.5px] font-medium text-ink-2 hover:bg-hover hover:text-ink disabled:opacity-50">
- {status?.pending === item.id ? "Steering…" : "Steer now"}
- </button>
- <button type="button" aria-label="Remove from queue" disabled={status?.pending === item.id} onClick={() => onRemove(item.id)}
- className="flex size-5 shrink-0 items-center justify-center rounded-[5px] text-ink-3 hover:bg-hover hover:text-ink disabled:opacity-50">
- <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" aria-hidden>
- <path d="M18 6L6 18M6 6l12 12" />
- </svg>
- </button>
+ {editing === item.id ? (
+ <>
+ <textarea
+ ref={inputRef}
+ aria-label="Edit queued message"
+ rows={2}
+ value={draft}
+ onChange={(event) => onChangeEdit(item.id, event.target.value)}
+ onKeyDown={(event) => {
+ if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) { event.preventDefault(); commit(item.id); }
+ if (event.key === "Escape") { event.preventDefault(); onCancelEdit(item.id); }
+ }}
+ className="min-w-0 flex-1 rounded-[6px] bg-field px-1.5 py-0.5 text-[12.5px] text-ink outline-none"
+ />
+ <button type="button" onClick={() => commit(item.id)} title="Save the edit (Enter)" aria-label="Save queued message"
+ className="flex size-5 shrink-0 items-center justify-center rounded-[5px] text-ink-2 hover:bg-hover hover:text-ink">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
+ <path d="M20 6L9 17l-5-5" />
+ </svg>
+ </button>
+ <button type="button" onClick={() => onCancelEdit(item.id)} title="Cancel the edit (Esc)" aria-label="Cancel edit"
+ className="flex size-5 shrink-0 items-center justify-center rounded-[5px] text-ink-3 hover:bg-hover hover:text-ink">
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" aria-hidden>
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ </>
+ ) : (
+ <>
+ <span className="min-w-0 flex-1 truncate text-ink" title={item.text}>{label || "Attachment only"}</span>
+ {parts.map((part, index) => index % 2 === 1
+ ? <QueuedImage key={`${index}-${part}`} name={markerName(part)} />
+ : null)}
+ <button type="button" aria-label="Edit queued message" title="Edit before it is sent" disabled={held || editing !== undefined}
+ onClick={() => onBeginEdit(item.id)}
+ className="flex size-5 shrink-0 items-center justify-center rounded-[5px] text-ink-3 hover:bg-hover hover:text-ink disabled:opacity-50">
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
+ <path d="M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4Z" />
+ </svg>
+ </button>
+ <button type="button" disabled={!busy || pending || editing !== undefined} onClick={() => onSteer(item.id)}
+ title="Interrupt the current turn and send this message next"
+ className="shrink-0 rounded px-1.5 py-0.5 text-[11.5px] font-medium text-ink-2 hover:bg-hover hover:text-ink disabled:opacity-50">
+ {status?.pending === item.id ? "Steering…" : "Steer now"}
+ </button>
+ <button type="button" aria-label="Remove from queue" disabled={status?.pending === item.id} onClick={() => onRemove(item.id)}
+ className="flex size-5 shrink-0 items-center justify-center rounded-[5px] text-ink-3 hover:bg-hover hover:text-ink disabled:opacity-50">
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" aria-hidden>
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ </>
+ )}
</li>
- ))}
+ );
+ })}
</ul>
+ {items.some(item => item.editing) && <p role="status" className="mt-1 text-[12px] text-ink-3">Messages stay queued until you save or cancel the edit.</p>}
{pending && <p role="status" className="mt-1 text-[12px] text-ink-3">Interrupting the current turn. Selected message goes next; other messages stay queued.</p>}
</div>
);
diff --git a/apps/native/components/site/harness-prompt-runner.ts b/apps/native/components/site/harness-prompt-runner.ts
index ba76650d..5f83b310 100644
--- a/apps/native/components/site/harness-prompt-runner.ts
+++ b/apps/native/components/site/harness-prompt-runner.ts
@@ -5,7 +5,7 @@ import { prompt } from "@/lib/acp-client";
import { annotationsBlock, type BrowserPin } from "@/lib/browser/annotations";
import { browserHandle, browserNav } from "@/lib/browser-client";
import { pushHistory, saveHistory } from "@/lib/prompt-history";
-import { shiftQueuedPrompt, type QueuedPrompt } from "@/lib/prompt-queue";
+import type { QueuedPrompt } from "@/lib/prompt-queue";
import type { createQueueSteerer } from "@/lib/prompt-queue-steer";
import type { Chat } from "./harness-types";
type Ref<T> = MutableRefObject<T>;
@@ -18,9 +18,9 @@ type Props = {
pinsRef: Ref<Record<number, BrowserPin[]>>; handleOf(id: number): string;
setPins(id: number, pins: BrowserPin[]): void; requireSession(id: number): Promise<string>;
adoptCatalog(id: number): Promise<void>; refreshStored(): Promise<void>;
- queuesRef: Ref<Record<number, QueuedPrompt[]>>; setQueue(id: number, queue: QueuedPrompt[]): void;
+ takeQueuedPrompt(id: number): QueuedPrompt | undefined;
};
-export function createPromptRunner({runningRef, steerer, setFollowing, chatsRef, model, msgIdRef, setChats, setBusyFor, setHistory, pinsRef, handleOf, setPins, requireSession, adoptCatalog, refreshStored, queuesRef, setQueue, setCancelError}: Props) {
+export function createPromptRunner({runningRef, steerer, setFollowing, chatsRef, model, msgIdRef, setChats, setBusyFor, setHistory, pinsRef, handleOf, setPins, requireSession, adoptCatalog, refreshStored, takeQueuedPrompt, setCancelError}: Props) {
const patchAssistant = (chatId: number, msgId: number, next: AssistantTurn) => {
setChats((current) =>
current.map((c) =>
@@ -109,8 +109,7 @@ export function createPromptRunner({runningRef, steerer, setFollowing, chatsRef,
setBusyFor(chatId, false);
void refreshStored();
setTimeout(() => void refreshStored(), 2500);
- const { next, rest } = shiftQueuedPrompt(queuesRef.current[chatId] ?? []);
- setQueue(chatId, rest);
+ const next = takeQueuedPrompt(chatId);
if (next) void runPrompt(chatId, next.text);
}
};
diff --git a/apps/native/components/site/usePromptQueue.ts b/apps/native/components/site/usePromptQueue.ts
index 697abe95..0a86cc3b 100644
--- a/apps/native/components/site/usePromptQueue.ts
+++ b/apps/native/components/site/usePromptQueue.ts
@@ -1,7 +1,7 @@
"use client";
import { useRef, useState } from "react";
-import { dropQueuedPrompt, type QueuedPrompt } from "@/lib/prompt-queue";
+import { dropQueuedPrompt, editQueuedPrompt, setQueuedPromptEditing, shiftQueuedPrompt, type QueuedPrompt } from "@/lib/prompt-queue";
import { createQueueSteerer, type SteerStatus } from "@/lib/prompt-queue-steer";
export function usePromptQueue() {
@@ -24,6 +24,16 @@ export function usePromptQueue() {
}));
return {
queuesRef, queues, queueIdRef, setQueue, steerer, steerStatus,
+ take: (chat: number) => {
+ const { next, rest } = shiftQueuedPrompt(queuesRef.current[chat] ?? []);
+ if (next) setQueue(chat, rest);
+ return next;
+ },
+ beginEdit: (chat: number, item: number) => setQueue(chat, setQueuedPromptEditing(queuesRef.current[chat] ?? [], item, true)),
+ changeEdit: (chat: number, item: number, draft: string) => setQueue(chat, (queuesRef.current[chat] ?? []).map(entry =>
+ entry.id === item && entry.editing ? { ...entry, draft } : entry)),
+ cancelEdit: (chat: number, item: number) => setQueue(chat, setQueuedPromptEditing(queuesRef.current[chat] ?? [], item, false)),
+ edit: (chat: number, item: number, text: string) => setQueue(chat, editQueuedPrompt(queuesRef.current[chat] ?? [], item, text)),
remove: (chat: number, item: number) => setQueue(chat, dropQueuedPrompt(queuesRef.current[chat] ?? [], item)),
};
}
diff --git a/apps/native/e2e/queue.pw.ts b/apps/native/e2e/queue.pw.ts
new file mode 100644
index 00000000..c9205e69
--- /dev/null
+++ b/apps/native/e2e/queue.pw.ts
@@ -0,0 +1,87 @@
+import { test, expect } from "@playwright/test";
+
+const image = "@[/tmp/graff-native-attachments/queued-image.png]";
+const row = '[data-queued-prompt="2"]';
+test.beforeEach(async ({ page }) => {
+ await page.route("**/api/attach?name=*", route => route.fulfill({
+ contentType: "image/png",
+ body: Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aZ1sAAAAASUVORK5CYII=", "base64"),
+ }));
+ await page.goto("/visual-tests/queue");
+ await page.getByRole("button", { name: "Start fixture" }).click();
+});
+
+test("editing a non-head message pauses completion and sends the saved multiline text", async ({ page }) => {
+ const queued = page.locator(row);
+ await expect(queued.locator("img")).toHaveJSProperty("naturalWidth", 1);
+ await expect(queued).toContainText("queued-image.png");
+ await expect(queued).not.toContainText("graff-native-attachments");
+ await expect(page.locator("main").getByRole("alert")).toHaveText("Could not interrupt the current turn");
+ await queued.getByRole("button", { name: "Edit queued message" }).click();
+ const editor = queued.getByRole("textbox", { name: "Edit queued message" });
+ await expect(editor).toBeFocused();
+ await expect(editor).toHaveValue(`Look at this\n${image}`);
+ await editor.fill(`Revised explanation\n${image}`);
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText("[]");
+ await expect(queued.getByRole("button", { name: "Save queued message" })).toBeVisible();
+ await expect(page.getByRole("button", { name: "Steer now" })).toBeDisabled();
+ await queued.getByRole("button", { name: "Save queued message" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up", `Revised explanation\n${image}`]));
+ await expect(page.getByLabel("Queue state")).toHaveText("{}");
+});
+
+test("Escape resumes the original text and blank Save removes an entry", async ({ page }) => {
+ await page.locator(row).getByRole("button", { name: "Edit queued message" }).click();
+ await page.getByRole("textbox", { name: "Edit queued message" }).fill("Discard this draft");
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await page.getByRole("textbox", { name: "Edit queued message" }).press("Escape");
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+ await expect(page.locator(row)).toContainText("Look at this");
+ await page.locator(row).getByRole("button", { name: "Edit queued message" }).click();
+ await page.getByRole("textbox", { name: "Edit queued message" }).fill(" ");
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await page.getByRole("button", { name: "Save queued message" }).click();
+ await expect(page.getByLabel("Queue state")).toHaveText("{}");
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+});
+
+test("another editor cannot discard a draft and closing a chat clears all queued work", async ({ page }) => {
+ await page.locator(row).getByRole("button", { name: "Edit queued message" }).click();
+ await expect(page.locator('[data-queued-prompt="1"]').getByRole("button", { name: "Edit queued message" })).toBeDisabled();
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await page.getByRole("button", { name: "Cancel edit" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+ await page.locator(row).getByRole("button", { name: "Edit queued message" }).click();
+ await page.getByRole("button", { name: "Close chat" }).click();
+ await expect(page.getByLabel("Queue state")).toHaveText("{}");
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+ await page.getByRole("button", { name: "Start fixture" }).click();
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up"]));
+});
+
+
+test("hiding and reopening a chat preserves its paused editor and unsaved draft", async ({ page }) => {
+ await page.locator(row).getByRole("button", { name: "Edit queued message" }).click();
+ const revised = `Keep this unsaved explanation\n${image}`;
+ await page.getByRole("textbox", { name: "Edit queued message" }).fill(revised);
+ // Unmount the queue like ordinary tab navigation or split zoom does.
+ await page.getByRole("button", { name: "Hide chat" }).click();
+ await expect(page.getByRole("textbox", { name: "Edit queued message" })).toHaveCount(0);
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText("[]");
+ await page.getByRole("button", { name: "Return to chat" }).click();
+ await expect(page.getByRole("textbox", { name: "Edit queued message" })).toHaveValue(revised);
+ // A second hide after the turn ended must still not send the saved original.
+ await page.getByRole("button", { name: "Hide chat" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText("[]");
+ await page.getByRole("button", { name: "Return to chat" }).click();
+ await expect(page.getByRole("textbox", { name: "Edit queued message" })).toHaveValue(revised);
+ await page.getByRole("button", { name: "Save queued message" }).click();
+ await page.getByRole("button", { name: "Finish turn" }).click();
+ await expect(page.getByLabel("Sent messages")).toHaveText(JSON.stringify(["First follow-up", revised]));
+ await expect(page.getByLabel("Queue state")).toHaveText("{}");
+});
diff --git a/apps/native/lib/attachments.test.ts b/apps/native/lib/attachments.test.ts
index 0817fc83..4e252d8a 100644
--- a/apps/native/lib/attachments.test.ts
+++ b/apps/native/lib/attachments.test.ts
@@ -1,6 +1,6 @@
import { test } from "node:test";
import assert from "node:assert/strict";
-import { filesFrom, isImageFile, marker, withAttachmentMarkers, type Attachment } from "./attachments.ts";
+import { filesFrom, isImageFile, marker, markerName, splitImageMarkers, withAttachmentMarkers, type Attachment } from "./attachments.ts";
const shot: Attachment = { id: "/tmp/a/shot.png", name: "shot.png", path: "/tmp/a/shot.png" };
const notes: Attachment = { id: "/tmp/a/notes.md", name: "notes.md", path: "/tmp/a/notes.md" };
@@ -27,6 +27,22 @@ test("a draft with no attachments, and attachments with no draft, both survive",
assert.equal(withAttachmentMarkers(" ", []), " ");
});
+test("splitImageMarkers lifts a staged image out of the words around it", () => {
+ const staged = "@[/tmp/x/graff-native-attachments/shot.png]";
+ assert.deepEqual(splitImageMarkers(`look at this ${staged} please`), ["look at this ", staged, " please"]);
+ assert.deepEqual(splitImageMarkers("no images here"), ["no images here"]);
+ assert.deepEqual(splitImageMarkers(staged), ["", staged, ""]);
+});
+
+test("only the staged attachment directory previews; any other path stays text", () => {
+ assert.deepEqual(splitImageMarkers("@[/tmp/a/shot.png]"), ["@[/tmp/a/shot.png]"]);
+ assert.deepEqual(splitImageMarkers("@[/tmp/x/graff-native-attachments/notes.md]"), ["@[/tmp/x/graff-native-attachments/notes.md]"]);
+});
+
+test("markerName is the basename /api/attach answers to", () => {
+ assert.equal(markerName("@[/tmp/x/graff-native-attachments/shot.png]"), "shot.png");
+});
+
test("isImageFile follows the media type, which is what decides the chip", () => {
assert.equal(isImageFile(new File([], "a.png", { type: "image/png" })), true);
assert.equal(isImageFile(new File([], "a.md", { type: "text/markdown" })), false);
diff --git a/apps/native/lib/attachments.ts b/apps/native/lib/attachments.ts
index 7625f12d..01ff1d76 100644
--- a/apps/native/lib/attachments.ts
+++ b/apps/native/lib/attachments.ts
@@ -65,6 +65,23 @@ export function marker(attachment: Attachment): string {
return `@[${attachment.path}]`;
}
+/** A staged-image marker inside prompt text. One pattern for every reader: the
+ * transcript bubble and a queued chip must not disagree about what counts as
+ * an image. A marker naming anywhere else stays literal text — only files
+ * under the attachment directory can be served back by `/api/attach`. */
+const IMAGE_MARKER_RE = /(@\[[^\]\n]*\/graff-native-attachments\/[^/\]\n]+\.(?:png|jpe?g|gif|webp|avif|bmp)\])/gi;
+
+/** Prompt text split into literal runs and image markers; odd indexes are the
+ * markers, which is why every reader tests `index % 2`. */
+export function splitImageMarkers(text: string): string[] {
+ return text.split(IMAGE_MARKER_RE);
+}
+
+/** The staged file's basename — the name `/api/attach?name=` answers to. */
+export function markerName(marker: string): string {
+ return marker.slice(marker.lastIndexOf("/") + 1, -1);
+}
+
/** The prompt text as it goes on the wire: the draft, then a marker for every
* attachment the draft has not already named. Someone who typed the path by
* hand and also dropped the file should not send it twice. */
diff --git a/apps/native/lib/prompt-queue-resume.test.ts b/apps/native/lib/prompt-queue-resume.test.ts
new file mode 100644
index 00000000..089cdf33
--- /dev/null
+++ b/apps/native/lib/prompt-queue-resume.test.ts
@@ -0,0 +1,63 @@
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { resumeQueuedPrompt } from "./prompt-queue-resume.ts";
+import { setQueuedPromptEditing, shiftQueuedPrompt, type QueuedPrompt } from "./prompt-queue.ts";
+
+function fixture() {
+ let finishSettings!: () => void;
+ const settings = new Promise<void>(resolve => { finishSettings = resolve; });
+ let queue: QueuedPrompt[] = [{ id: 1, text: "queued follow-up" }];
+ let active = false, open = true, settingsDone = false;
+ const sent: string[] = [], pending = new Set<number>();
+ const options = {
+ pending,
+ canStart: () => open && !active,
+ wait: () => settings,
+ take: () => { const { next, rest } = shiftQueuedPrompt(queue); queue = rest; return next; },
+ run: (_chat: number, text: string) => { assert.equal(settingsDone, true); active = true; sent.push(text); },
+ };
+ return {
+ options, sent, queue: () => queue,
+ completeSettings: () => { settingsDone = true; finishSettings(); },
+ hold: () => { queue = setQueuedPromptEditing(queue, 1, true); },
+ close: () => { open = false; queue = []; },
+ beginAnotherTurn: () => { active = true; },
+ };
+}
+
+test("queue resumption waits for settings without dequeuing or starting duplicate prompts", async () => {
+ const f = fixture();
+ const resumed = resumeQueuedPrompt(1, f.options);
+ await resumeQueuedPrompt(1, f.options);
+ assert.equal(f.queue().length, 1);
+ assert.deepEqual(f.sent, []);
+ f.completeSettings();
+ await resumed;
+ assert.deepEqual(f.sent, ["queued follow-up"]);
+ assert.deepEqual(f.queue(), []);
+ assert.equal(f.options.pending.size, 0);
+});
+
+test("an edit opened during settings keeps its prompt queued after settings finish", async () => {
+ const f = fixture();
+ const resumed = resumeQueuedPrompt(1, f.options);
+ f.hold();
+ f.completeSettings();
+ await resumed;
+ assert.deepEqual(f.sent, []);
+ assert.equal(f.queue().length, 1);
+ assert.equal(f.options.pending.size, 0);
+});
+
+test("resumption rechecks closed chats and a newer active turn before dequeue", async () => {
+ for (const state of ["close", "running"]) {
+ const f = fixture();
+ const resumed = resumeQueuedPrompt(1, f.options);
+ state === "close" ? f.close() : f.beginAnotherTurn();
+ f.completeSettings();
+ await resumed;
+ assert.deepEqual(f.sent, []);
+ assert.equal(f.queue().length, state === "close" ? 0 : 1);
+ assert.equal(f.options.pending.size, 0);
+ }
+});
diff --git a/apps/native/lib/prompt-queue-resume.ts b/apps/native/lib/prompt-queue-resume.ts
new file mode 100644
index 00000000..67cb024e
--- /dev/null
+++ b/apps/native/lib/prompt-queue-resume.ts
@@ -0,0 +1,22 @@
+import type { QueuedPrompt } from "./prompt-queue";
+
+/** Settings use the same worker as ordinary prompts. Keep the queued entry
+ * until settings finish, then recheck navigation, active turns and edit holds. */
+export async function resumeQueuedPrompt(chat: number, options: {
+ pending: Set<number>;
+ canStart(chat: number): boolean;
+ wait(chat: number): Promise<unknown> | undefined;
+ take(chat: number): QueuedPrompt | undefined;
+ run(chat: number, text: string): void | Promise<void>;
+}): Promise<void> {
+ if (options.pending.has(chat) || !options.canStart(chat)) return;
+ options.pending.add(chat);
+ try {
+ await options.wait(chat);
+ if (!options.canStart(chat)) return;
+ const next = options.take(chat);
+ if (next) void options.run(chat, next.text);
+ } finally {
+ options.pending.delete(chat);
+ }
+}
diff --git a/apps/native/lib/prompt-queue-steer.test.ts b/apps/native/lib/prompt-queue-steer.test.ts
index 03a4da70..355a6914 100644
--- a/apps/native/lib/prompt-queue-steer.test.ts
+++ b/apps/native/lib/prompt-queue-steer.test.ts
@@ -1,7 +1,7 @@
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { createQueueSteerer, type SteerStatus } from "./prompt-queue-steer.ts";
-import { enqueuePrompt, dropQueuedPrompt, prioritizeQueuedPrompt, shiftQueuedPrompt } from "./prompt-queue.ts";
+import { enqueuePrompt, dropQueuedPrompt, prioritizeQueuedPrompt, setQueuedPromptEditing, shiftQueuedPrompt } from "./prompt-queue.ts";
function fixture(timeoutMs = 1000) {
let queue = [1, 2, 3].map(id => ({ id, text: `message ${id}` }));
@@ -99,3 +99,21 @@ describe("queue force steer", () => {
f.steerer.finish(1);
});
});
+
+
+it("steering cannot bypass an open queue editor", () => {
+ const f = fixture();
+ f.steerer.ready(1);
+ f.setQueue(setQueuedPromptEditing(f.queue(), 2, true));
+ let cancelled = 0;
+ f.steerer.steer(1, 3, async () => { cancelled++; });
+ f.steerer.steer(1, 2, async () => { cancelled++; });
+ assert.equal(cancelled, 0);
+ assert.deepEqual(f.queue().map(item => item.id), [1, 2, 3]);
+ assert.equal(f.status().pending, undefined);
+ assert.equal(shiftQueuedPrompt(f.queue()).next, undefined);
+ f.setQueue(setQueuedPromptEditing(f.queue(), 2, false));
+ f.steerer.steer(1, 3, async () => { cancelled++; });
+ assert.equal(cancelled, 1);
+ f.steerer.finish(1);
+});
diff --git a/apps/native/lib/prompt-queue-steer.ts b/apps/native/lib/prompt-queue-steer.ts
index 55b65d53..f8b4556c 100644
--- a/apps/native/lib/prompt-queue-steer.ts
+++ b/apps/native/lib/prompt-queue-steer.ts
@@ -51,7 +51,7 @@ export function createQueueSteerer(options: {
const turn = turns.get(chat);
if (!turn || turn.selected !== undefined) return;
const queue = options.getQueue(chat);
- if (!queue.some(entry => entry.id === item)) return;
+ if (queue.some(entry => entry.editing) || !queue.some(entry => entry.id === item)) return;
turn.selected = item;
turn.cancel = cancel;
options.setQueue(chat, prioritizeQueuedPrompt(queue, item));
diff --git a/apps/native/lib/prompt-queue.test.ts b/apps/native/lib/prompt-queue.test.ts
index a40cedbd..717df4e2 100644
--- a/apps/native/lib/prompt-queue.test.ts
+++ b/apps/native/lib/prompt-queue.test.ts
@@ -1,6 +1,6 @@
import { describe, it } from "node:test";
import assert from "node:assert/strict";
-import { dropQueuedPrompt, enqueuePrompt, prioritizeQueuedPrompt, shiftQueuedPrompt } from "./prompt-queue.ts";
+import { dropQueuedPrompt, editQueuedPrompt, enqueuePrompt, prioritizeQueuedPrompt, setQueuedPromptEditing, shiftQueuedPrompt } from "./prompt-queue.ts";
describe("prompt-queue", () => {
it("ignores blank lines", () => {
@@ -25,4 +25,53 @@ describe("prompt-queue", () => {
assert.deepEqual(prioritizeQueuedPrompt(list, 3).map(item => item.id), [3, 1, 2]);
assert.strictEqual(prioritizeQueuedPrompt(list, 1), list);
});
+
+ it("edits one entry in place, keeping every id and the order", () => {
+ const list = [{ id: 1, text: "a" }, { id: 2, text: "b" }, { id: 3, text: "c" }];
+ assert.deepEqual(editQueuedPrompt(list, 2, " b, reworded "), [
+ { id: 1, text: "a" },
+ { id: 2, text: "b, reworded" },
+ { id: 3, text: "c" },
+ ]);
+ });
+
+ it("keeps an attachment marker in the edited text, which is what goes on the wire", () => {
+ const list = [{ id: 1, text: "first" }];
+ const edited = "look @[/tmp/x/graff-native-attachments/shot.png]";
+ assert.deepEqual(editQueuedPrompt(list, 1, edited), [{ id: 1, text: edited }]);
+ });
+
+ it("an edit that leaves nothing behind drops the entry, the same result as its ✕", () => {
+ const list = [{ id: 1, text: "a" }, { id: 2, text: "b" }];
+ assert.deepEqual(editQueuedPrompt(list, 1, " \n "), [{ id: 2, text: "b" }]);
+ });
+
+ it("editing an id that is not queued changes nothing", () => {
+ const list = [{ id: 1, text: "a" }];
+ assert.strictEqual(editQueuedPrompt(list, 99, "b"), list);
+ });
+});
+
+
+describe("queue editing lifecycle", () => {
+ const list = [{ id: 1, text: "first" }, { id: 2, text: "original" }];
+ it("holds the entire queue while a non-head entry is being edited", () => {
+ const held = setQueuedPromptEditing(list, 2, true);
+ assert.deepEqual(shiftQueuedPrompt(held), { next: undefined, rest: held });
+ const saved = editQueuedPrompt(held, 2, "updated\n@[/tmp/graff-native-attachments/a.png]");
+ const { next, rest } = shiftQueuedPrompt(saved);
+ assert.equal(next?.text, "first");
+ assert.equal(shiftQueuedPrompt(rest).next?.text, "updated\n@[/tmp/graff-native-attachments/a.png]");
+ });
+ it("cancelling releases the hold without changing text or order", () => {
+ const resumed = setQueuedPromptEditing(setQueuedPromptEditing(list, 2, true), 2, false);
+ assert.deepEqual(resumed, list);
+ assert.equal(shiftQueuedPrompt(resumed).next?.id, 1);
+ });
+ it("removing the edited entry releases the queue and late edits cannot recreate it", () => {
+ const remaining = dropQueuedPrompt(setQueuedPromptEditing(list, 2, true), 2);
+ assert.equal(shiftQueuedPrompt(remaining).next?.id, 1);
+ assert.deepEqual(editQueuedPrompt(remaining, 2, "late save"), remaining);
+ assert.deepEqual(setQueuedPromptEditing([], 2, false), []);
+ });
});
diff --git a/apps/native/lib/prompt-queue.ts b/apps/native/lib/prompt-queue.ts
index 2edfef78..5433cba0 100644
--- a/apps/native/lib/prompt-queue.ts
+++ b/apps/native/lib/prompt-queue.ts
@@ -1,4 +1,4 @@
-export type QueuedPrompt = { id: number; text: string };
+export type QueuedPrompt = { id: number; text: string; editing?: true; draft?: string };
export function enqueuePrompt(list: QueuedPrompt[], text: string, id: number): QueuedPrompt[] {
const trimmed = text.trim();
@@ -17,11 +17,36 @@ export function prioritizeQueuedPrompt(list: QueuedPrompt[], id: number): Queued
return [selected, ...list.filter(item => item.id !== id)];
}
+/** Rewrite one entry in place. The id is the identity the steerer selects by
+ * and the drain shifts by, so an edit never reorders or re-ids the queue. An
+ * edit that leaves nothing drops the entry — the same result as its ✕ — and
+ * an id that is not queued is left alone. */
+export function editQueuedPrompt(list: QueuedPrompt[], id: number, text: string): QueuedPrompt[] {
+ if (!list.some(item => item.id === id)) return list;
+ const trimmed = text.trim();
+ if (!trimmed) return dropQueuedPrompt(list, id);
+ return list.map(item => {
+ if (item.id !== id) return item;
+ const { editing: _editing, draft: _draft, ...saved } = item;
+ return { ...saved, text: trimmed };
+ });
+}
+
+/** Hold the entry while its editor is open; cancelling keeps its saved text. */
+export function setQueuedPromptEditing(list: QueuedPrompt[], id: number, editing: boolean): QueuedPrompt[] {
+ return list.map(item => {
+ if (item.id !== id) return item;
+ if (editing) return { ...item, editing: true, draft: item.draft ?? item.text };
+ const { editing: _editing, draft: _draft, ...saved } = item;
+ return saved;
+ });
+}
+
export function shiftQueuedPrompt(list: QueuedPrompt[]): {
next: QueuedPrompt | undefined;
rest: QueuedPrompt[];
} {
- if (list.length === 0) return { next: undefined, rest: list };
+ if (list.length === 0 || list.some(item => item.editing)) return { next: undefined, rest: list };
const [next, ...rest] = list;
return { next, rest };
}
diff --git a/apps/native/package.json b/apps/native/package.json
index eefafc98..1e642be9 100644
--- a/apps/native/package.json
+++ b/apps/native/package.json
@@ -10,7 +10,7 @@
"start": "NEXT_TELEMETRY_DISABLED=1 next start --port 3000",
"mock-serve": "node scripts/mock-serve.mjs",
"lint": "next lint",
- "test": "node --experimental-strip-types --test lib/cite-markup.test.ts lib/graff-events.test.ts lib/acp.test.ts lib/sessions.test.ts lib/session-store.test.ts lib/follow-scroll.test.ts lib/prompt-queue.test.ts lib/prompt-queue-steer.test.ts lib/agents.test.ts lib/mermaid-plugin.test.ts lib/prompt-history.test.ts lib/attachments.test.ts lib/workspaces.test.ts lib/fuzzy.test.ts lib/folder-picker.test.ts lib/browser/annotations.test.ts lib/browser/url.test.ts components/site/harness-split.test.ts",
+ "test": "node --experimental-strip-types --test lib/cite-markup.test.ts lib/graff-events.test.ts lib/acp.test.ts lib/sessions.test.ts lib/session-store.test.ts lib/follow-scroll.test.ts lib/prompt-queue.test.ts lib/prompt-queue-steer.test.ts lib/prompt-queue-resume.test.ts lib/agents.test.ts lib/mermaid-plugin.test.ts lib/prompt-history.test.ts lib/attachments.test.ts lib/workspaces.test.ts lib/fuzzy.test.ts lib/folder-picker.test.ts lib/browser/annotations.test.ts lib/browser/url.test.ts components/site/harness-split.test.ts",
"electron:build": "bash electron/build.sh",
"test:electron": "bun test electron/policy.test.cjs",
"test:desktop": "bun test lib ./electron/*.test.cjs",
@@ -33,6 +33,7 @@
"test:performance": "GRAFF_PERFORMANCE_TESTS=1 bun scripts/test-visual.mjs",
"benchmark:desktop": "bun scripts/benchmark-desktop.mjs",
"test:mcp-apps": "bun test lib/mcp-apps.test.ts && playwright test -c playwright.mcp.config.ts",
+ "test:queue": "playwright test -c playwright.queue.config.ts",
"test:views": "bun test lib/mcp-apps.test.ts && bun scripts/test-views.mjs",
"test:focus": "bun scripts/test-desktop-focus.mjs",
"test:tagged": "GRAFF_VISUAL_SUITE=tagged bun scripts/test-visual.mjs",
diff --git a/apps/native/playwright.queue.config.ts b/apps/native/playwright.queue.config.ts
new file mode 100644
index 00000000..be641e23
--- /dev/null
+++ b/apps/native/playwright.queue.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from "@playwright/test";
+export default defineConfig({
+ testDir: "./e2e", testMatch: "queue.pw.ts", workers: 1,
+ use: { baseURL: "http://127.0.0.1:3021", headless: true },
+ webServer: {
+ command: "GRAFF_VISUAL_TESTS=1 GRAFF_DESKTOP_TOKEN= bunx next dev --port 3021 --hostname 127.0.0.1",
+ url: "http://127.0.0.1:3021", timeout: 120000, reuseExistingServer: false,
+ },
+ reporter: "list",
+});
diff --git a/docs/adr/0086-desktop-drafts-belong-to-open-chats.md b/docs/adr/0086-desktop-drafts-belong-to-open-chats.md
index 0faea141..6dca012c 100644
--- a/docs/adr/0086-desktop-drafts-belong-to-open-chats.md
+++ b/docs/adr/0086-desktop-drafts-belong-to-open-chats.md
@@ -15,6 +15,11 @@ upload state and attachment errors. The split layout retains these stores while
panes are hidden. Closing a chat disposes its store and attachment previews;
an upload completing after disposal releases its preview too.
+Queued-message edits also belong to the open chat. Editing pauses its queue;
+hiding the chat preserves both the draft and the pause. Only explicit Save,
+Cancel, removal or chat closure clears that edit. Resuming a paused queue waits
+for pending session settings before dequeuing a message.
+
Drafts stay local to the current application session. They are not saved to
conversation history or browser storage. A completed upload must not move focus
away from the pane the user is editing.
@@ -27,4 +32,7 @@ reply remains an independent choice for each chat.
The offline desktop interaction suite checks hidden-tab uploads, independent
drafts and attachments, split zoom, first-reply reading position, and returning
-to a chat. Store tests verify preview cleanup after chat closure.
+to a chat. Store tests verify preview cleanup after chat closure. The queue
+browser fixture checks hidden editors,
+explicit Save/Cancel and closure; controlled-promise tests cover resuming after
+pending settings and rechecking current chat state.