Skip to content

chat: a chat can be deleted from its row's menu - #8

Merged
foxnne merged 1 commit into
chat/tree-lookfrom
chat/delete-chat
Oct 16, 2026
Merged

foxnne merged 1 commit into
chat/tree-lookfrom
chat/delete-chat

Conversation

@foxnne

@foxnne foxnne commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Stacked on #7 (then #6, #5).

What changes

A chat row in the Chats sidebar now has a right-click menu, drawn as a file row's is
(core.widgets.context + contextMenu + menuRow): Open and, below a separator,
Delete.

Delete does what the workbench file tree's Delete does, which I read in files.zig (rowMenu)
and fizzy's files service (FilesService.delete): at once, for good, no confirmation, and
whatever was open on it closes. For a chat:

  1. If it is open in a tab, the tab closes first (Host.closeDocById). That runs the chat's
    normal close: its client is told (chat_closed; the agent client ends the session and its
    agent process) and the transcript is saved a last time. If the tab does not close (something
    holds the document, sdk.Claim), the chat stays and a warning is logged, so nothing is
    deleted out from under a working tab.
  2. Then the .chat transcript and its <name>.images folder are deleted, and the list reads
    the folder again.

The delete is queued and runs from the plugin's beginFrame, never in the middle of the
sidebar's draw (which may be the frame that is drawing the tab).

chat.delete (internal, .{ .path = "…" }, empty for the chat in front) does the same. It only
deletes a path the list holds, so it cannot be pointed at other files. It is how the change was
driven from a demo tape (below), and it is the seam for a palette or keyboard delete later.

What I did not add, and why:

  • No Delete/Backspace key. The workbench's file tree has none (Delete is only in its row
    menu), so this matches it. chat.delete is what a key binding would call.
  • No OS trash, no confirmation: the file tree uses neither.
  • No "delete this folder's chats" on a group row.
  • The menu's icons are dvui's entypo (chat, trash) because the chat plugin does not depend
    on the icons package the workbench draws lucide's trash-2 from.

Chat.imagesDir became a free function of the transcript's path so the list can find a closed
chat's images.

How it was seen

macOS, Debug fizzy from main, sandbox profile, seeded agent chats (one with an .images
folder), driven by demo tapes:

  • Right-click on an open chat's row: the frosted menu with Open / Delete, same surface as the
    file tree's (captured).
  • chat.delete on the chat open in a tab, then on a closed one with images, then on
    settings.zon: the tab closed, both rows left the tree, both .chat files and the
    .images folder were gone from disk, and the third call was refused ("no chat … is in the
    list"), settings.zon untouched.
  • Live agent: with the agent command set to sleep 600, a chat made by the folder's + started
    its agent (a sleep child of fizzy, seen with pgrep -P), and chat.delete on it closed the
    tab, removed the row and the file, and the child process was gone 4s later. No warnings in the
    log.

A demo tape could not click the menu's Delete row: in fizzy's tape player any op after a right
click closes the context menu, and the workbench file tree's menu does the same, so the menu row
was checked by capture and code, and the delete itself through chat.delete, which runs the
same function. zig fmt --check and zig build test clean.

🤖 Generated with Claude Code

A chat row's right-click menu has Open and Delete, as a file row's does. Delete works as the
file tree's: at once and for good, with no question first. Its tab closes first, which ends its
client's session (an agent's process with it) and saves it a last time; then its transcript and
its images folder go. A tab that will not close (something holds it, `sdk.Claim`) keeps its
chat. The delete runs as the next frame begins, not inside the sidebar's draw.

`chat.delete` does the same for a chat in the list, by path (empty: the chat in front); it
refuses any path the list does not hold.
@foxnne
foxnne marked this pull request as ready for review October 16, 2026 14:44
@foxnne
foxnne added this pull request to stack #12 October 16, 2026 14:53
@foxnne
foxnne merged commit cfbcaad into main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant