From e215001e69bcfea359fcf7c08938a384f3eaa3a4 Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Wed, 11 Nov 2026 11:15:43 -0500 Subject: [PATCH 1/3] fix(solo): ask before deleting a workspace Solo's "Delete workspace" deleted on the first click. Since #2819 it also clears the workspace's instructions, folders and agents on every device, so a misclick lost that setup for good. Every neighboring destructive action (Remove section, Delete team, Delete agent) already asks first. The menu item now opens the shared AlertDialog, "Delete {name}?", with Cancel focused. Confirming runs the existing removeSection; a failure stays in the dialog for retry, and focus returns to the heading or to Chats. Follows the pattern from #2820. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Jonathan Ho --- docs/buzz-help.md | 4 +- src/bundled/channels/SoloWorkspaces.test.tsx | 77 +++++++++++++--- src/bundled/channels/SoloWorkspaces.tsx | 96 +++++++++++++++++--- 3 files changed, 151 insertions(+), 26 deletions(-) diff --git a/docs/buzz-help.md b/docs/buzz-help.md index da6c65bafa..a786d36775 100644 --- a/docs/buzz-help.md +++ b/docs/buzz-help.md @@ -502,7 +502,9 @@ and are asked to sign in again in Buzz. workspace control and leaves no text in the message. A plugin's chat, such as a Nexus task, shows the workspace control when its plugin files it; until that chat's first message, **#** offers its workspaces too, and choosing one - files the chat right away. + files the chat right away. **Delete workspace**, in the workspace's **…** + menu, asks first: its chats move to **Chats**, and its instructions, folders + and agents are cleared on all your devices. - **Channel links.** Type **#** and part of a channel name to link a channel. The link is a chip: Backspace or Delete removes it whole, so to change it, remove it and pick again with **#**. diff --git a/src/bundled/channels/SoloWorkspaces.test.tsx b/src/bundled/channels/SoloWorkspaces.test.tsx index 695d57350e..8a05a0f479 100644 --- a/src/bundled/channels/SoloWorkspaces.test.tsx +++ b/src/bundled/channels/SoloWorkspaces.test.tsx @@ -249,13 +249,22 @@ it("keeps chats after project deletion and allows retry after a rejected deletio await user.click( await screen.findByRole("menuitem", { name: "Delete workspace" }), ); - expect(await screen.findByRole("alert")).toHaveTextContent( + const dialog = await screen.findByRole("alertdialog", { + name: "Delete Work?", + }); + await user.click( + within(dialog).getByRole("button", { name: "Delete workspace" }), + ); + // A failure stays in the dialog, so Delete workspace retries it there. + expect(await within(dialog).findByRole("alert")).toHaveTextContent( "Deletion unavailable", ); - expect(screen.getByRole("button", { name: "Work" })).toBeVisible(); - await user.click(screen.getByRole("button", { name: "Actions for Work" })); + // The workspace stays, behind the dialog. + expect( + screen.getByRole("button", { name: "Work", hidden: true }), + ).toBeInTheDocument(); await user.click( - await screen.findByRole("menuitem", { name: "Delete workspace" }), + within(dialog).getByRole("button", { name: "Delete workspace" }), ); await waitFor(() => expect(screen.queryByRole("button", { name: "Work" })).toBeNull(), @@ -263,10 +272,46 @@ it("keeps chats after project deletion and allows retry after a rejected deletio await waitFor(() => expect(screen.getByRole("button", { name: "Planning" })).toBeVisible(), ); + expect(screen.queryByRole("alertdialog")).toBeNull(); + await waitFor(() => + expect(screen.getByRole("button", { name: "Chats" })).toHaveFocus(), + ); expect(h.saved().assignments).toEqual({}); owner.dispose(); }); +it("asks before deleting a workspace, and Cancel or Escape keeps it", async () => { + const h = fixture(); + const owner = h.store(); + const user = userEvent.setup(); + await owner.queries.ensure(); + await owner.queries.assign("chat", "work"); + render(h.view(owner.queries)); + for (const dismiss of ["cancel", "escape"]) { + await user.click(screen.getByRole("button", { name: "Actions for Work" })); + await user.click( + await screen.findByRole("menuitem", { name: "Delete workspace" }), + ); + const dialog = await screen.findByRole("alertdialog", { + name: "Delete Work?", + }); + expect(dialog).toHaveAccessibleDescription( + "Its chats move to Chats. Its instructions, folders and agents are cleared on all your devices. It can't be undone.", + ); + const cancel = within(dialog).getByRole("button", { name: "Cancel" }); + await waitFor(() => expect(cancel).toHaveFocus()); + if (dismiss === "cancel") await user.click(cancel); + else await user.keyboard("{Escape}"); + await waitFor(() => expect(screen.queryByRole("alertdialog")).toBeNull()); + await waitFor(() => + expect(screen.getByRole("button", { name: "Work" })).toHaveFocus(), + ); + } + expect(h.remove).not.toHaveBeenCalled(); + expect(screen.getByRole("button", { name: "Planning" })).toBeVisible(); + owner.dispose(); +}); + it("starts an unfiled chat from the Chats heading plus without collapsing it", async () => { const h = fixture(); const owner = h.store(); @@ -662,7 +707,7 @@ it("opens the inline rename editor from the row actions menu", async () => { owner.dispose(); }); -it("prevents rename in a deleting workspace while other workspaces remain editable", async () => { +it("holds the delete confirmation open while it runs and allows rename after", async () => { const h = fixture(); Object.assign(h.details, { available: true, @@ -696,18 +741,24 @@ it("prevents rename in a deleting workspace while other workspaces remain editab await user.click( await screen.findByRole("menuitem", { name: "Delete workspace" }), ); - await waitFor(() => - expect(h.remove).toHaveBeenCalledWith("work", expect.any(AbortSignal)), + const dialog = await screen.findByRole("alertdialog", { + name: "Delete Work?", + }); + await user.click( + within(dialog).getByRole("button", { name: "Delete workspace" }), ); - await user.dblClick(screen.getByRole("button", { name: "Planning" })); - expect(screen.queryByRole("textbox", { name: "Chat name" })).toBeNull(); - await user.dblClick(screen.getByRole("button", { name: "Existing chat" })); await waitFor(() => - expect( - screen.getByRole("textbox", { name: "Chat name" }), - ).not.toHaveAttribute("readonly"), + expect(h.remove).toHaveBeenCalledWith("work", expect.any(AbortSignal)), ); + // While the delete runs, the dialog can't be dismissed. + expect( + within(dialog).getByRole("button", { name: "Cancel" }), + ).toBeDisabled(); await user.keyboard("{Escape}"); + expect(dialog).toBeVisible(); + // The pending dialog is modal, so no row behind it can start a rename. + expect(screen.queryByRole("button", { name: "Planning" })).toBeNull(); + expect(screen.queryByRole("textbox", { name: "Chat name" })).toBeNull(); } finally { release(); } diff --git a/src/bundled/channels/SoloWorkspaces.tsx b/src/bundled/channels/SoloWorkspaces.tsx index 775879852b..94a7b8a664 100644 --- a/src/bundled/channels/SoloWorkspaces.tsx +++ b/src/bundled/channels/SoloWorkspaces.tsx @@ -40,6 +40,7 @@ import { } from "react"; import type { RelaySession } from "../../features/relay/session"; import { readView, writeView } from "../../shared/view-state"; +import { AlertDialog } from "../../shared/design-system/ui/AlertDialog"; import { Button } from "../../shared/design-system/ui/Button"; import { NavigationSectionHeading } from "../../shared/design-system/ui/NavigationSection"; import { IconButton } from "../../shared/design-system/ui/IconButton"; @@ -204,7 +205,14 @@ export function SoloWorkspaces({ if (renaming && !chats.some((chat) => chat.id === renaming)) setRenaming(undefined); const [deleting, setDeleting] = useState(); + // The workspace whose Delete workspace is awaiting confirmation. + const [confirmDelete, setConfirmDelete] = useState<{ + id: string; + name: string; + }>(); + const cancelDelete = useRef(null); const [projectError, setProjectError] = useState(""); + const [deleteError, setDeleteError] = useState(""); const [readError, setReadError] = useState<{ id: string; message: string }>(); const [animate, setAnimate] = useState(false); const [rowFocus, setRowFocus] = useState(); @@ -257,6 +265,32 @@ export function SoloWorkspaces({ const assignmentFor = (item: ChatListItem) => dormantAssignments?.has(item.id) ? undefined : assigned[item.id]; const ids = new Set(groups.map((group) => group.id)); + // A workspace deleted elsewhere takes its confirmation with it. + if ( + confirmDelete && + deleting !== confirmDelete.id && + !ids.has(confirmDelete.id) + ) + setConfirmDelete(undefined); + const closeDelete = () => { + setDeleteError(""); + setConfirmDelete(undefined); + }; + const deleteProject = (id: string) => { + setDeleting(id); + setDeleteError(""); + void preferences + .removeSection(id) + .then(() => setConfirmDelete(undefined)) + .catch((error: unknown) => { + setDeleteError( + error instanceof Error + ? error.message + : "Workspace could not be deleted. Try again.", + ); + }) + .finally(() => setDeleting(undefined)); + }; const activeDraft = drafts.find((draft) => draft.selected); const draftProject = activeDraft ? ids.has(activeDraft.projectId ?? "") @@ -542,18 +576,10 @@ export function SoloWorkspaces({ renamingProject === project.id } onClick={() => { - setDeleting(project.id); - setProjectError(""); - void preferences - .removeSection(project.id) - .catch((error: unknown) => { - setProjectError( - error instanceof Error - ? error.message - : "Workspace could not be deleted. Try again.", - ); - }) - .finally(() => setDeleting(undefined)); + const { id, name } = project; + setDeleteError(""); + // Let the menu restore focus before opening confirmation. + requestAnimationFrame(() => setConfirmDelete({ id, name })); }} > Delete workspace @@ -900,6 +926,52 @@ export function SoloWorkspaces({ ))} + {confirmDelete && ( + group.id === confirmDelete.id)?.name ?? confirmDelete.name}?`} + description="Its chats move to Chats. Its instructions, folders and agents are cleared on all your devices. It can't be undone." + pending={deleting === confirmDelete.id} + initialFocus={cancelDelete} + // Back to the workspace's heading, or to Chats, which now holds its + // chats, once the workspace is gone. + finalFocus={() => + document.querySelector( + `[data-solo-menu-id="project-${CSS.escape(confirmDelete.id)}"] button`, + ) ?? + document.querySelector( + '[data-solo-menu-id="project-"] button', + ) ?? + false + } + onClose={closeDelete} + actions={ + <> + + + + } + > + {deleteError && ( +

+ {deleteError} +

+ )} +
+ )} {settingsFor && ( Date: Tue, 17 Nov 2026 14:40:21 -0500 Subject: [PATCH 2/3] fix(solo): show a plain error when deleting a workspace fails The delete confirmation showed removeSection's raw error, e.g. "Please wait a second before saving this recipe again". Those messages are written for developers ("recipe", "Outbox", "Sidebar section"), and the dialog now puts them front and centre. Always show "Workspace could not be deleted. Try again." instead; the dialog stays open, so Delete workspace retries. Raised in the agent design review on #3282. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Jonathan Ho --- src/bundled/channels/SoloWorkspaces.test.tsx | 2 +- src/bundled/channels/SoloWorkspaces.tsx | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/bundled/channels/SoloWorkspaces.test.tsx b/src/bundled/channels/SoloWorkspaces.test.tsx index 8a05a0f479..79582feda8 100644 --- a/src/bundled/channels/SoloWorkspaces.test.tsx +++ b/src/bundled/channels/SoloWorkspaces.test.tsx @@ -257,7 +257,7 @@ it("keeps chats after project deletion and allows retry after a rejected deletio ); // A failure stays in the dialog, so Delete workspace retries it there. expect(await within(dialog).findByRole("alert")).toHaveTextContent( - "Deletion unavailable", + "Workspace could not be deleted. Try again.", ); // The workspace stays, behind the dialog. expect( diff --git a/src/bundled/channels/SoloWorkspaces.tsx b/src/bundled/channels/SoloWorkspaces.tsx index 94a7b8a664..45b0d4a70e 100644 --- a/src/bundled/channels/SoloWorkspaces.tsx +++ b/src/bundled/channels/SoloWorkspaces.tsx @@ -282,13 +282,9 @@ export function SoloWorkspaces({ void preferences .removeSection(id) .then(() => setConfirmDelete(undefined)) - .catch((error: unknown) => { - setDeleteError( - error instanceof Error - ? error.message - : "Workspace could not be deleted. Try again.", - ); - }) + // Removal errors are written for developers ("recipe", "Outbox"), so + // show one plain message; the dialog stays open for retry. + .catch(() => setDeleteError("Workspace could not be deleted. Try again.")) .finally(() => setDeleting(undefined)); }; const activeDraft = drafts.find((draft) => draft.selected); From 258d209006aad5be2c31c392356618676b85f4e1 Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Tue, 17 Nov 2026 14:55:11 -0500 Subject: [PATCH 3/3] fix(solo): say what deleting a workspace keeps, with its real chat count "Its instructions, folders and agents are cleared" read as if the agents themselves were deleted. Only the workspace's own agent list goes (#2819); the agents stay in Agents. The dialog now says "agent list" and "your agents aren't deleted", matching Delete team. It also said "Its chats move to Chats" for an empty workspace. It now uses the real count ("1 chat moves", "2 chats move"), as Remove section does, and leaves the sentence out when there are none. Raised in the agent design review on #3282. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Jonathan Ho --- docs/buzz-help.md | 2 +- src/bundled/channels/SoloWorkspaces.test.tsx | 22 +++++++++++++++++++- src/bundled/channels/SoloWorkspaces.tsx | 14 ++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/docs/buzz-help.md b/docs/buzz-help.md index a786d36775..780c517dd0 100644 --- a/docs/buzz-help.md +++ b/docs/buzz-help.md @@ -504,7 +504,7 @@ and are asked to sign in again in Buzz. that chat's first message, **#** offers its workspaces too, and choosing one files the chat right away. **Delete workspace**, in the workspace's **…** menu, asks first: its chats move to **Chats**, and its instructions, folders - and agents are cleared on all your devices. + and agent list are cleared on all your devices. Your agents aren't deleted. - **Channel links.** Type **#** and part of a channel name to link a channel. The link is a chip: Backspace or Delete removes it whole, so to change it, remove it and pick again with **#**. diff --git a/src/bundled/channels/SoloWorkspaces.test.tsx b/src/bundled/channels/SoloWorkspaces.test.tsx index 79582feda8..6d65c047c1 100644 --- a/src/bundled/channels/SoloWorkspaces.test.tsx +++ b/src/bundled/channels/SoloWorkspaces.test.tsx @@ -280,6 +280,26 @@ it("keeps chats after project deletion and allows retry after a rejected deletio owner.dispose(); }); +it("leaves the chat count out when deleting an empty workspace", async () => { + const h = fixture(); + const owner = h.store(); + const user = userEvent.setup(); + await owner.queries.ensure(); + render(h.view(owner.queries)); + await user.click( + await screen.findByRole("button", { name: "Actions for Work" }), + ); + await user.click( + await screen.findByRole("menuitem", { name: "Delete workspace" }), + ); + expect( + await screen.findByRole("alertdialog", { name: "Delete Work?" }), + ).toHaveAccessibleDescription( + "Its instructions, folders and agent list are cleared on all your devices, but your agents aren't deleted. It can't be undone.", + ); + owner.dispose(); +}); + it("asks before deleting a workspace, and Cancel or Escape keeps it", async () => { const h = fixture(); const owner = h.store(); @@ -296,7 +316,7 @@ it("asks before deleting a workspace, and Cancel or Escape keeps it", async () = name: "Delete Work?", }); expect(dialog).toHaveAccessibleDescription( - "Its chats move to Chats. Its instructions, folders and agents are cleared on all your devices. It can't be undone.", + "1 chat moves to Chats. Its instructions, folders and agent list are cleared on all your devices, but your agents aren't deleted. It can't be undone.", ); const cancel = within(dialog).getByRole("button", { name: "Cancel" }); await waitFor(() => expect(cancel).toHaveFocus()); diff --git a/src/bundled/channels/SoloWorkspaces.tsx b/src/bundled/channels/SoloWorkspaces.tsx index 45b0d4a70e..1b707f97ec 100644 --- a/src/bundled/channels/SoloWorkspaces.tsx +++ b/src/bundled/channels/SoloWorkspaces.tsx @@ -73,6 +73,15 @@ import { SidebarRowRenderer } from "../../features/channel-navigation/SidebarRow const emptyRows: readonly RegisteredSidebarRows[] = []; +/** What deleting a workspace does, with its real chat count. */ +function deleteDescription(chatCount: number) { + const chats = + chatCount === 0 + ? "" + : `${chatCount} ${chatCount === 1 ? "chat moves" : "chats move"} to Chats. `; + return `${chats}Its instructions, folders and agent list are cleared on all your devices, but your agents aren't deleted. It can't be undone.`; +} + /** Presentation only. The caller supplies authorized, saved chats. */ export type ChatListItem = Readonly<{ id: string; @@ -926,7 +935,10 @@ export function SoloWorkspaces({ group.id === confirmDelete.id)?.name ?? confirmDelete.name}?`} - description="Its chats move to Chats. Its instructions, folders and agents are cleared on all your devices. It can't be undone." + description={deleteDescription( + projects.find((project) => project.id === confirmDelete.id)?.rows + .length ?? 0, + )} pending={deleting === confirmDelete.id} initialFocus={cancelDelete} // Back to the workspace's heading, or to Chats, which now holds its