Repository navigation
fix(capabilities): a resolver stall cannot refuse a member its own spec - #32224
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is aimed at the cause: three checks on paths the member start had already resolved itself now use the canonical-path gate that #28393 established. A test pins it and fails on base. Not checked: that macOS charges a starved resolver child as a mount stall; only the forced-miss test shows it. What this change shipsInventory (6 items) — 6 justifiedIntent: a crew member on a busy Mac starts on its own healthy spec instead of being refused "source unreadable" for 30 s. FIX.
[FIRST-PRINCIPLES-REVIEWED] 40e66f0 Description read[DESCRIPTION-READ] 14a0fe2b1a455ad0b337358d88c45388db8cf6f113cd8c055a8f332528ede327 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix reuses the existing Notes
[DESIGN-REVIEWED] 40e66f0 Description read[DESCRIPTION-READ] 180cbc48e09499ddf8d25e9fdb0025a53372a9078127b336e0f1ca5d2e8bd077 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: The change sends three member-start path checks through TIGHTENING: The sensitive-path gate on the member start now uses ADJUDICATED: 13 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: I wrote candidates in posix and windows spellings; none are platform UNADJUDICATED: The guard is the file-path sensitive gate, switched with Inputs I would have submitted to this gate:
Two narrowings I can argue but not confirm:
[SCOPE-REVIEWED] 40e66f0 |
00d01b9 to
c81b4f9
Compare
|
[operator: bolichen97] Backend Tests (3.12, 2) and (Windows) (2) fail on |
A member start (session_capabilities.prepare_runtime, run under asyncio.to_thread) resolves its workspace, its agent spec's name and the spec's descriptor itself, then asks whether each path is sensitive. Three of those checks handed the canonical path to is_sensitive_path, which resolves it again on the bounded mc-pathres pool and fails closed. On macOS the pool has no syscall sample, so one resolver child that misses its deadline on a loaded runner is charged as a mount stall, and every path under that prefix then reads as sensitive for 30 s. The member start refused its own healthy spec as source_unreadable. The three checks now use the canonical-path gate, which answers inline off the event loop and stays bounded on it, with the same gate list: - agent._spec_path_shape_refusal judges the spec's Path.resolve() with is_sensitive_canonical_path. - config.loader_pipeline.default_project_dir judges the workspace's realpath with is_sensitive_canonical_path. - hooks.safe_read_file_bytes_nolink takes canonical_gate, as safe_read_file already does: the realpath from validate_file_path and the descriptor's kernel path (identity and within-root checks) use the canonical gate. agent_capabilities._read_spec passes it. The keyword is passed on only when set, and the identity comparison itself is unchanged. A sensitive path is refused exactly as before. Closes #27388
c81b4f9 to
40e66f0
Compare
|
[operator: bolichen97] The red |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on 40e66f0, no conflict, no open change request.
…ec (#32224) A member start (session_capabilities.prepare_runtime, run under asyncio.to_thread) resolves its workspace, its agent spec's name and the spec's descriptor itself, then asks whether each path is sensitive. Three of those checks handed the canonical path to is_sensitive_path, which resolves it again on the bounded mc-pathres pool and fails closed. On macOS the pool has no syscall sample, so one resolver child that misses its deadline on a loaded runner is charged as a mount stall, and every path under that prefix then reads as sensitive for 30 s. The member start refused its own healthy spec as source_unreadable. The three checks now use the canonical-path gate, which answers inline off the event loop and stays bounded on it, with the same gate list: - agent._spec_path_shape_refusal judges the spec's Path.resolve() with is_sensitive_canonical_path. - config.loader_pipeline.default_project_dir judges the workspace's realpath with is_sensitive_canonical_path. - hooks.safe_read_file_bytes_nolink takes canonical_gate, as safe_read_file already does: the realpath from validate_file_path and the descriptor's kernel path (identity and within-root checks) use the canonical gate. agent_capabilities._read_spec passes it. The keyword is passed on only when set, and the identity comparison itself is unchanged. A sensitive path is refused exactly as before. Closes #27388 (cherry picked from commit 123cc51) Originally authored on main by Bolin Chen (bolichen97); authored here with the public identity because the commit guard refuses the original address.
…ec (#32224) A member start (session_capabilities.prepare_runtime, run under asyncio.to_thread) resolves its workspace, its agent spec's name and the spec's descriptor itself, then asks whether each path is sensitive. Three of those checks handed the canonical path to is_sensitive_path, which resolves it again on the bounded mc-pathres pool and fails closed. On macOS the pool has no syscall sample, so one resolver child that misses its deadline on a loaded runner is charged as a mount stall, and every path under that prefix then reads as sensitive for 30 s. The member start refused its own healthy spec as source_unreadable. The three checks now use the canonical-path gate, which answers inline off the event loop and stays bounded on it, with the same gate list: - agent._spec_path_shape_refusal judges the spec's Path.resolve() with is_sensitive_canonical_path. - config.loader_pipeline.default_project_dir judges the workspace's realpath with is_sensitive_canonical_path. - hooks.safe_read_file_bytes_nolink takes canonical_gate, as safe_read_file already does: the realpath from validate_file_path and the descriptor's kernel path (identity and within-root checks) use the canonical gate. agent_capabilities._read_spec passes it. The keyword is passed on only when set, and the identity comparison itself is unchanged. A sensitive path is refused exactly as before. Closes #27388 (cherry picked from commit 123cc51) Originally authored on main by Bolin Chen (bolichen97); authored here with the public identity because the commit guard refuses the original address.
Problem / Motivation
Goal: A crew member starts on its own healthy agent spec even when a sensitive-path resolver child is slow on a busy macOS host.
On the macOS CI shard,
test/test_subagent_continuable_template.py::TestContinuationTemplateNamespace::test_named_crew_keeps_member_identity[True-]fails now and then: the queued member run ends withCapabilityError: source_unreadable(run, shard 2, 1 failed of 38573). Just before it, the log sayssensitive-path symlink resolution did not complete in 2.0s (stalled mount?); refusing paths under the stalled prefix for the next 30s (stall #1). It has never failed on Linux.Why it matters
The same thing can happen to a real member start on a loaded Mac. One slow resolver round trip makes the member refuse its own spec as "source unreadable", and for 30 s every later start under that prefix is refused too. The macOS CI lane loses a run to it each time.
Not a goal
safe_read_file_bytes_nolinkkeeps the bounded gate unless a caller passescanonical_gate=True, and only the member start's spec read does.What changed (motivation → approach → change)
Cause. A member start (
session_capabilities.prepare_runtime, run withasyncio.to_thread) computes three paths itself: the workspacerealpath, the spec'sPath.resolve(), and therealpathand descriptor name of the spec it reads. It then askedis_sensitive_pathabout each, which resolves the path again in a resolver child with a 2 s budget and refuses if the child is late. On macOS the pool cannot sample what a late child was doing, so a child that was only starved of CPU is charged as a stalled mount, and every path under that prefix is refused for 30 s. Linux reads/procand treats a starved child as load, so a miss refuses only that one check.Change. These three checks now use the canonical-path gate, the same entry point #28393 used for #28363. Off the event loop it answers inline with no resolver child. On the loop it stays bounded. The gate list is the same either way.
_spec_path_shape_refusal(agent_parts/spec_lookup.py)is_sensitive_pathis_sensitive_canonical_pathdefault_project_dir(config/loader_pipeline.py)is_sensitive_pathis_sensitive_canonical_pathhooks.safe_read_file_bytes_nolinkfromagent_capabilities._read_specis_sensitive_pathon the name and the descriptorcanonical_gate=True:is_sensitive_canonical_path/canonical_path_refusalsafe_read_file_bytes_nolinktakes the samecanonical_gatekeywordsafe_read_filealready has. It passes it throughvalidate_file_path/screen_file_pathand_opened_file_matches_validated_path. The keyword is passed on only when it is set, so a default call reaches its callees with the same arguments it does onmain.src/kiro_crew/agent.pyimportsis_sensitive_canonical_path, because theagent_partsowners run on that module's namespace. The descriptor identity comparison is not touched._read_speckeeps the same outcomes (no bytes, a parse error, an oversize file or a non-object all raisesource_unreadable) andagent_capabilities.pystays at 2,000 lines.default_project_dirand_spec_path_shape_refusalare shared helpers, so their other callers that run off the loop (the warm pool's cwd refresh, the member thread opener, fork refresh, the conductor installer) get the inline answer too, by the same per-thread rule #28393 relies on.security.mdandmemory-skills-hooks.mdname the new claimants.This touches
src/kiro_crew/hook_runtime/and needs a Sensitive Change sign-off from a maintainer other than the author.Backwards compatibility
Compatible:
canonical_gatedefaults toFalse, the gate list and refusal wording are unchanged, and a sensitive path is refused by all three checks exactly as before.Removes nothing: no path, key, function or refusal is removed; only which submission path answers three checks changes.
Tests
test/test_member_start_canonical_gate.py::test_a_member_starts_on_its_own_spec_while_every_resolver_child_misses_its_deadline: makes every resolver child round trip (SubprocessPoolExecutor.call_op) miss its deadline the way macOS reports it (no syscall sample, so the miss is charged as a mount stall). It asserts the member start still reads its own spec and sends nothing to the pool from its own thread. Onmainit fails with the CI error,source_unreadable.test/test_member_start_canonical_gate.py::test_each_canonical_member_start_check_still_refuses_a_sensitive_path: each changed check still refuses a fenced canonical path (the crew home's.envanddiag). With the name check passed, the opened descriptor's own check still refuses.envand admits a plain file beside it.test/test_session_pool_refill.py::TestDefaultProjectDir::test_returns_empty_when_sensitivepatchesis_sensitive_canonical_path, the gatedefault_project_dirnow asks, with the same assertion.test/test_hooks_composition_contract.pyre-pins the moved names' shape digest for the new keyword onsafe_read_file_bytes_nolinkandvalidate_file_path, andtest/test_agent_refactor_contracts.pyre-pins thekiro_crew.agentre-export ofsafe_read_file_bytes_nolinkto the same signature.validate_file_path,screen_file_path, the descriptor identity check, and the final within-root check. The hardlink-alias check is not reached from the spec read, which refuses a hardlinked spec before it.-n0, and green in a shuffled order (seed 27388).Proof: PROVEN test/test_agent_refactor_contracts.py::test_every_pre_split_name_resolves_with_its_pre_split_shape, test/test_hooks_composition_contract.py::test_the_moved_names_keep_their_base_shapes, test/test_member_start_canonical_gate.py::test_a_member_starts_on_its_own_spec_while_every_resolver_child_misses_its_deadline, test/test_session_pool_refill.py::TestDefaultProjectDir::test_returns_empty_when_sensitive (head c81b4f9)
Manual verification
On macOS 26.7.2 (Apple silicon, Python 3.12.13), 300 serial runs of the exact test id and 30 runs of the whole file at
-n 2did not fail naturally, and no resolver child missed its deadline in any of them. A throwaway pytest plugin that forced one resolver child to miss its deadline at the start of the drained run reproduced the CI failure (source_unreadablefrom_source) on every run on the parent, and named the three checks above as the ones that refused. The committed regression test forces the same condition through the same seam against this code, and passes.Related Issues
Closes #27388
Sibling sweep
Swept: git grep -n -e "is_sensitive_path(" -e "default_project_dir(" -e "_spec_path_shape_refusal(" -- src/kiro_crew
Sibling: src/kiro_crew/session_lifecycle_parts/fleet.py:64 -- not affected -- reaches the gate through default_project_dir, which this diff changes, so off the loop it gets the inline answer
Sibling: src/kiro_crew/dashboard/handlers/members_thread.py:93 -- not affected -- reaches the gate through default_project_dir, which this diff changes, so off the loop it gets the inline answer
Sibling: src/kiro_crew/agent_materialization/fork_refresh.py:817 -- not affected -- reaches the gate through _spec_path_shape_refusal, which this diff changes, so off the loop it gets the inline answer
Sibling: src/kiro_crew/agent_materialization/conductor_agents.py:368 -- not affected -- reaches the gate through _spec_path_shape_refusal, which this diff changes, so off the loop it gets the inline answer
Sibling: src/kiro_crew/hook_runtime/descriptor_identity.py:105 -- not affected -- the default branch for callers that do not pass canonical_gate
Sibling: src/kiro_crew/hook_runtime/safe_reads.py:631 -- not affected -- safe_copy_file_nolink, which the member start never calls
Pattern harvest
Rule candidate: review-prompt
Pattern: a path the caller just canonicalised off the event loop is handed to the bounded
is_sensitive_pathinstead ofis_sensitive_canonical_path, so a slow resolver child refuses a healthy fileChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.