Repository navigation
feat(sidebar): show a crew's own folders inside its crew group - #18766
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check one cost: every connected crew now gets an What this change shipsInventory (8 items) — 8 justifiedIntent: when chats live on another machine, a person can still see which of that crew's folders each chat belongs to (#18745, RFC
[FIRST-PRINCIPLES-REVIEWED] 4804c90 Description read[DESCRIPTION-READ] f0816680f1a6d0faa73d54c4c1d9e2e606f65bf6c6d1049716c03231411dc50b That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one thing before merge: does each hub's 60-second [DESIGN-REVIEWED] 4804c90 Description read[DESCRIPTION-READ] 9c7c5f1a87b1ee7fdcc4640896889f3fb29316351b3ff9a52ca2f98757f18e96 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 |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The folder-failure notice shows raw proxy text and an "Ask the agent" action the blind reader didn't understand, next to a green "Online" badge. Watch
Evidence gaps
[UX-REVIEWED] 4804c90 Description read[DESCRIPTION-READ] 0227ece20dcb1e934c442a507f2d478f537b69948fb6c208b33698427e631abb That sha256 names everything this verdict read: the PR description, plus the 7 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
89fa8a3 to
c52a97f
Compare
|
|
|
|
|
|
|
c52a97f to
affcdfa
Compare
|
|
|
|
|
ebe289a to
4804c90
Compare
|
|
|
|
|
buluoray
left a comment
There was a problem hiding this comment.
Verdict: approve. A crew group now nests its chats under that crew's own folders, as a read-only copy of the crew's tree. The data stays scoped per crew, users without the preview see nothing new, and nothing blocking survived verification.
What it brings
With many chats on a crew, the crew group used to be one flat list, so you could not tell which project each chat belonged to. Now the group reads machine → folder → chat. It uses the crew's own folder names and stored order, puts unfiled chats last, and lets each folder collapse on its own. Folders are still edited on the crew. If the crew's folder list cannot be read, the group lists its chats flat as before and says why.
Verified (at 4804c90287ea61d88e565a47c5308a410d71919e)
- Default users are unchanged. The folder reads are gated by the same
enabled && isConnected(inst)as the slot reads (website/src/hooks/useInstanceSessions.ts:466,:481). With the preview off,crewGroupsForis never called (website/src/pages/chat-sidebar/sessionSources.ts:161), so there are no groups, no folder requests and no new DOM. - A crew's folders can never land in a local folder.
- The crew's folder id travels as
peer_folder_id, never asfolder_id(useInstanceSessions.ts:421). Local placement, the folder filter and drag never readpeer_folder_id. - Local slots whose turns run on a crew have no
peer_folder_id, so they list as unfiled inside that crew's group.
- The crew's folder id travels as
- One crew's folders never show under another crew.
- The folder list is keyed by instance id, and each group gets only its own instance's list (
crewGroupsFor). - Rows reach a group through
crewOf. - Collapse state is keyed by
JSON.stringify([crew, folder])(website/src/pages/chat-sidebar/CrewGroups.tsx:69), so two crews that use the same folder id do not share it.
- The folder list is keyed by instance id, and each group gets only its own instance's list (
- No chat disappears.
- A row whose folder the crew did not list counts as unfiled (
CrewGroups.tsx:81). - Every folder the tree walk skips (parent cycles, anything deeper than 20 levels) is added back at the top level (
website/src/utils/folderTree.ts:298). So every folder that holds a row gets a header, and its rows render.
- A row whose folder the crew did not list counts as unfiled (
- Bad folder data from the crew is handled.
peerFoldersOf(useInstanceSessions.ts:249) drops entries without a stringidandname, keeps the first of any repeated id, and treats a non-finiteorderas 0.- Folder names render as React text.
- The new field is allowlisted and redacted.
folder_idwas added to_PEER_SLOT_STR_FIELDS(src/kiro_crew/dashboard/handlers_instances.py:1973), which passes through_cap_str(redact, then clamp) likekey. - No new route. The folder list comes from the crew's existing
GET /api/chat/folders. That route returns a bare list (chat_folders.py,api_chat_folders), which matches whatpeerFoldersOfexpects. It goes through the existing owner-onlyapi/chatproxy prefix. - Folder read failures fail closed.
- If the read fails with nothing cached, the chats render flat under a notice (
CrewGroups.tsx:214). - If it fails after an earlier success, the cached tree is kept.
- A disconnected crew's old error is not reported (
useInstanceSessions.ts:456).
- If the read fails with nothing cached, the chats render flat under a notice (
- The recorded folder geometry holds.
docs/decisions/2026-10-09-folder-glyph-sits-on-its-connector-line.mdsets the folder layout. Crew folder headers use the local header's 14px pad, 14px glyph andgap-[5px], and their bodies reuseFolderBody+FOLDER_BODY_CLSwithFOLDER_BODY_OPEN_PADDING. I checked the classes, not pixels on a render. - The design it implements. It follows design section 1 of
docs/request-for-change/rfc-remote-crew-sidebar.md: folders apply within a group. I found no recorded decision it contradicts. - Relationship with #18767 (one switch for Chat on a crew):
- No textual conflict (
git merge-tree --write-treeis clean both ways and againstmain). - On the merged tree, the related vitest files pass (5 files, 77 tests) and
tscis clean. - This PR's tests seed the old
instance-sessionskey, which #18767 keeps reading as on. - Suggested order: #18767 first, since it makes crew groups appear at all for Chat on a crew users. Neither PR depends on the other at the code level. Re-run CI on whichever lands second.
- No textual conflict (
Non-blocking follow-ups
- Spec and user docs don't mention crew folders yet.
- The peer-session row in
docs/feature-map/README.mdand the sidebar paragraph indocs/system-specs/modules/history.mddescribe a crew group without its folders. src/kiro_crew/docs/remote-crew.mdstill lists "Folders and drag" under what a peer row lacks, with no line saying the crew's own folders now show read-only.- A sentence in each would keep them in step.
- The peer-session row in
- No test pins that a crew row never carries a local
folder_id. Addingfolder_idnext topeer_folder_idon peer rows leavescrewSpacesandChatSidebar.machineGroupsgreen, so the guarantee holds by construction rather than by test. A test asserting that a peer row filed in a crew folder whose id matches a local folder stays out of that local folder would cover it. - Polling cost on the crew. Each open hub tab asks every connected crew for its folders once a minute, and that route counts archived sessions on disk on every call. That is fine at today's scale; if it shows up on a busy crew, a lighter folders-only read would help.
Tests and mutations
- I ran the targeted tests only:
- vitest:
crewSpaces,ChatSidebar.machineGroupsandChatSidebar.ownerComposition, 31/31 passed. - pytest:
test_remote_crew_peer_slots.py, 45 passed.
- vitest:
- Mutations (each restored afterwards, worktree clean):
- Removing
folder_idfrom the allowlist turns redtest_only_the_fields_the_sidebar_reads_are_forwardedandtest_every_field_the_sidebar_reads_survives. - Removing the repeated-id check in
peerFoldersOfturns redkeeps only well-formed folders from a peer reply. - Filing rows under unknown folder ids turns red
files a row whose folder is unknown as unfiledandnests each chat under the crew's own folder, unfiled chats last. - Dropping the folder-failure branch turns red
lists the chats flat when the crew's folder read fails. - Keying collapse state by folder id alone turns red
collapses one space on its own and remembers it. - Also setting a local
folder_idon peer rows turns nothing red (see follow-ups).
- Removing
- CI at this head: 89 success, 9 skipped, 0 failure, 0 pending. Auto-merge is off and there are no reviews yet.
Not verified
- I did not run the full frontend or backend suites; CI covers those.
- I did not measure pixel alignment on a live render. The capture script is in the PR, but I did not run it.
- I did not check against a real two-machine setup, or a crew on an older build that sends no
folder_id. That case follows the flat path in code.
Problem / Motivation
Goal: A crew group in the Sessions sidebar shows the crew's own folders (spaces), so it reads machine -> space -> chat.
Today a crew group is one flat list of the crew's chats. The crew files those chats into folders on its own sidebar, but none of that reaches the hub. A real test reported it as "chat session lacks space": with many chats on a crew you cannot tell which project each one belongs to.
Why it matters
Folders are how people sort chats. A crew group without them loses that sorting the moment a chat lives on another machine, and the list gets harder to scan as the crew's chat count grows.
Not a goal
What changed (motivation → approach → change)
The crew already knows where each chat is filed; the hub just dropped it. The chat-slots route forwards each crew row through a strict allowlist, and
folder_idwas not on it.handlers_instances.pychat-slots allowlistfolder_id, clamped and redacted likekeyapi/chat/foldersthrough the existing owner-only, redacting proxy (theapi/chatrow already admits it), once a minute per connected crewuseInstanceSessions.tspeer_folder_id(neverfolder_id, which names a LOCAL folder) and returns each crew's checked folder listCrewGroups.tsxorderFoldersWithPathswalk, which puts cycle members at the top and stops at 20 levels, so the tree always ends and every chat showsA crew whose folder read fails lists its chats flat, as today, under an
ErrorNoticethat says so (one new string,crew_spaces_unavailable, in everywebsite/src/i18n/localescatalog). An older crew that sends nofolder_idshows the same flat list as today. No new proxy prefix and no new route.This is design section 1 of rfc-remote-crew-sidebar (status
partial): "Folders, pins and the conductor lane apply within a group."Backwards compatibility
Compatible: one more optional field on the chat-slots reply; a hub or crew on an older build simply lists the crew's chats flat, as today.
Removes nothing: the change only adds a field and a nested rendering; every row the group showed before is still shown, with the same count.
Tests
test_remote_crew_peer_slots.py: the allowlist whole-dict tests now carryfolder_id, so dropping it from the allowlist fails.crewSpaces.test.ts: the tree keeps only folders with a chat below, sorts like the sidebar (stored order, then name, never the browser locale), files unknown-folder rows as unfiled, places a parent cycle at the top, and stops a 20,000-deep chain at 20 levels with its chat kept;crewSpaceChainnames every ancestor;peerFoldersOfdrops malformed and repeated crew folders.ChatSidebar.machineGroups.test.tsx: chats nest under the crew's folders with unfiled last and the group count unchanged; one folder collapses on its own and is remembered; a failed folder read falls back to the flat list and shows the failure notice. Each wait on the instances -> slots/folders chain has an explicit bound.ChatSidebar.ownerComposition.test.tspins the one new owner hook,useCollapsedCrewSpaces.Manual verification
Ran
website/scripts/capture-crew-group-spaces.mjsagainst the dev server: the realChatSidebarover a stubbed crew. Its five behaviour checks pass and it took the shots below. Measured on that render: each crew folder's glyph starts on its connector line's x, and its name lands on its chats' text column.Screenshots / video
The sidebar at its stored 520px width. A local space (
Planning) sits above the crew groupastro, so the two can be compared.Before (what main sends: no folder on the rows), the crew's six chats are one flat list:
After, the same chats sit under the crew's own spaces
Docs(withAPI guidesinside it) andCustomer Support. The headers, counts and connector lines match the localPlanningspace. The unfiled chat comes last, and the emptyArchiveis left out:Customer Supportcollapsed on its own (pointer off the row):When the crew's folder read fails (here a 502), the chats still list flat, under a notice in the crew group:
Related Issues
Closes #18745
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)