Skip to content

docs(rfc): propose person-only delete of empty Bot sub-folders - #38152

Merged
bolichen97 merged 1 commit into
mainfrom
crew/slack/rfc-37434-bot-subfolder-delete
Nov 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
crew/slack/rfc-37434-bot-subfolder-delete

Conversation

@buluoray

@buluoray buluoray commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #37434

Problem / Motivation

Goal: agree a design, before code lands, that lets the person delete an empty folder inside a Bot's home folder, and lets "Clean up empty folders" offer it, while the home folder itself stays the Bot's.

A Bot files every folder it makes under its own home folder. Once the work in a sub-folder ends, the folder stays in the sidebar for good: the person cannot delete, move or hide it, the Bot cannot delete it, and "Clean up empty folders" skips it. A maintainer triaged #37434 as a design-level change to the Bot home rule and pointed it at the RFC process.

Why it matters

A busy Bot makes one sub-folder per task, so the sidebar fills with empty folders the person has no way to clear short of deleting the Bot or editing folders.json by hand. Users have reported this more than once, with screenshots of several empty sub-folders under one Bot.

Not a goal

  • Code. The RFC changes no source and no test.
  • Deleting, renaming, moving or recoloring a Bot's home folder.
  • Deleting a sub-folder that still holds a live, archived or scheduled session, or a child folder.
  • Moving, renaming or hiding a Bot's sub-folder.
  • Letting a Bot, an app or another crew member delete folders.

What changed (motivation → approach → change)

  • docs/request-for-change/rfc-bot-subfolder-person-delete.md: new RFC, status draft, tracking dashboard: a Bot's sub-folder can't be deleted, moved, or hidden by anyone, and "Clean up empty folders" skips it #37434. It proposes one narrow opening in the Bot home rule:
    • the person's browser (no app, no member caller, no internal secret, so no agent tool call) may delete a folder inside a Bot's home when it has no child folder, no live session, no archived session and no scheduled job filing into it; the live checks run inside the folder-store callback that removes the row, as the existing if_empty branch does;
    • the sidebar folder menu shows Delete folder on an empty Bot sub-folder, never on the home;
    • "Clean up empty folders" keeps only the home rows, not the whole home subtree, and keeps a Bot sub-folder that holds an archived session, so it gives the same answer as the single delete;
    • the Bot's placement is unchanged: a conductor naming a gone folder files in its home, and a Bot that needs the folder creates it again.
      Section "Current state" maps each refused path to the symbol that refuses it, read at 574320d20fc. Alternatives (Bot-side delete, allowing hidden, explaining the skip) are listed; the two open questions are answered as review settled them.
  • docs/request-for-change/README.md: one index row at the top of the table, status draft.

Backwards compatibility

Compatible: docs only; no behavior changes.

Removes nothing: one new Markdown file and one new index row.

Tests

Docs only; there is no code to test.

  • bash scripts/docs-lint.sh: passed.
  • BRAND_BASE_REF=<merge-base> python3 scripts/check_brand_name.py: no misspellings in the added lines.
  • scripts/verify_no_internal_host.py over both files: no internal host.
  • Every cited symbol was re-read at 574320d20fc.
  • Proof: not provable -- docs or config only

Manual verification

N/A: documentation only.

Screenshots / video

Why no screenshot: no markup change; Markdown files only.

Related Issues

Part of #37434. Refs #34316, #34297.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 16, 2026 23:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision fc44679265d0b593cda74364f81a87766f5d2ac0 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision fc44679265d0b593cda74364f81a87766f5d2ac0 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of fc44679265d0b593cda74364f81a87766f5d2ac0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a draft RFC with no code, and it limits the opening to the person's browser, checks emptiness under the folder-store lock, and makes the cleanup and the single delete give the same answer.

Notes

  • §4 narrows the accepted path B decision (docs/decisions/2026-11-03-…). When a maintainer accepts this RFC, record it as a new decision entry that supersedes that row, not as an edit to the old one.

[DESIGN-REVIEWED] fc44679

Description read

[DESCRIPTION-READ] 7f98b5210e7d81048313a1e98d8f0df4d9656b8a1b5128c35c49e51c0f91744d

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of fc44679265d0b593cda74364f81a87766f5d2ac0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fc44679

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fc44679265d0b593cda74364f81a87766f5d2ac0 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed fc44679265d0b593cda74364f81a87766f5d2ac0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fc44679

Verdict parsed from the review's SHA-scoped output markers for commit fc44679265d0b593cda74364f81a87766f5d2ac0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable fc44679265d0b593cda74364f81a87766f5d2ac0 false-positive: <reason, 20 to 500 characters>

@buluoray
buluoray force-pushed the crew/slack/rfc-37434-bot-subfolder-delete branch 2 times, most recently from ff5a540 to 26d1018 Compare November 16, 2026 23:46
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier 2: design-doc-gate: D.

Docs-only draft RFC plus one index row. All cited symbols are accurate at the head commit: api_chat_folder_delete's mate_home_locked test, _MEMBER_CHAT_FOLDER_ID_METHODS={PATCH}, LAYOUT_ONLY_FIELDS, mate_home_subtree_ids in removable_folder_ids, _remove_if_empty under the store lock, _persist_holding_folder, request_origin and the token auth that requires a token on loopback. The proposed trust boundary (person's browser only: no app, no member principal, no internal secret) is sound and reuses existing lock patterns. Cleanup and single delete give the same answer except for the documented project_dir case. CI and the AI review lanes are all 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 fc44679265 · 265 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bolichen97

Copy link
Copy Markdown
Contributor

Review input on the RFC. The scope reads right to me: person-only, empty only, the home never removable, and every check reuses one that if_empty and the cleanup already run.

Open question 1 (delete a non-empty Bot sub-folder): agree with no. Unfiling a Bot's live or archived sessions moves its work out from under it, and the Bot would then file new work into a fresh sub-folder anyway. Keeping it empty-only is the smaller and safer opening.

Open question 2 (Delete in the sidebar menu): I'd do it in the same phase. Section 1 already adds the server branch for a single DELETE, with all checks run server-side. Showing Delete only on an empty Bot sub-folder is a small change to isMateManaged (or a second predicate beside it), and it answers the person who looks at one stale folder and right-clicks it. Today they would find no Delete there and need to know that the cleanup dialog covers it. If you keep it for later, please say in section 1 why the single-delete branch ships without a UI caller (cleanup alone may not need it).

Two small points for the design:

  • The cron check is outside the folder-store lock. chat_folder_ids_async runs before the callback that removes the row, so a cron job filed into the folder in between keeps a dangling folder id. That is the same window the cleanup has today, so naming it next to the archived-session window in Security considerations is enough.
  • Exit criteria: add one row that a Bot whose conductor names the deleted sub-folder files its next session in its home (section 3), so that path is pinned by a test and not only by reading mate_home_filing.

This is design input only. A team member has to sign off on the design before the code PR.

AI-assisted, sent by Bolin Review bot

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the narrow, well-sourced RFC. I checked the current-state claims against main and most of them hold. One contradiction needs fixing before a maintainer can agree to the design.

  1. docs/request-for-change/rfc-bot-subfolder-person-delete.md:110 (§2 Cleanup). Take a Bot sub-folder with no live session, no cron job and no child folder that still holds archived sessions. If a person runs "Clean up empty folders", it is removed and its archived sessions become unfiled. The reason: §2 lists the rules that still keep a folder (live session, cron job, default folder, channel folder), and on main chat_folder_cleanup.py says "Archived sessions do not keep a folder". But §1 (line 92) and the exit criteria (lines 131-133) refuse the single delete for that same folder. The two person paths give opposite answers for one folder, and §2 breaks the PR's stated non-goal ("Deleting a sub-folder that still holds a live, archived or scheduled session"). Smallest fix: in §2, add a keep rule for a folder inside a Bot home whose _folder_history_counts is non-zero. The dry run already computes this count. Then add a matching cleanup exit criterion.

For the security review:

  • §1 defines "the person" as a caller with no effective app and no member principal (lines 86-88), and it drops the CREATED_BY_SESSION test. The person's own ordinary agent sessions also pass that test when they call the chat_folder_delete MCP tool with if_empty=true. So the line "An agent gains nothing" (line 146) does not hold as written. Consider requiring a dashboard-origin request (request_origin(...)[0] == "dashboard", no internal secret), and add an exit criterion showing that an internal MCP caller is refused on a Bot sub-folder. This RFC widens who may delete inside a Bot's home, so a maintainer makes that decision.

Optional:

  • In this phase, no UI reaches §1's single-delete branch: the cleanup uses its own route and _prune, and the sidebar menu stays closed. §2 alone may meet the goal, with the single delete moved into open question 2.
  • Line 45 and the README index row say an app gets folder_delete_forbidden. On a Bot sub-folder, an app gets mate_home_locked first, and the owning Bot is refused at the member chat-route gate.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 17, 2026
@buluoray
buluoray force-pushed the crew/slack/rfc-37434-bot-subfolder-delete branch from 26d1018 to 10cffd6 Compare November 17, 2026 01:48
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks both. All points are taken in 10cffd6ab09:

KiroCrewCaptain review

  • Cleanup vs single delete on archived sessions (fixed): §2 now keeps a folder inside a Bot's home while _folder_history_counts is non-zero, so both person paths give the same answer. A matching cleanup exit criterion is added. Archived sessions still do not keep any other folder.
  • "The person" included the person's own agent sessions (fixed): §1 now also requires a dashboard-origin request (request_origin(...)[0] == "dashboard", no internal secret), so chat_folder_delete over MCP is refused. Security considerations and the exit criteria say so.
  • No UI caller for the single delete (fixed by bolichen97's answer below): the sidebar folder menu now calls it.
  • Line 45 and the index row (fixed): an app gets mate_home_locked, and the owning Bot is stopped at the member route gate (DELETE is not in _MEMBER_CHAT_FOLDER_ID_METHODS).

bolichen97

  • Open question 1: recorded as answered "no", with your reason.
  • Open question 2: Delete moves into this phase. The folder menu opens on an empty Bot sub-folder with one item, Delete folder; the home's menu stays closed. The server checks stay the authority.
  • Cron window: named in Security considerations, next to the archived-session window.
  • Bot placement: new exit criterion that a conductor naming the deleted sub-folder files its next session in its home.

The code branch will follow the revised RFC once a team member signs off.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 17, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Follow-up on the earlier change request (head 26d1018). Each point against head 10cffd6:

  1. Cleanup and single delete disagreed on a Bot sub-folder with archived sessions: fixed. §2 now keeps such a folder while _folder_history_counts is non-zero, and an exit criterion covers it.
  2. Security note, "the person" also covered the person's own agent over MCP: fixed. §1 now requires request_origin(...)[0] == "dashboard", and Security considerations and an exit criterion both state it.
  3. Optional, no UI caller for the single delete: fixed. The sidebar folder menu now offers Delete folder on an empty Bot sub-folder, never on the home.
  4. Optional, the folder_delete_forbidden wording: fixed. The RFC now names mate_home_locked for an app and the member route gate for the owning Bot.

Nothing from that review still stands. I also checked the RFC's "Current state" citations at this head, and they hold: the is_mate_home(target) or refuses_write_into(...) refusal, _MEMBER_CHAT_FOLDER_ID_METHODS admitting only PATCH, LAYOUT_ONLY_FIELDS without hidden, and the mate_home_subtree_ids skip in removable_folder_ids. The RFC names its race windows openly and does not claim the change is atomic. That is done well.

This RFC widens what an authorization check on the folder delete route allows. Today the person gets mate_home_locked. Under the RFC the person gets a 200 on an empty Bot sub-folder, and the cleanup offers those folders. A design that widens a gate is not approved in this review, so the decision stays with a maintainer and the security review.

For the security review:

  • docs/request-for-change/rfc-bot-subfolder-person-delete.md:126 says "The cleanup is already person-only". But api_chat_folders_cleanup refuses only app and member callers and has no dashboard-origin test, so it is weaker than §1's definition. No internal caller reaches that route today. Consider one shared "person's browser" predicate for both paths, or state why the cleanup does not need it.
  • docs/request-for-change/rfc-bot-subfolder-person-delete.md:121 ties the archived-session keep rule to the dry run. The confirm path (_prune) reads no archive counts. If the folder gains an archived session between the preview and the click, confirm would still delete it. Consider saying the confirm path reads _folder_history_counts as well, and add a confirm-path exit criterion.

Optional:

  • The RFC does not say how it relates to the accepted path B plan for Bot folders: the 2026-11-03 decision entry, migration PR 7 and the "Mate home folders that already exist" row in rfc-crewmate-workers-under-the-crewmate.md §6, and Open question 1 of rfc-mate-sessions-folder-or-lineage.md. A short paragraph saying whether this opening is interim or permanent would help whoever accepts it.

@KiroCrewCaptain
KiroCrewCaptain dismissed their stale review November 17, 2026 03:46

Withdrawn: every item in this review is fixed or answered on the current head (see the follow-up comment). Other holds on this PR are listed there.

@buluoray
buluoray force-pushed the crew/slack/rfc-37434-bot-subfolder-delete branch from 10cffd6 to 84be473 Compare November 17, 2026 03:51
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks. The three points from the follow-up are taken in 84be4735d82:

  • Cleanup has no dashboard-origin test (fixed): §2 now names one shared "person's browser" predicate (no effective app, no member principal, no internal secret) for both paths. A cleanup from any other caller keeps every folder inside a Bot's home, as it does today. An exit criterion covers it.
  • Confirm path does not read archive counts (fixed): §2 now says _prune reads _folder_history_counts again in the step that runs under the folder-store lock, so a folder that gains an archived session after the preview is kept. An exit criterion covers it.
  • Relation to path B (added, §4): the opening narrows the §6 row "Mate home folders that already exist" for empty sub-folders only. It is permanent, not interim. It leaves Open question 1 of rfc-mate-sessions-folder-or-lineage.md open.

The decision on widening the delete gate is a maintainer's and the security review's, as you say.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 17, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks. All points are taken in 1376505d0ba:

  • Design note on a no-token loopback request: Security considerations now says it. The auth middleware (token_auth.py) requires a valid dashboard token on every request, loopback included, so a request from the agent's shell without the person's token is refused before the folder route runs.
  • project_dir on a Bot sub-folder: I took the keep rule. The cleanup now keeps a Bot sub-folder that carries a project_dir, so a bulk cleanup never moves a Bot's later work out of its repository. The person can still delete such a folder from the menu, and §3 names what follows: the next session the conductor files under that id lands in the home and runs outside the repository until the Bot makes the sub-folder again. A new exit criterion covers both halves.
  • "Same answer for one folder": §2 now says this holds for a leaf folder. The cleanup removes a whole empty branch at once, while the single delete refuses a folder that still has a child.
  • Author line: it now names the author.

The code branch matches (23d5fecb6ba): the cleanup keeps a Bot sub-folder with a project_dir, the menu's delete still removes one, and the spec paragraph in session-control.md says so. New tests cover both, and the cleanup test fails when the keep rule is removed.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Follow-up on the earlier change request (head 26d1018). Each item checked at head 1376505:

  1. Cleanup and single delete disagreed on a Bot sub-folder with archived sessions: fixed. Section 2 keeps that folder while _folder_history_counts is non-zero. The confirm path reads the counts again in _prepare, and an exit criterion covers it.
  2. Security note, the person's own agent over MCP counted as "the person": fixed. Section 1 requires a dashboard-origin request with no internal secret. One shared "person's browser" predicate now decides both the single delete and the cleanup.
  3. Optional, no UI caller for the single delete: fixed. The sidebar folder menu offers Delete folder on an empty Bot sub-folder, and never on the home.
  4. Optional, the folder_delete_forbidden wording: fixed. The RFC now names mate_home_locked for an app and the member route gate for the owning Bot.

Nothing from that review still stands. At this head the diff adds only the RFC and one index row in docs/request-for-change/README.md. I checked the "Current state" citations against main again, and they hold. These include the is_mate_home(target) or refuses_write_into(...) refusal, _MEMBER_CHAT_FOLDER_ID_METHODS admitting only PATCH, LAYOUT_ONLY_FIELDS without hidden, and the mate_home_subtree_ids skip in removable_folder_ids. The RFC reuses checks that already run under the folder-store lock, and it names its remaining race window instead of claiming the change is atomic. That is done well.

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 RFC also widens what the folder delete route allows. On main the person gets mate_home_locked on every Bot sub-folder. Under this RFC the person gets a 200 on an empty one, and the cleanup offers those folders. A design that widens a gate is not approved in this review, so the decision stays with a maintainer and the security review.

For the security review:

  • The opening rests on one predicate: no effective app, no member principal, no internal secret. The code PR should apply that exact predicate to both paths and test a caller that fails it on each.
  • The root-scoped cleanup ("Close sessions and delete") is not covered. On main, removable_folder_ids passes settings=not root (chat_folder_cleanup.py:262), so a root request drops the setting rule, and its dry run ignores live sessions. If a person's request with root set inside a Bot's home reaches this path, it would remove a sub-folder that has a project_dir. That contradicts the keep rule at rfc-bot-subfolder-person-delete.md:140. No shipped UI sends that request today. Consider one sentence in section 2: inside a Bot's home, project_dir keeps a folder whatever the root scope is, or a root inside a Bot's home is refused. Then add an exit criterion for it.
  • One window remains, and the RFC names it: an archived session that closes during the archive scan. The existing delete and cleanup have the same window.

Optional:

  • Line 58 cites a second report on 2026-11-16 with a screenshot, but no linked issue or comment holds it. Link it or drop the clause.
  • Alternatives considered could name the open view-only setting in feat: add a setting that hides empty session folders in the sidebar #31417. It hides empty folders, Bot sub-folders included, but it removes none and the cleanup still skips them. That is the same reason the RFC gives for rejecting hidden.

@buluoray
buluoray force-pushed the crew/slack/rfc-37434-bot-subfolder-delete branch from 1376505 to ff0f93f Compare November 17, 2026 12:12
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks. Taken in ff0f93f5fa0:

The code branch matches (9d394d64cd8): _closed_bot_homes treats every folder in a Bot's home as kept when root lies inside one, for both the dry run and the delete. A test covers root set to the home and to a sub-folder, and it fails when the rule is removed.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Follow-up on the earlier change request (head 26d1018). Each item checked at head ff0f93f:

  1. Cleanup and single delete disagreed on a Bot sub-folder with archived sessions: fixed. Section 2 keeps that folder while _folder_history_counts is non-zero, and the confirm path reads the counts again in _prepare.
  2. Security note, the person's own agent over MCP counted as "the person": fixed. Section 1 requires request_origin(...)[0] == "dashboard", and one shared "person's browser" predicate decides both the single delete and the cleanup.
  3. Optional, no UI caller for the single delete: fixed. The sidebar folder menu offers Delete folder on an empty Bot sub-folder and never on the home.
  4. Optional, the folder_delete_forbidden wording: fixed. The RFC names mate_home_locked for an app and the member route gate for the owning Bot.

Nothing from that review still stands. The root-scoped cleanup point from the last follow-up is also fixed: section 2 now keeps every folder in a Bot's home when root is that home or a folder inside it, and an exit criterion covers it. At this head the diff adds only the RFC and one index row in docs/request-for-change/README.md. I checked the "Current state" citations against main again, and they hold. These include the is_mate_home(target) or refuses_write_into(...) refusal, _MEMBER_CHAT_FOLDER_ID_METHODS admitting only PATCH, LAYOUT_ONLY_FIELDS without hidden, the mate_home_subtree_ids skip in removable_folder_ids, and the token_auth.py rule that loopback needs a token too. The exit criteria are written as tests the code PR can carry, and they include an event-gated ordering test for the cron race instead of a sleep. That is done well.

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 RFC also widens what the folder delete route allows. On main the person gets mate_home_locked on every Bot sub-folder. Under this RFC the person gets a 200 on an empty one, and the cleanup offers those folders. A design that widens a gate is not approved in this review, so the decision stays with a maintainer and the security review.

For the security review:

  • The opening rests on one predicate: no effective app, no member principal, no internal secret. The code PR should apply that exact predicate to both paths and test a caller that fails it on each.
  • A request from a shell that carries the person's own dashboard token passes the browser test. The RFC says so. It grants nothing new, because that token can already delete any folder outside a Bot's home.
  • One window remains, and the RFC names it: an archived session that closes during the archive scan. The existing delete and cleanup have the same window.

Optional:

  • Lines 65-66, 128-129 and the README row say the cleanup and the single delete follow "the same rule". For a leaf folder that carries a project_dir, they do not: the menu removes it and the cleanup keeps it (lines 135-142, 201-203). Consider qualifying the sentence, for example "for a leaf folder without a project_dir".
  • The PR's "Why it matters" mentions several reports with screenshots, but dashboard: a Bot's sub-folder can't be deleted, moved, or hidden by anyone, and "Clean up empty folders" skips it #37434 holds one report and no image. A PR comment that corrects the record would help the maintainer weigh demand.
  • Section 2 re-reads archive counts in _prepare while the folder-store lock is held. The code PR should check what that scan costs.

@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks. These three are noted and will go into the next push, with any maintainer review, so CI does not restart for them alone:

  • "Same rule" wording: I will qualify lines 65-66, 128-129 and the README row as "for a leaf folder without a project_dir", since the menu removes such a folder and the cleanup keeps it.
  • Archive scan under the lock: the code PR will measure what the _prepare re-read costs while the folder-store lock is held and state the number in its body.

Correcting the record on demand: "Why it matters" says several reports with screenshots. The public record is one report, #37434, with no image, so please weigh demand on #37434 alone.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of ff0f93f.

Follow-up on our earlier design input. Both points are answered on this head:

  • Cron check outside the folder-store lock: §1 now runs the cron read in a prepare= callback of mutate_folders, under the folder-store lock, and a job save checks the folder while holding the same lock (_persist_holding_folder). So the window is closed, not just named, and Security considerations says so. I checked that _persist_holding_folder (src/kiro_crew/dashboard/handlers/cron_jobs.py:580) and chat_folder_ids_async exist on main as cited.
  • Exit criterion for the conductor fallback: added. A Bot conductor that names the deleted sub-folder files its next session in its home (mate_home_filing). There is also an event-gated ordering test for the cron race.

Open question 2 is now answered as I suggested: the sidebar menu offers Delete folder on an empty Bot sub-folder, never on the home.

The Captain's items at this head are fixed too: the shared "person's browser" predicate with request_origin(...)[0] == "dashboard", archived-session counts re-read in _prepare, and the root-scoped cleanup keeping every folder in a Bot's home. Its three optional points (the "same rule" wording for a leaf folder with a project_dir, the demand record, and the cost of the archive scan under the lock) are still in the text on this head. The author has said they go in the next push. The demand correction is already in a PR comment.

I have no further design findings. This RFC widens what the folder delete route allows (today mate_home_locked on every Bot sub-folder; under this RFC a 200 on an empty one for the person). A team member has to sign off on the design before the code PR. This comment is not that sign-off.

AI-assisted, sent by Bolin Review bot

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 17, 2026
@buluoray
buluoray force-pushed the crew/slack/rfc-37434-bot-subfolder-delete branch from ff0f93f to fc44679 Compare November 17, 2026 19:18
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks, Bolin. The saved optional notes are in fc44679265d, in one push:

Nothing else changed. The RFC now waits for a team member's design sign-off before the code PR opens.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

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.

This RFC widens what the folder delete route allows. On main every Bot sub-folder answers mate_home_locked; under this RFC the person's browser gets a 200 on an empty one. So this review does not approve it. The decision stays with a maintainer and a security reviewer.

Earlier change request (head 26d1018), checked at fc44679:

  1. Cleanup and single delete disagreed on a Bot sub-folder with archived sessions: fixed. Section 2 keeps that folder while _folder_history_counts is non-zero, and the confirm path reads the counts again in _prepare.
  2. The person's own agent over MCP counted as "the person": fixed. One shared "person's browser" check needs a dashboard-origin request with no internal secret.
  3. Optional, no UI caller for the single delete: fixed. The folder menu offers Delete on an empty Bot sub-folder, never on the home.
  4. Optional, the folder_delete_forbidden wording: fixed. The RFC names mate_home_locked for an app and the member route gate for the owning Bot.

Review result: nothing blocks. The diff adds only the RFC and one index row. The "Current state" citations resolve on main, and the lock reuse holds: the if_empty remove callback, the cleanup's prepare= step, and _persist_holding_folder for cron saves. Done well: the exit criteria are a test plan someone can check, with negative cases and an event-gated ordering test for the cron race.

For the security review:

  • The "person's browser" check (no effective app, no member principal, no internal secret) is the only new opening. MCP tools and cron scripts send the internal secret, and the token check applies on loopback too, so agent callers stay refused.
  • The widening covers empty sub-folders only. The home itself stays locked, and a cleanup from any other caller, or one scoped to a root inside a Bot's home, keeps every folder there.
  • The follow-up code PR changes an authorization check and needs its own security review.

Optional:

  • Exit criteria lines 193 to 197 say "refused" but do not name the answer that Design section 1 promises. Naming folder_not_empty (409) for a non-empty sub-folder and mate_home_locked (403) for the home and for any caller that is not the person would let the code PR's tests pin the reason, not just the refusal.
  • The PR body's "What changed" bullet still says the cleanup and the single delete give the same answer. The RFC now limits that to a leaf folder without a project_dir, and it adds the root rule. A body edit would bring the summary in line.
  • On acceptance, consider recording the narrowed Bot-home rule as a new entry in docs/decisions/, not only as edits to the spec and the path B row.

@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks. These are noted for the next push, with any maintainer review, so CI does not restart for them alone:

  • Exit criteria answers: lines 193-197 will name the answer each refusal gives: folder_not_empty (409) for a non-empty sub-folder, and mate_home_locked (403) for the home and for any caller that is not the person's browser. The code PR's tests already pin those codes.
  • PR body "What changed": I will bring the summary in line with the RFC: the cleanup and the single delete agree for a leaf folder without a project_dir, and a cleanup whose root is inside a Bot's home keeps every folder there.
  • Decision entry: on acceptance, I will draft a docs/decisions/ entry for the narrowed Bot-home rule in the code PR, for the maintainer who signs off to confirm.

Agreed that the code PR changes an authorization check and needs its own security review.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer design sign-off on fc44679, @buluoray: I agree with this RFC. The person, and only the person, may delete an empty sub-folder under a Bot's home folder, and "Clean up empty folders" may offer those; the home folder itself stays the Bot's. Our two earlier points and the Captain's asks are answered. Implementation PRs can start against this design.

AI-assisted, sent by Bolin Review bot

@bolichen97
bolichen97 merged commit ae6a762 into main Nov 17, 2026
98 checks passed
@bolichen97
bolichen97 deleted the crew/slack/rfc-37434-bot-subfolder-delete branch November 17, 2026 22:42
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
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.

3 participants