Repository navigation
feat(chat): create a folder from a session's Move to folder menu - #23436
Conversation
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS No blind reader has seen this change. This fork lane has none, and pushing the branch to this repository would add one. The 14 committed screenshots show every control and state the diff adds: the "New folder…" entry online and offline, the dialog filled, closed-session, offline, move-failed/Retry move and folder-list error, plus narrow width. Notes
[UX-REVIEWED] e7ac4ce Description read[DESCRIPTION-READ] b2878d6331f70249da65f12d082af8281300b3203550971ed40b28e5aee73c0e That sha256 names everything this verdict read: the PR description, plus the 17 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a real reported friction, solved by an additive menu entry and a dialog hosted by a provider. All 14 committed screenshots of this revision are in the evidence list. Notes
[DESIGN-REVIEWED] e7ac4ce Description read[DESCRIPTION-READ] c279c1ad27a8bbbdd6dd2fc91eb2b4f60368db562ca9048e81ee5a7f41e331b1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The feature closes a linked issue (#22779). The dialog's retry path handles edge cases the Goal never asked for. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: file a session into a brand-new folder from its own menu without three detours. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] e7ac4ce Description read[DESCRIPTION-READ] 446c19945a8a2dd2f160412c1b480233df67a1e22f467a72112d6884dad49ad9 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
a76d52e to
885e8ef
Compare
885e8ef to
4d0ac3d
Compare
4d0ac3d to
d46e888
Compare
d46e888 to
908ffd5
Compare
908ffd5 to
359566d
Compare
845735b to
9c86f00
Compare
|
note (non-blocking): 9c86f00 is a same-tree retrigger of 845735b; the tree and parent are identical, no code changed. The Fork GPT 6.1 Review lane on 845735b failed at its first step on a GitHub API error (run 40169518366) and never posted its check-run, so PR Readiness waited on it with no way to finish. |
9c86f00 to
54a5f83
Compare
|
chore (non-blocking): 54a5f83 is 9c86f00 rebased on main to clear the merge conflict, no behaviour change in this PR's code. #25793 added |
|
@iamwhatever could you take a look when you have a moment? Every lane is clean on 54a5f83. Opus and GPT have no findings, and UX, Design, First Principles and Security Scope pass. Two things need a maintainer:
|
Filing a session into a folder that does not exist yet meant leaving the menu, creating the folder in the sidebar, then reopening the menu to move the session. The session menus' "Move to folder…" submenu now ends with "New folder…". It opens a small dialog that names the folder, creates it, and moves the session into it in one step. A session already in a folder is offered the new folder inside that one. The entry is gated offline like the sidebar's own New folder row, and the dialog says in place why Create is held. The dialog closes only once the server has acknowledged the move, takes one submit at a time, keeps keyboard focus inside itself during a write, and refuses every dismissal while a write is in flight. A refused create keeps the name; a refused move names the folder it created, and where, then retries the move alone, re-creating the folder if it was deleted meanwhile. An awaitable variant of the shared move hook carries the same optimistic update and rollback. The dialog renders once per chat page beside its context provider, because a Radix menu unmounts its content on pick, so both the sidebar row menus and the chat header menu open the same dialog. The cache seed the sidebar's create already did moves into a shared helper both use. Closes kirodotdev#22779
54a5f83 to
e7ac4ce
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Approve at e7ac4ce.
The feature is sound. The picker gains an optional "New folder…" entry, and callers that do not pass onNewFolder are unchanged. The dialog's submit path guards double submits and creates nothing for a closed session. It awaits the same optimistic move with rollback, and after a failed move it retries without creating a second folder. The cache seed is the sidebar's code moved verbatim into seedCreatedChatFolder.
Every item from our r124 review has a disposition: the missing captures were added, the offline reason and the parent name now show in the dialog, and the two deferred notes are tracked in #24179 (remove the retry re-read) and #24178 (submenu width). Both issues are open and assigned, and their bodies cover the items. They still need the deferred-finding label, which the author cannot add. Please also list them under Related Issues in the description; today they are linked only from the disposition comments. Every check on this head is green.
AI findings judged non-blocking:
- UX: the folder-list error does not state its consequence. This is wording only, and the offer keeps the parent name it last read (L62-L66).
- UX: no capture of the dialog for a session outside any folder. That dialog is the captured one without the checkbox, and tests pin the path.
- Design: a failed move leaves the new folder until Retry. The lane calls this reasonable, and the notice says the folder exists.
- First Principles item 6: the closed-session hold is more than the goal needs. It causes no harm and stops a create for a session that is gone.
— crew-pr-reviewer (r136)
Problem / Motivation
Goal: file a session into a folder that does not exist yet without leaving its menu.
A session's "Move to folder…" submenu lists only existing folders. To put a session into a new folder you leave the menu, create the folder from the sidebar, then reopen the menu and move the session (#22779).
Why it matters
Sessions get sorted while you work, often into a folder you have just decided you need. Three detours for one move is the friction the issue describes.
Not a goal
createFolderMutation. That mutation lives in the sidebar shell, which the header menu's dialog cannot reach. The dialog seeds the cache and refetches through the same shared helper, and like that create it carries noCHAT_FOLDERS_WRITE_KEY: a refetch already in flight when the create lands is cancelled and reissued by the helper's idle-gatedinvalidateQueries, or, while another folder write is pending, by that write's own settle.What changed (motivation → approach → change)
FolderMoveSubmenu.tsx: optionalonNewFolder/newFolderLabelprops.FolderPickerItemsthen ends the list with a separator and a "New folder…" item (FolderPlus icon, styled like the Schedule page's cron move menu). The item is gated offline withofflineMenuRowandutils.offline.create_folders, the same as the sidebar's own New folder row: dimmed, named why, refused on select with the submenu left open overOfflineMenuReason. The connection read sits in a smallNewFolderEntrycomponent, so callers that render the picker without a store are unaffected.SessionActionsMenu.tsx: passesonNewFolderwhen the dialog's provider is present. Outside the provider the hook returns null and the entry is left out, so no menu shows an entry that does nothing.hooks/useNewFolderMove.tsx(new): the provider and hook holding which slot the dialog is open for, the same shape asuseTagPopover.components/NewFolderMoveDialog.tsx(new), built on the sharedModal:requestSlotFolderOpen, which expands collapsed ancestors and keeps the sidebar's view, search and filters as they are.api.createChatFolder, seed the['chat-folders']cache, then the move, awaited. The dialog closes only once the server has acknowledged the move.ErrorNotice, because nothing failed.ErrorNoticerather than silently dropping the "Create inside" offer, and the offer keeps the parent's name if a refetch briefly lacks it.Modal'sdismissDisabled, Cancel disabled), the pattern the sidebar's folder modal uses, so a write cannot settle into a dialog that was cancelled. A typed name also guards against an accidental backdrop click or Escape. If the page unmounts the dialog mid-write anyway, the settling write touches neither its state nor the provider, so it cannot close a dialog opened since for another session.ErrorNotice(no hand-off: the typed name is an unsaved draft). A failed create keeps the name. A failed move after a successful create says the folder was created (under the name the server stored, and inside which folder when it was created in one), fixes the name, greys the name field, and turns the button into Retry move, which moves into that folder without creating another. Retry first re-reads the folder list; if that folder was deleted elsewhere in the meantime, it is created again in the same place rather than failing on every retry, and if it was renamed or its parent changed, the notice names it as it is now. A create reply without an id is reported rather than moving the session nowhere. Create is held while the gateway is offline, and a status line in the dialog says why (OfflineReasonRowwith the existing "Gateway offline — reconnect to {{action}}" sentence): "create folders" before the create, "move sessions" once the folder exists and only the move is left. The button points at that line witharia-describedby. The closed-session line hides while offline, where the session list cannot say either way.hooks/useMoveSlotToFolder.ts:useMoveSlotToFolderAsync, the same optimistic move and guarded rollback asuseMoveSlotToFolder(one shared mutation), returned as a promise that settles with the server's answer. It runs withnetworkMode: 'always'(asuseChatPaneUploadsdoes), so a browser that reports offline while a local gateway is reachable does not pause the move and leave the dialog holding its dismissals. The existing hook keeps React Query's default network mode, so its callers are unchanged.ChatPageFrame.tsx: wraps the page inNewFolderMoveProviderand renders the dialog right inside it, so every surface that can open it has it.api/chatFoldersWrite.ts:seedCreatedChatFolder, the cache seed the sidebar's create mutation already did (only into a list that already loaded, then the idle-gated refetch), moved here so the sidebar and the dialog share it.chat-sidebar/folders.tscalls it; its behaviour is unchanged.components.sessionActionsMenu.new_folder, acomponents.newFolderMoveDialogblock and the offline verbutils.offline.move_sessions, in all 12 catalogs, following each language's style guide (hi and bn address the reader as तुम / তুমি; fr puts U+202F inside guillemets and before:), plus the regenerated pseudolocale.website/scripts/capture-22779-new-folder-move.mjs: the screenshot harness below.Backwards compatibility
Compatible: the new props are optional and every existing caller of
FolderMoveSubmenu/FolderPickerItemsrenders as before unless it passesonNewFolder. No route or API changes; the dialog uses the existingPOST /api/chat/foldersandPATCH /api/chat/slots/<key>/folder.Removes nothing: the sidebar's cache seed moved into a shared helper with the same behaviour; no route, field, key or function is removed or tightened.
Tests
website/src/test/NewFolderMoveDialog.test.tsx(new, 34 tests):FolderPickerItemsends with "New folder…" below a separator and calls back on select; offline it isaria-disabled, names why, refuses the select and shows the offline reason; with no callback the list is unchanged.openFoldersOnly; unticked creates at the top level; offline Create is held with the name kept and the reason shown in the dialog, clearing on reconnect; a failed create keeps the dialog, the name and the session's folder and shows the server's message; a reply without an id is reported and nothing moves; Cancel writes nothing.NewFolderMoveDialog.tsx100%,useNewFolderMove.tsx100%,useMoveSlotToFolder.ts100%,chatFoldersWrite.ts100%,FolderMoveSubmenu.tsx92%.src/i18n/navLabels.test.tsxtimes out the same way on an untouched main checkout.I18N_BASE_REF=origin/main, so the per-language style gates judge the changed values as CI does: all style tests pass (navLabels.test.tsxtimes out locally, as it does on main).tsc -p tsconfig.app.json, eslint on the changed files,lint:i18n,i18n:check, jscpd (0 clones),gen-ui-index --check, the brand-name, focus-cue and feature-map gates, the flake-pattern ratchet, the code-review frontend greps, and the SAST job's Semgrep configs (0 findings) all pass.Manual verification
The real built SPA with every
/api/**call answered by stateful fixtures (capture-22779-new-folder-move.mjs), in dark and light themes. The harness asserts each step:Storyboards, tick the offer, Create and movePOST /api/chat/folders{name: "Storyboards", parent_id: "f-video"}, onePATCH …/s1/folder{folder_id: "f-new"}; the dialog closes and the session sits in Video Projects › StoryboardsPATCH …/folderanswered 503Screenshots / video
Related Issues
Closes #22779
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.