Repository navigation
fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount - #28595
Conversation
…up survives a masked mount detect_project_dir walked CWD ancestors with Path.is_dir(), which returns False for a missing path but raises PermissionError on EPERM. When $HOME symlink-resolves into a sandbox-masked mount, the masked ancestor answers EPERM and every managed MCP server crashed before serving a request. Probe markers and the saved project_dir file through helpers that count an unprobeable path as absent. The sandbox mask is unchanged. Fixes #26229
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the guard sits on the failing probe, leaves the mask unchanged, and keeps the existing "not found" result. Notes
[DESIGN-REVIEWED] ef875f2 Description read[DESCRIPTION-READ] 03f17334909406b1ebabbf35c648134b66e863abd61e674d4c595a9185eeaa63 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a mechanism-level fix with a linked issue (#26229) and tests that fail on base. It adds no new surface or default. What this change shipsInventory (3 items) — 3 justifiedIntent: let managed MCP servers start when
[FIRST-PRINCIPLES-REVIEWED] ef875f2 Description read[DESCRIPTION-READ] 7783357218a1ab2245636a0d8b03808e6c0648f3c967328fcdd3140dcf9634fd That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
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: |
iamwhatever
left a comment
There was a problem hiding this comment.
Approve at ef875f2.
The probe guard turns an EPERM/EACCES from Path.is_dir()/is_file()/read_text() into the existing "not found" result, so detection keeps walking and MCP start-up no longer crashes under a masked mount (
KiroCrew/src/kiro_crew/project_dir.py
Lines 20 to 61 in ef875f2
os.stat. All checks on this head are green.
AI findings judged non-blocking:
- Design: other start-up probes under the same mount might hit another EPERM. Out of scope; this fixes the reported crash frame, and a further failure would be a separate report.
— crew-pr-reviewer (r143)
Each main PR below was cherry-picked with -x in merge order, oldest first, then squashed (PR Hygiene allows two commits). - fix(hooks): give KAS-run agent spec hooks KIRO_SESSION_ID (#24952) (cherry picked from commit 3a46e60) adapted: 0.11.0's extra-hook branch keeps its from_spec line; the facade shape digest is re-measured. - fix(acp): send a KAS session the kiro-cli spelling of a stored model id (#25671) (cherry picked from commit 7df9837) adapted: three assertions on a pin-refusal field 0.11.0's handle lacks are left out of the test. - fix(kas): start Crew's own MCP servers first so session start does not wait behind slow user servers (#26148) (cherry picked from commit 429b4f7) adapted: 0.11.0 names the hoist hoist_managed_servers. - fix(acp): offer a KAS MCP sign-in only when the user names the server (#26481) (cherry picked from commit 2718088) adapted: the regenerate and chat-runner hunks keep 0.11.0's call shapes and add only this PR's lines. - fix(kas): start env-bearing MCP servers through a local launcher (#26785) (cherry picked from commit d6bb74f) adapted: hoist_managed_servers name; only this PR's handle field and agent_specs helper; the security line budget and the leaf-only population pin are re-measured for the kas-mcp-launch leaf. - fix(kas): refuse a blank kas remove --version instead of deleting every engine (#26623) (cherry picked from commit 2183c96) - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) adapted: agent-spec-fields.md keeps 0.11.0's toolsSettings row, which does not carry the sentence this PR rewrote; security.md moves. - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) adapted: its agent-spec-fields.md sentence lands on 0.11.0's permissions row. - fix(kas): carry session identity to builtin app MCP servers (#28732) (ported by hand from commit 8e9701f) adapted: 0.11.0 has no managed-entry resolution or vault identity on SessionExtras, so the harness returns only the app launches beside the payload; hoist_managed_servers takes app_launches beside resume=; acp-client.md drops the managed-entry sentence 0.11.0 lacks. - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) adapted: its test calls 0.11.0's hoist_managed_servers. - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) adapted: cli_config.py takes only the ack helper and its call sites; configuration.md and the decisions index take only this PR's rows; the decision record names the shared-crew spec, absent on 0.11, without a backticked path so docs-lint passes. - fix(mcp): heal a saved absolute Windows command's PATHEXT extension (#25945) (cherry picked from commit a96eb1f) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56)
Each main PR below was cherry-picked with -x in merge order, oldest first, then squashed (PR Hygiene allows two commits). - fix(hooks): give KAS-run agent spec hooks KIRO_SESSION_ID (#24952) (cherry picked from commit 3a46e60) adapted: 0.11.0's extra-hook branch keeps its from_spec line; the facade shape digest is re-measured. - fix(acp): send a KAS session the kiro-cli spelling of a stored model id (#25671) (cherry picked from commit 7df9837) adapted: three assertions on a pin-refusal field 0.11.0's handle lacks are left out of the test. - fix(kas): start Crew's own MCP servers first so session start does not wait behind slow user servers (#26148) (cherry picked from commit 429b4f7) adapted: 0.11.0 names the hoist hoist_managed_servers. - fix(acp): offer a KAS MCP sign-in only when the user names the server (#26481) (cherry picked from commit 2718088) adapted: the regenerate and chat-runner hunks keep 0.11.0's call shapes and add only this PR's lines. - fix(kas): start env-bearing MCP servers through a local launcher (#26785) (cherry picked from commit d6bb74f) adapted: hoist_managed_servers name; only this PR's handle field and agent_specs helper; the security line budget and the leaf-only population pin are re-measured for the kas-mcp-launch leaf. - fix(kas): refuse a blank kas remove --version instead of deleting every engine (#26623) (cherry picked from commit 2183c96) - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) adapted: agent-spec-fields.md keeps 0.11.0's toolsSettings row, which does not carry the sentence this PR rewrote; security.md moves. - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) adapted: its agent-spec-fields.md sentence lands on 0.11.0's permissions row. - fix(kas): carry session identity to builtin app MCP servers (#28732) (ported by hand from commit 8e9701f) adapted: 0.11.0 has no managed-entry resolution or vault identity on SessionExtras, so the harness returns only the app launches beside the payload; hoist_managed_servers takes app_launches beside resume=; acp-client.md drops the managed-entry sentence 0.11.0 lacks. - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) adapted: its test calls 0.11.0's hoist_managed_servers. - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) adapted: cli_config.py takes only the ack helper and its call sites; configuration.md and the decisions index take only this PR's rows; the decision record names the shared-crew spec, absent on 0.11, without a backticked path so docs-lint passes. - fix(mcp): heal a saved absolute Windows command's PATHEXT extension (#25945) (cherry picked from commit a96eb1f) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56) - fix(kas): judge a remote-wrapper web search as its built-in (#28704) (cherry picked from commit 54f4e14) adapted: security.md gets this PR's one inserted clause on 0.11.0's wording of the same bullet.
Each main PR below was cherry-picked with -x in merge order, oldest first, then squashed (PR Hygiene allows two commits). - fix(hooks): give KAS-run agent spec hooks KIRO_SESSION_ID (#24952) (cherry picked from commit 3a46e60) adapted: 0.11.0's extra-hook branch keeps its from_spec line; the facade shape digest is re-measured. - fix(acp): send a KAS session the kiro-cli spelling of a stored model id (#25671) (cherry picked from commit 7df9837) adapted: three assertions on a pin-refusal field 0.11.0's handle lacks are left out of the test. - fix(kas): start Crew's own MCP servers first so session start does not wait behind slow user servers (#26148) (cherry picked from commit 429b4f7) adapted: 0.11.0 names the hoist hoist_managed_servers. - fix(acp): offer a KAS MCP sign-in only when the user names the server (#26481) (cherry picked from commit 2718088) adapted: the regenerate and chat-runner hunks keep 0.11.0's call shapes and add only this PR's lines. - fix(kas): start env-bearing MCP servers through a local launcher (#26785) (cherry picked from commit d6bb74f) adapted: hoist_managed_servers name; only this PR's handle field and agent_specs helper; the security line budget and the leaf-only population pin are re-measured for the kas-mcp-launch leaf. - fix(kas): refuse a blank kas remove --version instead of deleting every engine (#26623) (cherry picked from commit 2183c96) - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) adapted: agent-spec-fields.md keeps 0.11.0's toolsSettings row, which does not carry the sentence this PR rewrote; security.md moves. - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) adapted: its agent-spec-fields.md sentence lands on 0.11.0's permissions row. - fix(kas): carry session identity to builtin app MCP servers (#28732) (ported by hand from commit 8e9701f) adapted: 0.11.0 has no managed-entry resolution or vault identity on SessionExtras, so the harness returns only the app launches beside the payload; hoist_managed_servers takes app_launches beside resume=; acp-client.md drops the managed-entry sentence 0.11.0 lacks. - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) adapted: its test calls 0.11.0's hoist_managed_servers. - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) adapted: cli_config.py takes only the ack helper and its call sites; configuration.md and the decisions index take only this PR's rows; the decision record names the shared-crew spec, absent on 0.11, without a backticked path so docs-lint passes. - fix(mcp): heal a saved absolute Windows command's PATHEXT extension (#25945) (cherry picked from commit a96eb1f) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56) - fix(kas): judge a remote-wrapper web search as its built-in (#28704) (cherry picked from commit 54f4e14) adapted: security.md gets this PR's one inserted clause on 0.11.0's wording of the same bullet. - fix(dashboard): give every MCP handler error a stable code (#26661) (cherry picked from commit 14bd1a5) adapted: error-code-baseline.json regenerated with its generator on 0.11.0's tree (the same mcp.py entry drops as on main). - fix(mcp): refuse to replace an unparseable global mcp.json (#28023) (cherry picked from commit 52184dd) adapted: the sync-io baseline moves mcp.py 8 -> 6 as on main; learn-cron-dashboard.md gets this PR's inserted sentence on 0.11.0's wording; test_lenient_read_rewrite_ratchet.py, absent on 0.11.0, stays absent.
Each main PR below was cherry-picked with -x in merge order, oldest first, then squashed (PR Hygiene allows two commits). - fix(hooks): give KAS-run agent spec hooks KIRO_SESSION_ID (#24952) (cherry picked from commit 3a46e60) adapted: 0.11.0's extra-hook branch keeps its from_spec line; the facade shape digest is re-measured. - fix(acp): send a KAS session the kiro-cli spelling of a stored model id (#25671) (cherry picked from commit 7df9837) adapted: three assertions on a pin-refusal field 0.11.0's handle lacks are left out of the test. - fix(kas): start Crew's own MCP servers first so session start does not wait behind slow user servers (#26148) (cherry picked from commit 429b4f7) adapted: 0.11.0 names the hoist hoist_managed_servers. - fix(acp): offer a KAS MCP sign-in only when the user names the server (#26481) (cherry picked from commit 2718088) adapted: the regenerate and chat-runner hunks keep 0.11.0's call shapes and add only this PR's lines. - fix(kas): start env-bearing MCP servers through a local launcher (#26785) (cherry picked from commit d6bb74f) adapted: hoist_managed_servers name; only this PR's handle field and agent_specs helper; the security line budget and the leaf-only population pin are re-measured for the kas-mcp-launch leaf. - fix(kas): refuse a blank kas remove --version instead of deleting every engine (#26623) (cherry picked from commit 2183c96) - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) adapted: agent-spec-fields.md keeps 0.11.0's toolsSettings row, which does not carry the sentence this PR rewrote; security.md moves. - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) adapted: its agent-spec-fields.md sentence lands on 0.11.0's permissions row. - fix(kas): carry session identity to builtin app MCP servers (#28732) (ported by hand from commit 8e9701f) adapted: 0.11.0 has no managed-entry resolution or vault identity on SessionExtras, so the harness returns only the app launches beside the payload; hoist_managed_servers takes app_launches beside resume=; acp-client.md drops the managed-entry sentence 0.11.0 lacks. - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) adapted: its test calls 0.11.0's hoist_managed_servers. - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) adapted: cli_config.py takes only the ack helper and its call sites; configuration.md and the decisions index take only this PR's rows; the decision record names the shared-crew spec, absent on 0.11, without a backticked path so docs-lint passes. - fix(mcp): heal a saved absolute Windows command's PATHEXT extension (#25945) (cherry picked from commit a96eb1f) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56) - fix(kas): judge a remote-wrapper web search as its built-in (#28704) (cherry picked from commit 54f4e14) adapted: security.md gets this PR's one inserted clause on 0.11.0's wording of the same bullet. - fix(dashboard): give every MCP handler error a stable code (#26661) (cherry picked from commit 14bd1a5) adapted: error-code-baseline.json regenerated with its generator on 0.11.0's tree (the same mcp.py entry drops as on main). - fix(mcp): refuse to replace an unparseable global mcp.json (#28023) (cherry picked from commit 52184dd) adapted: the sync-io baseline moves mcp.py 8 -> 6 as on main; learn-cron-dashboard.md gets this PR's inserted sentence on 0.11.0's wording; test_lenient_read_rewrite_ratchet.py, absent on 0.11.0, stays absent. - fix(acp): remove a new KAS session's app launch snapshots at shutdown (#28954) (cherry picked from commit 1217a85) adapted: only this PR's launch_snapshots lines (request_identity is another PR's); 0.11.0's hoist_managed_servers name; the two test_runtime_bindings signature digests re-measured.
…28835) Each main PR below was cherry-picked with -x in merge order, oldest first, then squashed (PR Hygiene allows two commits). - fix(hooks): give KAS-run agent spec hooks KIRO_SESSION_ID (#24952) (cherry picked from commit 3a46e60) adapted: 0.11.0's extra-hook branch keeps its from_spec line; the facade shape digest is re-measured. - fix(acp): send a KAS session the kiro-cli spelling of a stored model id (#25671) (cherry picked from commit 7df9837) adapted: three assertions on a pin-refusal field 0.11.0's handle lacks are left out of the test. - fix(kas): start Crew's own MCP servers first so session start does not wait behind slow user servers (#26148) (cherry picked from commit 429b4f7) adapted: 0.11.0 names the hoist hoist_managed_servers. - fix(acp): offer a KAS MCP sign-in only when the user names the server (#26481) (cherry picked from commit 2718088) adapted: the regenerate and chat-runner hunks keep 0.11.0's call shapes and add only this PR's lines. - fix(kas): start env-bearing MCP servers through a local launcher (#26785) (cherry picked from commit d6bb74f) adapted: hoist_managed_servers name; only this PR's handle field and agent_specs helper; the security line budget and the leaf-only population pin are re-measured for the kas-mcp-launch leaf. - fix(kas): refuse a blank kas remove --version instead of deleting every engine (#26623) (cherry picked from commit 2183c96) - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) adapted: agent-spec-fields.md keeps 0.11.0's toolsSettings row, which does not carry the sentence this PR rewrote; security.md moves. - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) adapted: its agent-spec-fields.md sentence lands on 0.11.0's permissions row. - fix(kas): carry session identity to builtin app MCP servers (#28732) (ported by hand from commit 8e9701f) adapted: 0.11.0 has no managed-entry resolution or vault identity on SessionExtras, so the harness returns only the app launches beside the payload; hoist_managed_servers takes app_launches beside resume=; acp-client.md drops the managed-entry sentence 0.11.0 lacks. - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) adapted: its test calls 0.11.0's hoist_managed_servers. - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) adapted: cli_config.py takes only the ack helper and its call sites; configuration.md and the decisions index take only this PR's rows; the decision record names the shared-crew spec, absent on 0.11, without a backticked path so docs-lint passes. - fix(mcp): heal a saved absolute Windows command's PATHEXT extension (#25945) (cherry picked from commit a96eb1f) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56) - fix(kas): judge a remote-wrapper web search as its built-in (#28704) (cherry picked from commit 54f4e14) adapted: security.md gets this PR's one inserted clause on 0.11.0's wording of the same bullet. - fix(dashboard): give every MCP handler error a stable code (#26661) (cherry picked from commit 14bd1a5) adapted: error-code-baseline.json regenerated with its generator on 0.11.0's tree (the same mcp.py entry drops as on main). - fix(mcp): refuse to replace an unparseable global mcp.json (#28023) (cherry picked from commit 52184dd) adapted: the sync-io baseline moves mcp.py 8 -> 6 as on main; learn-cron-dashboard.md gets this PR's inserted sentence on 0.11.0's wording; test_lenient_read_rewrite_ratchet.py, absent on 0.11.0, stays absent. - fix(acp): remove a new KAS session's app launch snapshots at shutdown (#28954) (cherry picked from commit 1217a85) adapted: only this PR's launch_snapshots lines (request_identity is another PR's); 0.11.0's hoist_managed_servers name; the two test_runtime_bindings signature digests re-measured.
Every main PR the 0.11.2 backport carried that release/0.12.0 still lacks, plus #28925, cherry-picked with -x in main merge order, oldest first, then squashed (PR Hygiene allows two commits). Each pick's added and removed lines match its main commit except where noted. - fix(mcp): refuse to replace an unparseable global mcp.json (#28023) (cherry picked from commit 52184dd) conflict in surrounding lines only; the changed lines are main's. - fix(kas): read allowedCommands classes, groups and quoted parens like kiro-cli (#28437) (cherry picked from commit 3fc4217) conflict in surrounding lines only; the changed lines are main's. - feat(dashboard): answer /context, /usage, /help and /agent locally on KAS (#26681) (cherry picked from commit 84ea89d) - fix(mcp): skip a non-UTF-8 mcp.json in discovery like bad JSON (#28795) (cherry picked from commit 2af230d) - fix(kas): split an authored rule's long match instead of refusing the block (#28510) (cherry picked from commit 60595c7) - fix(kas): carry session identity to builtin app MCP servers (#28732) (cherry picked from commit 8e9701f) - fix(kas): relay a remote MCP server's headers through a local bridge (#28615) (cherry picked from commit 755c71b) - fix(kas): mount use_subagent as the engine's invoke_sub_agent (#28852) (cherry picked from commit 83a76fc) - feat(kas): keep remote MCP sign-ins across sessions by default (#28630) (cherry picked from commit 00dc406) conflict in surrounding lines only: docs/decisions/README.md and configuration.md lack neighbouring rows 0.12.0 does not carry. - fix(project-dir): treat an EPERM marker probe as absent so MCP start-up survives a masked mount (#28595) (cherry picked from commit 742ae56) - fix(kas): judge a remote-wrapper web search as its built-in (#28704) (cherry picked from commit 54f4e14) - fix(acp): remove a new KAS session's app launch snapshots at shutdown (#28954) (cherry picked from commit 1217a85) - fix: run spec hook commands longer than 4096 characters on kas (#28925) (cherry picked from commit 0fe72d6) adapted: agent-host-contract.md gets main's inserted sentence in 0.12.0's paragraph, which lacks main's later user-hook-files text.
Problem / Motivation
Goal: Managed MCP servers start normally when
$HOME(or the launch directory) resolves into a mount that the sandbox masks.On a host where
$HOMEis a symlink into a mount the namespace sandbox masks (for example/mnt/xyz/home/lgpointing to/xyz-servers/xyz-data/home/lg), every managed MCP server (kirocrew-core,-cron,-guide,-mate) exits at start-up, and the user seesKAS managed MCP initialization failed: kirocrew-core: failed (Connection closed). Sessions cannot be created or resumed.Why it matters
This makes Kiro Crew unusable on any host where home directories are symlinks into a shared network mount, which is a common enterprise NFS/automount setup.
Not a goal
What changed (motivation → approach → change)
PermissionError: [Errno 1] Operation not permitted: '/xyz-servers/skills'raised fromdetect_project_dirinsideslim_server, before the server answers its first request.detect_project_dirwalks up fromPath.cwd().resolve()and probes each ancestor withPath.is_dir(). On Python 3.12,is_dir()returns False for a missing path, but it re-raises EPERM. Inside the sandbox, a masked ancestor answers EPERM instead of ENOENT, so the probe raises and start-up crashes.src/kiro_crew/project_dir.py, probe markers through_is_dir(), which counts anyOSErroras "not a directory here". The walk then continues. The savedproject_dirfile is read under the same rule, so an unreadable saved file counts as absent. Results for every layout that can be probed are unchanged.Intended? / Repro
Intended? No. Nothing in the code or history means a denied ancestor to stop start-up. The docstring at
src/kiro_crew/project_dir.py:21-29(main @ e858e5b) describes a best-effort search ("walk up from CWD", then the saved file, elseNone). The only commit that touched the file, 3ab3072 (#19584), moved this detection into the slim MCP entry so it would be cheap. It did not mean for the detection to fail on a denied path. The crash site issrc/kiro_crew/project_dir.py:32(all((d / m).is_dir() for m in PROJECT_MARKERS)), called fromsrc/kiro_crew/mcp_entry.py:134.Repro (on main @ e858e5b, Python 3.12.13, no test suite run): I wrote a standalone script that imports
kiro_crew.project_dirfromsrc/and makesos.statraisePermissionError(EPERM)for any path under/masked, which mimics the sandbox mask. It then pointsPath.cwd()at/masked/home/lgand callsdetect_project_dir(lambda: Path("/nonexistent/project_dir")).CRASH: PermissionError [Errno 1] Operation not permitted: '/masked/home/lg/skills'. The reporter's traceback ends in the same frame (project_dir.py, line 32).result: None, so start-up continues.Backwards compatibility
Compatible: every path that could be probed before gives the same answer. Only a probe that used to raise now counts as "not found".
Removes nothing: the change only turns a crash into the existing "no project dir found" result.
Tests
test/test_mcp_slim_entry.py::test_project_dir_walk_skips_an_ancestor_that_answers_eperm: the CWD sits under a directory whosestatanswers EPERM. Detection must not raise, must fall through to the saved file, and must returnNonewhen there is no saved file.test/test_mcp_slim_entry.py::test_project_dir_saved_file_that_answers_eperm_counts_as_absent: a savedproject_dirfile whosestatanswers EPERM counts as absent (None) and does not raise.Both tests raise
PermissionErroron main, because the old code callsPath.is_dir()/Path.is_file()without a guard.Proof: not provable -- other: this host forbids local test runs; CI is the only test runner, and the standalone repro above shows the red on main
Manual verification
The standalone repro script described under Intended? / Repro: it crashes on main and returns
Noneon this branch. Static gates black, isort and flake8 pass on both changed files.Blind review: the adversarial-review skill could not spawn a reviewer (governance refused subagent spawn on this host), so the author ran one sequential pass in their own context (degraded mode). It checked for behavior drift vs main, remaining raise paths, sandbox weakening, and test leakage from the
os.statmonkeypatch. It found nothing at Medium or worse. On Windows with Python 3.13+,Path.is_dirdoes not go throughos.stat, so the new tests pass there without exercising the denied probe. They still exercise it on Linux and macOS.Related Issues
Fixes #26229
Sibling sweep
Swept: git grep -nE ".is_dir() for m in" -- src/
Sibling: src/kiro_crew/doctor_checks/install.py:577 -- not affected -- probes only the configured project dir after Path(proj).is_dir() already succeeded, never masked ancestors
Pattern harvest
Rule candidate: review-prompt
Pattern: a best-effort filesystem probe on start-up (
is_dir/is_file/existson 3.12) must treat EPERM/EACCES like ENOENT, or a masked or denied path crashes the processChecklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.