Repository navigation
Conversation
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The Windows platform notice shows in red even when nothing is wrong, and the "Saving still works" notices never say whether chats here will run the agent. Watch
Suggestions
[UX-REVIEWED] 7f76da5 Description read[DESCRIPTION-READ] a76e01862680840e34eceac0f67b8b73e0a5772ad318441ef7158ace94902901 That sha256 names everything this verdict read: the PR description, plus the 25 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) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The pinned-walk rework also changes the per-turn session reader the description calls "unchanged": existing project agents can now silently drop out of running chats. Watch
Suggestions
[DESIGN-REVIEWED] 7f76da5 Description read[DESCRIPTION-READ] dd687807ae2db2649dbc5c89c2bb083b392b1c781d9509236774efb06bb8980e 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 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The server-side scope refusal costs more than it removes: base dispatch already rejects an unresolvable agent loudly, and adding the check forced its own leak fences and exemptions. Session discovery also changed, undeclared. Not justified as shipped
What this change shipsInventory (9 items) — 7 justifiedIntent: let a folder's Default agent be one of its project directory's own agents. FIX.
[FIRST-PRINCIPLES-REVIEWED] 7f76da5 Description read[DESCRIPTION-READ] 9cb56aa504bcb1dc1c743a1717f10472df4d2470570e5a06b991d041e38eb053 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed Review detailsAdvisory only: one finding, nothing blocks the merge. FINDING — src/kiro_crew/agent_discovery_parts/project_agents.py:802 — the new cache caps [OPUS-REVIEWED] 7f76da5 |
3313922 to
891f242
Compare
|
|
|
|
|
|
|
891f242 to
1545cd0
Compare
|
|
|
cruisercohen
left a comment
There was a problem hiding this comment.
Reviewed locally at head 829dd76. The bug is still present on main: GET /api/agents ignores ?project_path=, and the picker builds its list from the slot roster. The targeted backend suites in this PR pass locally (335 tests). Before this can merge:
- Rebase. The branch conflicts with main in
website/src/components/FolderConfigModal.tsx(main added a filter box to the same picker),docs/feature-map/README.mdanddocs/system-specs/modules/learn-cron-dashboard.md. - The earlier change request is still open on this head. There are bare
monkeypatch.undo()calls attest/test_agent_discovery.py:746and:1897, and attest/test_agents_roster_contract.py:1386,:1424and:1462. These undo the autouse isolation; please usemonkeypatch.context()instead. - Also from that request:
website/src/test/FolderConfigModal.test.tsx:470waits a fixedsetTimeout(r, 50)before a negative assertion. Please assert on the gate state instead. Backend Tests (Windows) (7)is red on this head, and the PR adds Windows-only link screening. Please check it after the rebase.
|
@cruisercohen — all four items addressed on head 1. Rebase — done. Rebased onto
2. 3. The fixed sleep — fixed. 4. Gates on the merged tree: isort/flake8/black clean, mypy clean over 2,291 files, |
|
@buluoray — both blocking items are fixed on head Blocking 1 — bare Blocking 2 — the fixed sleep: fixed. The I checked all six sites by mutation rather than trusting the tests to pass — these were the third and fourth assertions on this PR that would have passed with their subject removed, so a green run was not evidence. Rebase — done. Onto On your three non-blocking notes:
|
cruisercohen
left a comment
There was a problem hiding this comment.
Re-reviewed at 997eb70. The code-level points from my review on 829dd76 are addressed:
- Rebased: the branch merges cleanly with main, and the picker keeps both main's filter box and this PR's scoping.
- The five bare
monkeypatch.undo()calls are gone. Each site now useswith monkeypatch.context() as scoped:, and there are none left in either test file. - The fixed
setTimeout(r, 50)before the negative assertion inFolderConfigModal.test.tsxis gone, and the test now asserts on the gate state.
My change request is resolved on the code. I am not approving yet, because the merge still needs the following:
- Point 4 is still open: CI on this head is mostly queued or running, including
Backend Tests (Windows) (7). I'll check it once it concludes. - The PR adds a descriptor-relative fenced read primitive (
open_fenced_for_read_atinpinned_fs.py) and Windows link screening, so it needs a maintainer's review of those security paths. - buluoray's change request is still open, and that is theirs to clear.
|
Follow-up on point 4 from my review at 997eb70: There is one new red from this diff.
|
The four advisory items in the same verdict (the pinned walk, |
|
|
cruisercohen
left a comment
There was a problem hiding this comment.
Re-reviewed at 52a9c8c. The wait-discipline point from my follow-up is fixed: the new asyncio.wait_for(..., timeout=10) in test/test_session_control.py is replaced by the shared await_until helper on an event the executor stub sets, and test_wait_discipline_ratchet.py passes on this head with that file back at its baseline of 5. That was the last open point of mine, so my change request is addressed on the code.
The new shared _path_preflights keeps the same check order on both callers (raw UNC, expanduser, link chain, realpath, resolved UNC, sensitive, isdir), and each refusal still audits the spelling it fired on. I found no new defect in it.
I am not approving, because a maintainer still has to look at this: the head changes path-validation and descriptor-pinned read code, the First Principles item on keeping the UNC refusal on folder save is waiting on a maintainer, buluoray's change request is still open, and CI on this head was still running when I checked.
cruisercohen
left a comment
There was a problem hiding this comment.
Re-reviewed at 5b849f4. The only change since 52a9c8c moves the type-checking-only import of PathPreflightOutcome and _path_preflights in dashboard/agent_admin/roster.py to the dashboard/handlers/agents.py re-export. It sits under TYPE_CHECKING, so runtime behaviour is unchanged, and I found no new issue.
The branch now conflicts with main, so CI has not started on this head. It needs a rebase before the checks can be judged.
|
@cruisercohen — you were right on both counts, and the conflict is resolved. Rebased onto One correction to my own earlier read: I had been reporting "dispatch still pending" for two cycles while the actual cause was the conflict blocking merge-ref creation — you named it before I did. The conflict was one file,
Verified the peer row matches upstream byte-exactly rather than trusting the merge, and re-ran Board on No spec failed an assertion. The suite consumed 1014.9s of a 1020s bound — 99.5% — and was cut mid-spec. Three things place it outside this diff:
The five I have not opened an issue for it, and I cannot re-run the lane myself — On your merge-triage point: you are right that buluoray's change request is the gate. |
|
@buluoray — the board is fully green on head Your two blocking items, verified on this head rather than asserted:
The rebase you asked for happened twice since: onto Board: 96 success, 0 failing, 0 pending. Your non-blocking item — the second enforcement layer. Added to the PR body under "Why the save path enforces as well as the picker", since you and both lanes asked for the rationale to be stated rather than implied: the picker narrows what a UI offers, but Also fixed from your list: the body no longer cites |
|
HOLD at d86fd04. This adds a fenced filesystem read, caller-supplied path checks, and owner/app-isolation gates. Those security paths require a human maintainer's review. @buluoray's change request also remains active; another COMMENTED review does not clear it. Please obtain that re-review and answer the current-head UX, Design and First Principles findings, including the scope-check layer, changed by-name symlink handling, and the description/build wording mismatch. Coordinate the overlapping resolver and UNC work in #9201 and #13335 before landing. This pass reviewed the key security and scope paths, not every test, screenshot or remaining discovery hunk. I am not approving the full change or clearing anyone else's request. — crew-pr-reviewer (r99) |
|
First Principles blocker — accepted, subtraction made. Head Your argument held on reading the code, so I took the subtraction rather than arguing for the mechanism. Why you were right. What changed. Worth being explicit that this is a return to main's behaviour, not a new relaxation: base The screen stays where the Goal needs it — Verification. Two new tests replace the removed class: a junction-backed project directory validates, parametrised over both a UNC and a local ancestor target so the outcome provably does not depend on the screen's verdict; and the pre-existing sensitive-path gate still refuses, so the subtraction is bounded. Proven load-bearing by mutation — restoring the screen fails the UNC-ancestor case ( Three The PR description paragraph you quoted said the opposite of the code and is corrected in the same round. |
|
@buluoray — your review requested changes on head Blocking 1 — bare
|
| your cite | now |
|---|---|
test/test_agent_discovery.py:746 |
:727 scoped |
test/test_agent_discovery.py:1897 |
:2002 scoped |
test/test_agents_roster_contract.py:1386 |
:1388 scoped |
test/test_agents_roster_contract.py:1424 |
:1424 scoped |
test/test_agents_roster_contract.py:1462 |
:1460 scoped |
No bare monkeypatch.undo() remains in any test file this PR touches.
Blocking 2 — fixed sleep before a negative assertion
The setTimeout(r, 50) is gone; no setTimeout remains in website/src/test/FolderConfigModal.test.tsx. The assertion now waits on the state that proves the gate held, then asserts synchronously in the same tick as the commit:
await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledWith(undefined, '/repo'))
await waitFor(() =>
expect(screen.queryByTestId('folder-config-agent-roster-loading')).not.toBeInTheDocument())
fireEvent.keyDown(dir, { key: 'Enter' }) // commits the field AND calls submit() in one tick
expect(onSubmit).not.toHaveBeenCalled()There is no interval in which a slow runner can make this pass vacuously: the roster request has resolved and the loading node is gone before the key event, and the assertion is synchronous with it.
Rebase
Done — base moved from 337d192e48 to 7c4c4ec4b6, 1553 commits of upstream history. #17237 (f76058b94c) is in that base, and the three rows you attributed to RemoteArtifactDetailPageCoverage.test.tsx are green: Frontend Tests (1)–(4) and Frontend Coverage Merge all pass. That file is not in this diff.
Non-blocking
- Second enforcement layer — kept, and the body now says so under "Why the save path enforces as well as the picker": the picker narrows what the UI offers, the endpoint is reachable directly, so treating a filtered list as the enforcement point would leave the control advisory. The
503is fail-closed because an unreadable roster cannot prove the pair is in scope. iter_linked_ancestors— the stale citation is removed from the body.- UX notes — the Windows notice styling and the "the agent it had before" wording are both addressed; that phrasing no longer appears in the tree.
Separately, First Principles escalated to BLOCK on a later head over the UNC/link-chain screen this PR had added to chat_folders._validate_project_dir, and I took the subtraction: _screen_windows_links refuses on seven conditions, most unrelated to an untrusted share, and resolve_folder_project_dir_off_loop runs that validator on stored values, so an ordinary junction behind an already-saved project directory could have blocked session start. Base _validate_project_dir had no such screen, so removing it returns to main's behaviour; the screen stays on the ?project_path= roster read, where a refusal costs a listing. That lane is now CONCERNS.
Remaining red checks
Three, none produced by this diff, each tracked by an open issue:
| check | issue | note |
|---|---|---|
Backend Tests (3.12, 3) |
#20475 | lease census counts before a by-design daemon-thread release; fix in flight as #20485 |
Backend Tests (Windows) (2) |
#13732 | xdist worker killed by the 180 s timeout inside a SQLite commit(); 7 of 8 shards pass |
E2E (stub ACP backend, offline) |
#18185 | 326 specs pass, unexpected=0; the run is SIGINT'd at the 1020 s ceiling |
Coverage Gate fails only on backend-test=failure -- failing closed, and PR Readiness is the aggregate over the above.
All five AI lanes stamped the current head with no blocking findings — GPT 6.1 and Opus 5.5 clean, Design / UX / First Principles advisory CONCERNS.
Could you take another look when you have a moment?
cruisercohen
left a comment
There was a problem hiding this comment.
Re-checked a311625 against c584530. Both changes since then are in tests, and neither blocks.
- The e2e tests now find the Default agent picker by the
buttonrole instead ofcombobox. That matches main, where the picker is a button. - The new commit a311625 raises the nested
--collect-onlycap intest_ci_ipv6_routing.pyto 100 s on Windows and keeps 60 s elsewhere. That is the fix for #21943 (the collection times out at 60 s on hosted Windows runners), and all eight Backend Tests (Windows) groups pass on this head. It has nothing to do with the folder agent picker, though, so while this PR waits, so does that fix. Opened as its own PR withFixes #21943, it could land now, and this PR could drop the commit. - The one red test group, Backend Tests (3.12, 2), hit the 120 s per-test timeout in a whole-tree scan in
test_facade_mirror_guards.py, which this diff does not touch. Coverage Gate and PR Readiness are red because of it.
There was a problem hiding this comment.
Thanks @mbajaj92. I re-reviewed a311625 against c584530, the last head I checked. This is a comment review: buluoray's change request and the maintainer hold still stand.
- Commit 1 (dd0d0d3) is a rebase. Its changes match c584530 except that the e2e specs now find the folder's "Default agent" picker by the
buttonrole instead ofcombobox, plus main's own wording in the feature-map row it edits. - Commit 2 (a311625) is outside this PR's scope. It raises the per-run cap in
test/test_ci_ipv6_routing.pyfrom 60 s to 100 s on Windows. That file is CI routing, not the folder agent picker, and the description does not mention the change. A slow fork-runner red there affects every fork PR, so it is better as its own issue and PR, where a maintainer can decide whether to loosen that ratchet. That change is tracked in #21943, so it can land on its own as a separate PR. Please drop the commit from this branch.
CI on this head: the one red shard, Backend Tests (3.12, 2), is three whole-tree scans in test_facade_mirror_guards.py hitting the 120 s per-test timeout. That is the slow-runner timeout tracked in #19907, not this diff. Coverage Gate and PR Readiness fail behind it.
cruisercohen
left a comment
There was a problem hiding this comment.
Re-reviewed 59c5c55 against a311625, the last head I checked. This is a comment review: buluoray's change request and the maintainer hold still stand.
- The commit that raised the Windows collection cap in
test_ci_ipv6_routing.pyis gone, as asked; that file is no longer in the diff. - The rebase moves this PR's code into main's new owner modules, and the production change since a311625 is a move with no behaviour change.
api_kirocrew_agentsnow calls two helpers inagent_admin/roster_project_path.py:_roster_project_dir_for_requestholds the same?project_path=logic as before (owner-only, audited, and an explicit path suppresses the active-slot fallback), and_refuse_unverifiable_roster_scanraises the same two 503 shapes. Both run on the handlers module's globals through the facade compose, like that module's existing helper, so the existing patch targets still reach them.create_folder_record,project_agent_filesandproject_agent_namescarry the same edits as on a311625, and_scan_project_agent_filesdiffers by one docstring line. - Locally, 9 related test files pass (495 tests), including the roster contract's non-owner
project_pathcases, and flake8 and black are clean on the two files. CI on this head was still running when I checked. - Nit, not blocking: the module docstring of
roster_project_path.pystill says "this module's one function"; it now has three.
A chat folder can carry a project directory, and that project can define its own agents in `<project>/.kiro/agents/*.json`. Those agents never appeared in the folder's Default agent dropdown, which listed only the active chat's agents -- and when creating a folder there is no active chat, so a project agent could not be chosen as a folder's default at all. Backend: `GET /api/agents` honors an explicit `?project_path=` and lists that directory's project agents, overriding the slot-derived project and falling back to the slot when the parameter is absent or refused. The scan is owner-only and every attempt is SEL-audited: a real directory logs `allowed`, a sensitive one logs `denied`, and a non-owner attempt logs `denied` and is ignored. Path handling for that caller-supplied directory goes through `kiro_crew.pinned_fs`, the module that already owns pinned filesystem access. The chain to `<project_dir>/.kiro/agents` is opened component by component and enumerated relative to the held descriptor, so no component is re-resolved by name after it is checked. A platform without `dir_fd`/`O_NOFOLLOW` cannot perform that walk, so the request-supplied scan reports the roster as unverifiable there rather than approximating the check by name. That capability gate is scoped to the request-supplied path alone, via an `unsupported_ok` flag defaulting to False. The pre-existing readers of `<project>/.kiro/agents` -- per-turn agent resolution, `spawn_run` validation, Slack, and the config loader -- resolve the session's already-established project directory and keep their by-name behaviour, so project-agent discovery is unchanged for them on every platform. A refused scan stays distinct from an empty one: `None` means denied and `()` means nothing to enumerate, so an errored scan never establishes that an agent is absent. Frontend: the folder modal fetches the roster for its draft or inherited project directory, debounced, and scopes the dropdown to it. An agent that directory cannot be confirmed to have is flagged in the trigger and blocks submission, naming which case applies -- `(not installed)`, `(not in this project)`, `(can't verify)` when the scan itself failed, or `(not available)` when no directory is set. A saved orphan agent still round-trips a benign rename or recolor, so an existing folder is not held hostage by a directory that changed underneath it. Closes kirodotdev#10106
buluoray
left a comment
There was a problem hiding this comment.
Approving at head 7f76da5. Both blocking points from my review at 337d192 are fixed. I compared the PR-own diffs across the rebase: the server scope check, its error classes and the slot-create and folder-update hunks are unchanged apart from comments. The roster project_path logic moved verbatim into agent_admin/roster_project_path.py.
Blocking points, rechecked:
- Bare monkeypatch.undo(): fixed. None is left in any test file this PR touches. All five sites now scope their patches with monkeypatch.context(): test/test_agent_discovery.py:629, test/test_agent_discovery_scan_gate.py:210 (the old :1897 site, moved in the split), and test/test_agents_roster_contract.py:1388, :1424, :1460.
- Fixed sleep before a negative assertion: fixed. website/src/test/FolderConfigModal.test.tsx:401 asserts right after the Enter keydown. That is sound, because submit() reaches onSubmit before its first await (FolderConfigModal.tsx:706-731). Pointing blockingOrphan at the display value orphanAgent instead of orphanAgentGate reddens this test, so it still guards the Enter bypass.
Ran the 23 related backend test files and the five FolderConfigModal suites; all pass apart from one sandbox-only failure that also fails on main. Mutating the core guards reddens a named test each time: dropping the raw UNC gate in _path_preflights, a no-op check_folder_agent_scope, honoring project_path for a non-owner, dropping the scan_unsupported_platform branch, dropping the ownership check before scope validation on update, and dropping the re-check of the stored dir.
CI: the one red is Backend Tests (Windows) (1), the known test_ci_ipv6_routing collection timeout (#21943). That file is not in this diff; it needs a re-run.
Non-blocking follow-ups:
- Design Review and First Principles say the session-path roster changed without being declared: the 64-character name cap, the refusal of a .kiro that resolves into a sensitive tree, and an empty roster when the directory changes mid-scan. On main a name over 64 characters already fails is_registered_agent_name at dispatch (agent.py:3142, chat_send.py:345, agent_switch.py:290), so the cap matches the existing grammar. Please say so in the Backwards compatibility section, and add one test showing a bound session with a valid project agent still resolves.
- chat_folders_routes.py:549-562 says re-checking the stored dir closes the UNC probe. The function it calls, _validate_project_dir, no longer has a UNC gate since that subtraction, so the comment claims more than the code does. Please reword it.
- spec_reads.py:717 says both validators share _path_preflights, while chat_folders_paths.py:37 says the save validator deliberately does not. Please make the docstring match.
- pinned_fs.py grows by 68 lines on an already baselined file. The cap check reports this without failing, but a small split would keep it from growing.
cruisercohen
left a comment
There was a problem hiding this comment.
Re-reviewed 7f76da5 against 59c5c55, the head of my last comment. This is a comment review.
- Apart from the rebase onto 2501be6, the only change to this PR's own lines is in three files: the agent_discovery facade now names the outside names it serves (runtime imports from agent_spec_format, hooks and pinned_fs, plus TYPE_CHECKING names), and
ScanUnverifiableand_ProjectSnapshotChangednow carry the facade's__module__. No logic changed. Range-diff and a per-line comparison of the added and removed lines show nothing else moved. - That change fixes the two facade contract tests that were red on 59c5c55 (Backend Tests 3.12 shard 5):
test_an_exception_an_owner_defines_keeps_the_facade_moduleandtest_every_name_served_from_outside_the_family_is_visible_to_a_type_checker. Putting the 59c5c55 versions of the three files back fails both again. - The related backend tests pass locally (5,188, including the facade mirror guards, the roster contract, owner auth, folder agent scope, chat folders and the composition contracts). flake8, black and isort are clean on the three files.
- CI: the only failure is Backend Tests (Windows) (1), the
test_ci_ipv6_routingcollection timeout tracked in #21943. That file is not in this diff. - The PR now conflicts with main 4d5cb47. A local merge shows only
docs/system-specs/modules/learn-cron-dashboard.mdconflicting, so it needs a rebase. - The docstring nit from my last comment is still open: the
roster_project_pathmodule docstring says "this module's one function", and the module has three.
|
@mbajaj92 buluoray approved 7f76da5 on 10-20, so the human review is in. Three things are left before this can land:
After that it goes back to iamwhatever to lift the hold. |
|
[operator: bolichen97] Continuing this in #32008; thanks for the start. |
Problem / Motivation
Goal: let a chat folder's Default agent be chosen from the agents its own
project directory declares, and refuse — in the modal and on the server — an
agent that directory cannot be confirmed to have.
A chat folder can carry a Project directory. A project can define its own
agents in
<project>/.kiro/agents/*.json. Those agents never show up in thefolder's Default agent dropdown. Only the global agents show. So you cannot
pick a project's own agent as a folder's default.
Why it matters
Picking a project's own agent as the default for a folder of chats is the whole
point of setting a project directory on that folder. Today it is impossible: the
agent you want is not in the list. This is the folder-side twin of #8952, which
is the same bug on the Schedule page.
Not a goal
Resolving a folder's default agent server-side. Which agent a new chat gets
stays where it is — the sidebar's own folder actions apply it, and an agent-less
API create still stamps the global default. This PR decides what may be
stored, not who applies it.
Re-validating descendants when a parent folder's project directory later changes,
and re-checking a stored agent that no request touches. The check runs on the
create and update paths, on the value a caller is setting.
Windows folder-level project-agent selection. A platform that cannot pin a
directory descriptor answers
scan_unsupported_platformrather than walking acaller-supplied path by name; the pre-existing session-derived readers keep
working there unchanged.
What changed (motivation → approach → change)
GET /api/agentsderived the project from the active chat; creating a folder hasnone, so a folder's own project agents never appeared.
It now reads an explicit
?project_path=and lists that directory's project agents.The scan is owner-only and every attempt is SEL-audited —
allowedfor a realdirectory,
deniedfor a sensitive one or a non-owner. A bad or blocked path fallsback to the old behaviour.
components/FolderConfigModal.tsxrequests the roster for the directory you typed,debounced, and scopes the dropdown to it;
website/src/api/client/agents.tspassesit through. An agent the directory lacks is flagged and blocks submission,
while an existing folder's saved-but-absent agent still round-trips a rename.
chat_folders.pyenforces the same rule independently, so the refusal does notdepend on which picker is in front of it. On create and update — including a
parent_id-only move, which shifts the inherited directory — it checks the folder'seffective agent against its effective scope, answering
default_agent_out_of_scope,or 503
default_agent_scope_unverifiable/scan_unsupported_platformwhen thatscope cannot be read. Accepted global names come from the same execution catalog the
picker reads, so a selectable template is never refused. A non-person caller is held
to those global names and its supplied directory is never scanned, so the refusal
cannot become an existence oracle. One supplying neither an agent nor a directory
inherits its parent's already-checked pair and is accepted with no scan.
flowchart LR subgraph Before A1[Open folder settings]:::ctx --> B1[dropdown = active chat's agents]:::removed --> C1[project agents absent]:::removed end subgraph After A2[Open folder settings]:::ctx --> B2[fetch agents for the folder's dir]:::added --> C2[project agents listed]:::added end classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E linkStyle 0,1 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 2,3 stroke:#16A34A,stroke-width:2pxReading a directory the caller supplied
A UNC spelling is refused
before any filesystem call and again on the resolved value, through the
hooks.is_unc_shape/unc_probe_allowedgate:resolving
\\host\shareis an outbound SMB connection. Otherwise it goes throughpinned_fs.py, which gainsopen_fenced_for_read_atfor this: the chain to<project_dir>/.kiro/agentsis opened component by component and each entry is readfrom the held descriptor, so nothing is addressed by name after being checked. Where pinning is unavailable,
raise_unverifiablestays falseand the by-name fallback preserves discovery, as the session-derived readers do.
First Principles read the walk as oversized, on the argument that
_read_agent_spec's per-file fence already covers it. Stated here because it isthe kind of thing a reviewer should be able to rule on from the description: the
fence cannot cover it, because
?project_path=answers with the name listderived from the directory listing, and the per-file fence only applies once
that list exists. A component swapped between the sensitivity verdict and the
listing yields names enumerated from a directory the verdict never approved, and
no per-file check is ever reached for a name that is merely reported.
Saving a folder's project directory
chat_folders._validate_project_dirdeliberately does not apply the UNC /link-chain screen — only the absolute-path, sensitive-path and directory-exists
checks it already had on main. First Principles blocked an earlier revision that
added the screen here, and the objection was right: this validator also re-checks
STORED values on the slot-create read path, where any refusal becomes a 400
folder_project_invalidand the folder can open no session at all.hooks._screen_windows_linksrefuses far more than an untrusted share — areadlinkOSError, a..suffix, a target it cannot normalize, and its own chainand depth limits all refuse — so screening here would let an ordinary Windows
junction behind someone's already-saved project directory stop that folder from
starting a chat, on a premise untested on Windows. The screen stays where this PR
needs it: the
?project_path=roster read, where it gates a listing rather thansession start. For a stored value the spawn guard remains the authority, exactly as
_folder_project_overlap_deniedalready says of its own check.Why the save path enforces as well as the picker
check_folder_agent_scopere-checks the agent/project pair server-side on save,answering
400for a scope violation and503when the roster scan cannot complete.Design Review and First Principles both read that as a second enforcement layer and
asked whether the picker's filtering already covers it. It is deliberate, and kept:
the picker narrows what a UI offers, while the endpoint is reachable directly, so
treating a filtered list as the enforcement point would leave the control advisory.
The
503is fail-closed for the same reason — an unreadable roster cannot prove thepair is in scope, so it is refused rather than admitted.
The smaller pieces
agent_spec_format.py'ssplit_listed_spec_pathsdrops a<name>.mdwith a<name>.jsontwin, reusing entries the scan already holds.agent_discovery.pykeepsone verdict per scope:
_scan_project_agent_filescarries the pinnedwalk, and its three callers each decide sensitivity once, before any read.
dashboard/chat_handlers.pycarries the folder's directory into a folder-scoped slotcreate. Strings live in
en.manual.jsonacross twelve catalogs;docs/feature-map/README.mdregisters the control, and.github/black-baseline.txtdrops one now-clean file.Backwards compatibility
Compatible.
?project_path=is a new optional query parameter; a request withoutit resolves the project from the session exactly as before, and an invalid or
refused value falls back to that same path rather than erroring. No existing
response field changes meaning —
scopeis still"global" | "project"on everyrow. A folder with no default agent, and a folder whose saved agent is still
present, both behave as they do on main.
POST/PATCH /api/chat/foldersgains one refusal: a request that sets adefault agent the folder's effective project directory cannot be confirmed to have
is rejected instead of stored. Clearing the agent, omitting it, and re-sending an
existing folder's own saved agent unchanged are all untouched, so a rename or
recolor of a folder whose agent has since disappeared still succeeds. Project
scaffolding sets no agent of its own, so it is refused only when it also carries a
directory and the inherited agent is not globally installed — a refusal that lands
in its per-folder
failedchannel. That server-side refusal is deliberate defense indepth rather than a duplicate of the modal's own gate: the modal withholds Save and
the endpoint refuses independently, so a caller that never went through the picker
is refused too.
One deliberate narrowing for a non-person principal: an app or crew-member caller
setting a folder's default agent is held to the global names and its supplied
project_diris not scanned for that check. Such a caller can still set any globalagent and any directory; what it cannot do is have the gateway read a directory it
merely named, which is what would turn the refusal into an existence oracle.
The pre-existing readers are never refused for lack of pinning support, so
project-agent discovery still resolves for them on every platform: they take the
by-name walk everywhere, uncapped, exactly as on main. Only an owner-supplied
path reaches the descriptor-pinned walk, which refuses an ancestor swapped
mid-walk instead of following it, and refuses rather than truncating.
agent_discovery._link_chain_refusedscreens the owner-supplied paths instead(
?project_path=and a folder'sproject_dir). It invents no new screen: it asksthe one
hooks.validate_file_pathalready runs,hooks._screen_windows_links,which reads each link's stored target locally (
os.readlinkconnects to no host),refuses an untrusted share or an ambiguous root- or drive-relative target, then
swaps a vetted target in and walks the rewritten path again so a deeper link under
a benign one is still reached. It is called directly rather than through
validate_file_pathso the caller keeps its own sensitive-path refusal and auditreason, and off Windows it never refuses.
Readers:
api_chat_folder_create(POST /api/chat/folders) -> the sidebarmodal create (
website/src/pages/chat-sidebar/folders.ts): refused 400/503 onlyfor an effective agent outside the effective scope, which the modal already
gates before Save.
mcp_dashboardchat_folder_createand its path walk (_post,name + parent only): unaffected; a non-owner naming no agent and no directory
inherits its parent's pair without a scan.
cron_script.pyfolder create (name only, top level): unaffected; itseffective agent is the global default.
chat_folder_scaffold.pyroot and childcreate_folder_recordcalls:a candidate whose inherited or global agent the new folder's directory cannot
confirm lands in the per-folder
failedchannel; the root failing stillshort-circuits the call.
PATCH /api/chat/folders/{id}sidebar drag (useSidebarDrag.ts,{parent_id}): an unchanged own agent under its own directory moves without ascan on every platform; an inheriting child moved under a different chain is
re-validated and can 400/503.
PATCHrename and collapse (ChatSidebar.tsx,folders.ts,create.ts,useSidebarDrag.ts): unaffected; no agent, directory or parent.PATCHfrom the folder modal (ChatSidebar.tsx): sends touched fieldsonly, so it is re-validated only when the agent or directory was edited.
mcp_dashboardchat_folder_move(_patch,parent_id): an appprincipal is validated against the global catalog only, so moving a folder
whose own agent is project-only is refused 400.
Tests
test/test_agents_roster_contract.py— the?project_path=contract:owner-only, the SEL
allowed/deniedrecords, fallback to the slot on anabsent or refused value, and the denied-versus-empty sentinel distinction.
test/test_agent_discovery.py— the pinned walk: a symlinked component isrefused, a missing
.kirois not an error, andtest_no_pinned_walk_support_still_scans_by_name_when_opted_inpins that thepre-existing callers keep working where the pinned walk is unavailable, so the
capability gate cannot silently widen to them.
website/src/test/FolderConfigModal.test.tsx— the picker: the roster isfetched for the typed directory, a freshly picked absent agent blocks
submission, each of the four flags renders for its own case, and a seeded
orphan agent still round-trips a rename.
test/test_markdown_agent_specs.py— a<name>.mdwith a<name>.jsontwinlists once in the project scope.
test/test_chat_folder_agent_scope.py— the server-side refusal: anout-of-scope agent is rejected on both create and update, a global agent is
accepted, an unreadable scope answers 503 and an unpinnable platform names
scan_unsupported_platform, and an existing folder's own saved agent stillround-trips. Four more pin the edges: a selectable catalog template is accepted,
a
parent_id-only move is revalidated (and the move is not persisted when itfails), the linked-ancestor screen runs before
realpathrather than after,and a non-person caller's supplied directory is never scanned — asserted on both
the refusal and the acceptance path.
test/test_chat_folder_scaffold.pypins theone documented opt-out.
test/test_junction_link_fences.py— the linked-ancestor walk against realreparse points (a junction on Windows, a directory symlink on POSIX) rather
than a double: a two-link chain pins that EVERY linked ancestor is yielded
root-first, so a deeper junction under a benign shallow one is still reached,
and that the leaf stays excluded.
test/test_slot_create_default_agent.py— a chat created in the folder startson the folder's default agent.
Manual verification
Verified on a dev gateway: set a folder's project directory to a checkout with
.kiro/agents, confirmed its agents appear in Default agent, confirmed achat created in the folder starts on the picked agent, and confirmed each flag
state disables submission and names its reason. Windows behaviour is covered by
mocked-
_winapitests only — no Windows host was available.Screenshots / video
The Default agent dropdown now lists the folder's project agents. An agent the
selected directory does not have is flagged in the trigger, and submission is
blocked until it is changed. There are four flags, kept distinct on purpose:
(not installed)for a genuinely uninstalled agent,(not in this project)fora valid agent picked under a different directory,
(can't verify)when the scanitself failed — so absence is unproven rather than established — and
(needs a project directory)for an agent only a project directory could supplywhen no directory is set.
Folder settings, Default agent dropdown open, listing the folder's project
agents (
repo-dev,repo-reviewer) above the globals, withInherit (kirocrew)at the top:A project agent picked against a directory that scanned cleanly, as the baseline
for the states below. The hint states what the pick means: it is pre-selected for
new chats created in this folder.
While the roster for a newly-typed directory is being fetched, submission is
disabled and the picker still shows the previous scope's agents. The
Loading agents…hint is what explains the disabled button, matching theLoading tags…hint the Tags field two rows up already shows:Once the roster arrives the hint clears and Save recovers:
Both frames come from
node scripts/capture-folder-agent-roster-loading.mjs(fromwebsite/), which runs the real built SPA with/api/**stubbed and holds theroster route open so the in-flight frame is a real render of that state. It
asserts the hint is present and Save is disabled in the first, and that the hint
has cleared and Save has recovered in the second, so a frame that did not show
the claimed state fails the run instead of being published.
The blocked state with a project directory that scans cleanly but does not
declare the picked agent: re-scoping to
/repo/otherflags the triggerrepo-dev (not in this project), and the notice names both remedies — pick anagent the directory has, or point the folder at the directory that has it.
Create folder is disabled.
The blocked state with no project directory at all, reached by picking a
project agent and then clearing the directory. The Project directory field here
is empty — the grey
/Users/you/code/projectis its placeholder, not a value.The trigger reads
repo-dev (needs a project directory)rather than(not in this project), because with nothing in scope there is no project to beabsent from — and it names the cause rather than the symptom, so it cannot be
misread as the separate
(not installed)case. The noticeleads with the remedy that applies when nothing is scoped: pick a globally
installed agent. It names no button, because the footer differs by mode —
Cancel / Create folderwhen creating,Save changeswhen editing.The roster-scan error state: a failed directory scan surfaces "Couldn't read this
directory's agents." with a Retry action, scrolled into view rather than left
below the modal's fold — it is the only thing naming why the button went dead.
The trigger keeps naming the pick, flagged
repo-dev (can't verify): a failedscan cannot establish that an agent is absent, only that it could not be checked.
It must never fall back to reading
Inherit (default), which would show anapparently valid form with a dead button and nothing explaining it.
That frame comes from
node scripts/capture-folder-agent-roster-scan-error.mjs(from
website/), a sibling of the loading harness. It answers one directorywith a roster and fails another with the same 503 the handler returns when the
audit write fails, and asserts on each frame that the trigger names the pick,
that it does not read
Inherit, that submission is disabled, that the errorrow's bounding box sits inside the modal's, and that the notice does not
contradict its own label.
Every frame above renders the shipped notice wording and the
Enter to submitfooter hint, which is unconditional here exactly as on
main.The unsupported-platform state — the one a platform that cannot pin a directory
descriptor reaches — now names the platform rather than saying "this platform", and
its severity follows Save. Three frames cover it, produced by
node scripts/capture-folder-agent-unsupported-platform.mjs(fromwebsite/) andalso committed under
temp-screenshots/10107-unsupported-platform/.Save blocked: the roster row reads "Project agents can't be read on Windows yet.
Pick a global agent to save this folder." beside the flagged trigger
repo-dev (not supported on this platform), with no Retry — one could never succeedwhere the capability is absent — and Create folder disabled.
Save still working: the same refusal, but the folder takes the global default, so
nothing is unverifiable. The row drops the instruction it no longer needs and reads
"Project agents can't be read on Windows yet. Global agents still work.", sitting
beside the ordinary "Pre-selected for new chats created here." hint rather than
replacing it, with Save enabled. An explicit pick cannot reach this frame even when
the agent chosen is itself global: once a directory answers 503 the modal cannot
confirm the pick against it, and the row returns to the blocking wording.
A third committed frame shows the distinct inherited form,
Inherit (repo-dev — not supported on this platform), on a real child folder openedthrough the sidebar's own Folder settings.
The harness answers the scoped roster call with the 503 the handler returns for that
capability and asserts, before writing any frame, that the row carries the copy for
the state it claims and not the other one, that it offers no Retry, that the
retryable scan-error row did not render in its place, that Save is disabled in the
blocked frame and enabled in the working one, that the pre-selection hint survives
there, and that the row sits inside the modal's visible box. A frame that did not
show the claimed state fails the run instead of being published.
The inherited-agent flag appears in no attachment because every earlier capture
scene pinned an explicit agent, so it is committed under
temp-screenshots/10107-inherited-agent-flag/instead — the path.gitignoredocuments for a contributor without attachment-upload permission, and the one
both review lanes read.
capture-folder-agent-inherited-orphan.mjsproducesall four flagged states on a real child folder -- absent, dir-less, unverified,
and the unflagged baseline -- and asserts each one's own cause text, the em-dash
spelling, Save disabled and an unclipped notice before writing any frame. The
(not installed)look is pre-existing.Related Issues
Closes #10106
Pattern harvest
Rule candidate: review-prompt
Pattern: a feature that reads a user-supplied filesystem path re-implements a
pinned walk instead of calling the module that already owns one, so the security
review lands on the copy rather than on the shared primitive.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)