Repository navigation
fix(folders): stop agents forking duplicate and empty folders - #15186
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the dry-run cutover in Suggestions
[DESIGN-REVIEWED] d5f1328 Description read[DESCRIPTION-READ] 38d4f4714b1995e82df2dfa17465af1a0e93f33a31b2f2179e8b77b19d877e37 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 |
GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 5.6 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/session_control.py:2313 -- Dry-run admission races the folder commit Adjudication (Opus 5) — is blocking on each finding proportionate?LOW — the stranded artifact is one empty sidebar folder row, reported back to the caller in False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — ⏭️ skippedRevision |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the asserted owner decision behind the home-folder allowance: it loosens the agent/person folder fence, and only the description attests "the owner decided the nesting rule". What this change shipsInventory (10 items) — 10 justifiedIntent: stop an agent's folder walk leaving duplicate or empty sidebar folders behind — a FIX for a reported user shape, with tests the description says fail nine-deep on base.
Counts run: [FIRST-PRINCIPLES-REVIEWED] d5f1328 Description read[DESCRIPTION-READ] 4cc62328870c2650dcf4741da6b3919519ff9601807919d6ea6113a368ec145b That sha256 names the PR description this verdict read. Recompute it with |
… ones A crew member's folder view hid the person's folders, so its mkdir -p walk forked a same-name twin; parallel walks raced on the same segment; and session_create built its folder path before a create that could still be refused. The folder endpoint now refuses an agent a same-name sibling under its lock, the walk re-reads on that refusal, and session_create dry-runs the create before making any folder.
A conductor the person filed in a folder now puts its workers in a subfolder of it. An app or member may create directly under its own session's folder; the new folder is the agent's, a same-name folder it owns is reused, and the rest of the person's tree stays closed. The session_create preview now runs inside the walk before its first create, checks every segment length and the create budget, and a refused duplicate is audited.
0dca49d to
d5f1328
Compare
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsNo blocking findings. FINDING — src/kiro_crew/mcp_dashboard.py:2067 — the preflight refusal returns an already-prefixed FINDING — src/kiro_crew/dashboard/chat_folders.py:459 — FINDING — src/kiro_crew/mcp_dashboard.py:2618 — FINDING — src/kiro_crew/dashboard/chat_folders.py:1544 — the reuse early [OPUS-REVIEWED] d5f1328 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
chenmingwei23
left a comment
There was a problem hiding this comment.
Bulk approve: readiness passed, board green, no outstanding changes requested.
Problem / Motivation
Goal: An agent never leaves an empty sidebar folder behind and never makes a second folder with the same name as one that exists.
A user's conductor sat in their
Opsfolder. It made a second top-levelOps, an emptymockforge-service-builderunder it, and a stray top-level "New Session..." tab. The user saw folders "randomly created with nothing inside them".Why it matters
Every conductor run can litter the sidebar. The person then has to find and delete the junk by hand. A duplicate
Opsalso splits one goal's work across two folders.Not a goal
session_fork. Its folder path works as before.What changed (motivation → approach → change)
Three code paths made the reported shape.
Opschat_folders.pyapi_chat_folders). The mkdir -p walk inmcp_dashboard.pydid not see the person'sOps, so it made a new one. And a member could not nest under the person's folder at all.caller_home_slot). The new subfolder is the agent's.reused). Anyone else's twin is refused (folder_name_exists, 409), never duplicated.mockforge-service-buildersession_createmade its folder path first. A create the gateway then refused left the folders empty.dry_run: true. A refusal ends the walk with nothing made.The owner decided the nesting rule: a conductor in a folder gets its workers under that folder. So the allowance is narrow. The home slot must be the caller's own session: an app's
_appmust match, and a member's principal must be the one the chat gate stamped from this request's verified key. The slot'sfolder_idis read under the folder-store lock. Other person folders, a deeper child of the home folder, and rename/move/delete stay refused.create_session(dry_run=True)runs every gate, the create budget and both slot caps, then returns just before the first write. The budget is read with the newcreate_rate_limit.has_create_budget, which spends no token. The route refuses a non-booleandry_run. A refused duplicate writes a deniedchat.folder_createSEL line.The goal-conductor skill now says: if the person already put you in a folder, that folder is your goal folder. The
chat_folder_createtool text states the new rule. The specdocs/system-specs/modules/session-control.mddescribes all of it.Backwards compatibility
Compatible: the browser keeps its freedom to name two folders alike. Only internal (agent) callers get the name rule, and a same-name folder they own comes back instead of a twin. A path that already exists resolves as before.
dry_runis a new optional field. The home-folder rule only allows what was refused before.Tests
test/test_agent_folder_dedupe.py, 25 cases.OpscreatesOps/<agent>once and reuses it after. Two parallel creates land one folder.create_session(dry_run=True)mints nothing, spends no budget, and carries the real refusal, including a spent create budget. The route refuses"false".Removing the home-folder allowance fails four of these cases. Removing the whole fix fails nine on
origin/main.test/test_mcp_dashboard_folders.py: one case now finds the folder POST by path, since the dry run comes first.Manual verification
Ran the targeted files: folder tools, cap, ownership, scaffold, steering, member folder gate, pin ownership, session control, fork, error-code contract. 874 pass. black, isort, flake8, mypy and the comment-history gate are clean.
Screenshots / video
N/A — backend and tool behavior only; no UI change.
Related Issues
User report: duplicate
Opsfolder and empty subfolder made by a conductor.Pattern harvest
Rule candidate: review-prompt
Pattern: a multi-step tool that creates durable state before its last step can still refuse, leaving that state orphaned.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement