Repository navigation
fix: let the person delete an empty folder inside a Bot's folder - #38808
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: an accepted RFC and a decision record back the change, it only loosens one refusal for the person's browser, and five rendered screenshots cover the new menu. [DESIGN-REVIEWED] c08aebe Description read[DESCRIPTION-READ] 3ba4d39157cf0353cbf84de2efbca45566431ed7417701f3d3531cbf8bef9215 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) — ✅ human override accepted@buluoray overrode this lane for |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the blind reader understood the ⋯ menu, "Delete folder" and the confirm dialog on the Bot sub-folder, and said they would use all three. Notes
[UX-REVIEWED] c08aebe Description read[DESCRIPTION-READ] 022297d7ea0fd2d2a0f62078f1bd22a8de4ae5e97aab4d2a8772ee2532ac02dd That sha256 names everything this verdict read: the PR description, plus the 8 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: |
7a3c444 to
e0a57a2
Compare
e0a57a2 to
69b0c1f
Compare
|
/ai-review override first-principles 69b0c1f owner-decision: maintainer Bolin approved the RFC for this change and merged it (#38152 (review)); this PR records that acceptance by setting the RFC status to accepted. |
|
AI-review override not recorded: class |
|
Decision record: the design for this change is RFC #38152, which maintainer @bolichen97 approved (#38152 (review)) and merged. This PR implements that accepted RFC and moves its status from draft to accepted. |
|
/ai-review override first-principles 69b0c1f owner-decision: maintainer approved and merged the RFC this PR implements; this PR records it as accepted: #38808 (comment) |
|
AI-review override not recorded: the handler could not load its command reader (a GitHub read failed, not your command). Re-issue the command. |
|
/ai-review override first-principles 69b0c1f owner-decision: maintainer approved and merged the RFC this PR implements; this PR records it as accepted: #38808 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
This changes behaviour users already rely on, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here. The PR links the merged RFC #38152 as its design. A maintainer should confirm here that this implementation matches it. The author's own override cleared the First-Principles lane on this head (owner-decision, citing the author's comment), and that lane's original finding can no longer be read. This change turns a 403 that main returns into an allowed delete, so a maintainer other than the author should read that finding before merging. Review result: no blocking finding on 69b0c1f.
Optional:
|
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed head 69b0c1faa7. No blocking defect found, but not approving: KiroCrewCaptain asks for a maintainer design sign-off that this implementation matches the merged RFC #38152, and the First-Principles lane was cleared by the author's own override. A maintainer other than the author must sign off.
What I checked:
src/kiro_crew/dashboard/mate_subfolder_delete.py: the allow applies only to the person's browser (is_person_browser: no principal, no internal secret). The Bot home itself still returnsmate_home_locked. Child folders, live and closing sessions and cron jobs are checked inside themutate_folderscallback, archived sessions before it, and an unreadable cron store returns 503 and deletes nothing.- Tests:
test/test_chat_folder_cleanup.py,test/test_mate_folder_routes.py,test/test_mate_folders.pyand the other chat-folder / mate-folder suites pass at head (502 passed,-n 8).
Small items (non-blocking): the RFC body line 17 still says "Status: draft. Nothing is built" while its front matter says accepted, and no vitest covers the board-column menu's new !mateManaged guard.
AI-assisted, sent by Bolin Review bot
69b0c1f to
9ac10ac
Compare
|
Thanks for the review (5952969566). Both small items are fixed in
No code outside the test changed. The open ask is still the maintainer sign-off that the build matches RFC #38152. |
9ac10ac to
85725a3
Compare
|
Disposition for the review of Opus 5.5, BLOCKING,
Design (PASS) and First Principles notes, item 9: the duplicate of the Design note: First Principles BLOCK (the RFC still reads |
85725a3 to
c08aebe
Compare
|
Disposition for GPT 6.1 on GPT 6.1, BLOCKING, security-class,
|
|
/ai-review override first-principles c08aebe owner-decision: maintainer approved and merged the RFC this PR implements; this PR records it as accepted: #38808 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 1108 lines, more than the 400 it may approve on its own. This PR implements the accepted RFC: the person may delete an empty folder inside a Bot's home folder, and "Clean up empty folders" offers such folders. The home folder itself is still refused first. Every caller other than the person's browser (no app or member principal, no internal secret) is still refused with mate_home_locked, and the Bot's own delete path is unchanged. The emptiness checks follow the existing if_empty branch: archived sessions are counted first, then a child folder, a live or closing session, or a cron job filing into the folder is refused inside the folder-store lock, and an unreadable cron store deletes nothing (503). The cleanup keeps the home and any folder inside a Bot's home that holds an archived session or carries a project_dir. A non-browser caller or a root scope inside a Bot's home removes nothing there, and the confirm step re-reads archived counts under the lock. In the sidebar, the menu on an empty folder inside a Bot's home holds Delete folder only, and "empty" counts sessions the person's list hides. Backend and frontend tests cover each path, including cron-save ordering in both directions and a cancelled delete. CI is green. Tier: 2, held for a person: design-doc-gate: D. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
This review checked head c08aebe. The single delete still refuses a Bot's home folder first. A folder inside the home is deleted only when the request comes from the person's browser, meaning no app or member principal and no internal secret header. App, member, MCP and cron-script callers still get mate_home_locked. The checks for child folders, live and closing sessions, and cron-filed folders run inside the folder-store lock. A cron store that cannot be read returns 503. A cancel that lands after the write still pushes and audits. PR Readiness passes on this head.
Security: the only loosening is a 403 that becomes a 200 for the person's own browser, which already holds full authority over every ordinary folder. Other callers keep main's refusal, the Bot home stays refused at the route, under the lock and in the cleanup, and outside Bot homes the cleanup behaves the same as on main.
Done well: one shared predicate, is_person_browser, decides both the single delete and the cleanup. Event-gated tests drive the real folder-store lock, with no sleeps.
The design is signed off under the standing maintainer sign-off for changes by team members.
Optional:
mate_subfolder_delete.py:143: the post-delete steps (icon epoch, pending icon task, slots push, audit) are another copy of the ones inchat_folders_routes.pyandchat_folder_cleanup.py. One shared helper, or a linked follow-up issue, would keep them in step.- The Proof line in the body names head 69b0c1f. Re-running it on c08aebe would also cover the new cancellation tests.
chat_folder_cleanup.py:537: the archive scan under the lock could run only when the caller is the person's browser and some folder sits inside a Bot home.
Fixes #37434
Problem / Motivation
Goal: the person can delete an empty folder inside a Bot's home folder, and "Clean up empty folders" offers it, while the home folder itself stays the Bot's.
A Bot files every folder it makes under its own home folder. When the work in one ends, the empty folder stays in the sidebar for good: the person's delete is refused
mate_home_locked(403), and "Clean up empty folders" skips every folder in a Bot's home, so clicking it does nothing for them.Why it matters
A busy Bot makes one sub-folder per task, so the sidebar fills with empty folders that the person can only clear by deleting the whole Bot or editing
folders.jsonby hand (#37434).Not a goal
What changed (motivation → approach → change)
This implements
docs/request-for-change/rfc-bot-subfolder-person-delete.md, accepted by a maintainer on #38152.Root cause:
api_chat_folder_deleterefused every write into a Bot's home with one test (is_mate_home(target) or refuses_write_into(...)), andremovable_folder_idstreated the whole home subtree as kept.mate_home_lockedmate_home_lockedmate_home_lockedmate_home_lockedfolder_not_empty(409)mate_home_lockedmate_home_lockeddashboard/mate_subfolder_delete.pyholds the person's empty-only delete andis_person_browser(no app, no member, no internal secret). It counts archived sessions first, then, under the folder-store lock, refuses a folder with a child folder, a live or closing session, or a saved cron job filing into it. An unreadable cron store deletes nothing (503).chat_folders_routes.pysends a delete of a folder inside a Bot's home there only whenis_person_browserholds; every other caller is refused as before.chat_folder_cleanup.pyuses the same check. It keeps the home rows, keeps a Bot sub-folder that holds an archived session or carries aproject_dir, and keeps every folder in a Bot's home for any other caller or for arootscope inside a home. The confirm step re-reads archived counts in_prepareunder the lock.website/src/utils/mateFolders.ts(isEmptyBotSubfolder),folderBlocks.tsxandboardLane.tsxopen a Delete-only menu on an empty Bot sub-folder, in the list view and in board columns.session-control.md, the feature map and the path B §6 row name the exception; the RFC moves toacceptedand names each refusal's code;docs/decisions/2026-11-17-the-person-may-delete-an-empty-folder-inside-a-bots-home.mdrecords the maintainer's sign-off.Backwards compatibility
Compatible: a call refused today can now succeed for the person on an empty Bot sub-folder; nothing that works today stops working.
Removes nothing: no field, route or key is removed; the change only allows a delete that was refused.
Tests
test/test_mate_folder_routes.py: the person deletes an empty sub-folder, even one with aproject_dir; one with a child folder, a live, closing, cron-filed or archived session gets 409 and stays; an unreadable cron store gets 503; another Bot, an agent tool call and a delete of the home are refused; a cron job saved before the delete keeps the folder and one saved after it is refused (two event-gated tests on the real folder-store lock).test/test_chat_folder_cleanup.py: the cleanup offers an empty sub-folder and never the home; an icon or color does not keep one, aproject_dirdoes; the confirm keeps one that gained an archived session after the preview; an internal caller and arootscope inside a Bot's home remove nothing.test/test_mate_folders.py: a conductor naming the deleted sub-folder files in its home.website/src/test/ChatSidebar.mateFolderWrites.test.tsx: the empty sub-folder's menu holds only Delete folder; no menu on one with an archived session._folder_history_counts, off the event loop): median 1.4 ms at 1,000 sessions and 6.6 ms at 5,000 on a warm index.Manual verification
node website/capture/shoot-bot-subfolder-delete.mjsrenders the real sidebar with a fixed folder tree, in the list view and in a board column, and asserts: the empty sub-folder shows0at rest like any empty folder; its menu holds one item, Delete folder; no menu on the Bot's home or on a sub-folder with archived sessions; and the confirm dialog names the folder (28 checks, both themes). With a list row's menu open, the row's action buttons cover its count on every folder, the same as on main.Screenshots / video
Component render, not the live page.
Related Issues
Fixes #37434. RFC: #38152. Refs #34316, #34297.
Follow-up (not in this PR): the delete confirm reads "Sessions will be ungrouped." even for an empty folder. That is main's existing wording for every folder, left unchanged here.
Sibling sweep
Swept: git grep -n "mate_home_subtree_ids|refuses_write_into(state._folders, fid" -- src/
Sibling: src/kiro_crew/dashboard/chat_folders_routes.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_folder_cleanup.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_folder_suggest.py -- not affected -- it only hides Bot folders as move targets
Pattern harvest
Not generalizable: a product rule (who may delete in a Bot's home) changed by an RFC, not a repeatable coding defect.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)