Skip to content

fix(capabilities): a resolver stall cannot refuse a member its own spec - #32224

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/27388-canonical-member-reads
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/27388-canonical-member-reads

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

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 with CapabilityError: source_unreadable (run, shard 2, 1 failed of 38573). Just before it, the log says sensitive-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

  • A retry, a skip or a looser assertion in the flaky test.
  • Changing the descriptor identity check, the sensitive-path list, or what is refused.
  • Changing how the resolver classifies a missed deadline or how long the cooldown lasts.
  • Moving any other reader onto the canonical gate: safe_read_file_bytes_nolink keeps the bounded gate unless a caller passes canonical_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 with asyncio.to_thread) computes three paths itself: the workspace realpath, the spec's Path.resolve(), and the realpath and descriptor name of the spec it reads. It then asked is_sensitive_path about 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 /proc and 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.

Member-start check Before After
_spec_path_shape_refusal (agent_parts/spec_lookup.py) is_sensitive_path is_sensitive_canonical_path
default_project_dir (config/loader_pipeline.py) is_sensitive_path is_sensitive_canonical_path
hooks.safe_read_file_bytes_nolink from agent_capabilities._read_spec is_sensitive_path on the name and the descriptor canonical_gate=True: is_sensitive_canonical_path / canonical_path_refusal

safe_read_file_bytes_nolink takes the same canonical_gate keyword safe_read_file already has. It passes it through validate_file_path / screen_file_path and _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 on main. src/kiro_crew/agent.py imports is_sensitive_canonical_path, because the agent_parts owners run on that module's namespace. The descriptor identity comparison is not touched. _read_spec keeps the same outcomes (no bytes, a parse error, an oversize file or a non-object all raise source_unreadable) and agent_capabilities.py stays at 2,000 lines. default_project_dir and _spec_path_shape_refusal are 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.md and memory-skills-hooks.md name 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_gate defaults to False, 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. On main it 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 .env and diag). With the name check passed, the opened descriptor's own check still refuses .env and admits a plain file beside it.
  • test/test_session_pool_refill.py::TestDefaultProjectDir::test_returns_empty_when_sensitive patches is_sensitive_canonical_path, the gate default_project_dir now asks, with the same assertion. test/test_hooks_composition_contract.py re-pins the moved names' shape digest for the new keyword on safe_read_file_bytes_nolink and validate_file_path, and test/test_agent_refactor_contracts.py re-pins the kiro_crew.agent re-export of safe_read_file_bytes_nolink to the same signature.
  • Reverting any one of the three call sites turns the regression test red, and so does dropping the keyword at any of four places the spec read passes through: 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.
  • Determinism (macOS 26.7.2, Apple silicon, Python 3.12.13): 20 of 20 runs at -n0, and green in a shuffled order (seed 27388).
  • The full gate (lint, types, the related and full backend suites, the flake-pattern ratchet and semgrep) runs in GitHub CI.

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 2 did 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_unreadable from _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_path instead of is_sensitive_canonical_path, so a slow resolver child refuses a healthy file

Checklist

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

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 09:03
@bolichen97 bolichen97 added the ci:macos Run the on-demand macOS suite against this PR head label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/safe_reads.py

  • No reasoning template for 40e66f0 yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 40e66f02e8a4645d1bb5c66db6ed030067467e6c
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 40e66f02e8a4645d1bb5c66db6ed030067467e6c — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 ships

Inventory (6 items) — 6 justified

Intent: a crew member on a busy Mac starts on its own healthy spec instead of being refused "source unreadable" for 30 s. FIX.

  1. A member start no longer refuses its own spec when a resolver child misses its 2 s deadline — justified
  2. The workspace default-dir check (default_project_dir) answers inline off the loop for every off-loop caller (warm pool, member thread, fork refresh) — justified
  3. The spec-shape check (_spec_path_shape_refusal) answers inline off the loop for its other off-loop callers too, such as the conductor installer — justified
  4. New opt-in canonical_gate keyword on safe_read_file_bytes_nolink / validate_file_path / screen_file_path, defaulting to off, with one caller (_read_spec) — justified
  5. Off the loop, a wedged mount now blocks these checks' thread instead of refusing within the bound — justified
  6. _read_spec is restructured with suppress, with the same outcomes, so the file stays at the line cap — rides along

[FIRST-PRINCIPLES-REVIEWED] 40e66f0

Description read

[DESCRIPTION-READ] 14a0fe2b1a455ad0b337358d88c45388db8cf6f113cd8c055a8f332528ede327

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The fix reuses the existing is_sensitive_canonical_path seam from #28393, keeps the same gate list, and only changes the member-start checks that are already off the loop.

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 40e66f0

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

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 40e66f0

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 40e66f02e8a4645d1bb5c66db6ed030067467e6c newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 9 classified, 0 newly refused, 9 still allowed.
  • ubuntu-latest (platform posix): 9 classified, 0 newly refused, 9 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The change sends three member-start path checks through is_sensitive_canonical_path instead of is_sensitive_path. Both use the same gate list. The new one answers inline off the event loop rather than through the resolver pool, and it does not add any pattern to the shell deny composite, so no shell candidate is expected to flip. The guard that actually moved is a file-path gate that the classifier can't adjudicate, so it is named under UNADJUDICATED below.

TIGHTENING: The sensitive-path gate on the member start now uses is_sensitive_canonical_path / canonical_path_refusal, in place of the bounded is_sensitive_path / sensitive_path_refusal. The gate list is the same. The threat it still refuses is reading or using a spec or workspace that resolves to a sensitive target. From the hunk: - if is_sensitive_path(str(resolved)): / + if is_sensitive_canonical_path(str(resolved)): / return "the path resolves to a sensitive target" in agent_parts/spec_lookup.py, plus + if (is_sensitive_canonical_path if canonical_gate else is_sensitive_path)(path): in hook_runtime/safe_reads.screen_file_path.

ADJUDICATED: 13 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: I wrote candidates in posix and windows spellings; none are platform any. The posix rows use ~/.kiro/agents/... and $KIROCREW_HOME/workspaces, call readlink -f and os.path.realpath, and run .venv/bin/python. That covers the realpath and /-separator assumptions _spec_path_shape_refusal and default_project_dir make. The windows rows use %USERPROFILE%\.kiro\agents, $env:USERPROFILE in PowerShell, %KIROCREW_HOME%\workspaces and .venv\Scripts\python.exe. Those probe the drive-letter, \ and %VAR% spellings of the same reads. The diff's own rationale is specific to macOS: no syscall sample, so a deadline miss is charged as a mount stall. macOS is a posix spelling with no shell difference from Linux here. The behaviour that differs on macOS is inside the path gate, which no shell row can reach. I wrote no candidate for UNC workspace roots because the diff makes no assumption about them.

UNADJUDICATED: The guard is the file-path sensitive gate, switched with canonical_gate=True to the inline variant. It sits on three call paths, and the shell classifier cannot see any of them:
(1) session_capabilities.prepare_runtime (under asyncio.to_thread) → agent_capabilities._source → _read_spec → hooks.safe_read_file_bytes_nolink(..., canonical_gate=True). From there it goes to validate_file_path → screen_file_path (realpath check) and on to _opened_file_matches_validated_path(..., canonical_gate=True) and the two sensitive(fd_real) within-root checks.
(2) agent._spec_path_shape_refusal → is_sensitive_canonical_path(Path.resolve()).
(3) config.loader_pipeline.default_project_dir → is_sensitive_canonical_path(os.path.realpath(ws_dir)). Its callers include chat_handlers' slot.project fallback and the session pool cwd.

Inputs I would have submitted to this gate:

  • A plain worker.json spec under ~/.kiro/agents, and the same under %USERPROFILE%\.kiro\agents.
  • A spec under a dotfile-managed home where ~/.kiro is a symlink.
  • A workspace under $KIROCREW_HOME/workspaces/default.
  • A workspace root that is itself a symlinked directory.
  • A spec that is a hardlink admitted by admit_hardlinked into the skills tree, which takes the fd_real = path branch.

Two narrowings I can argue but not confirm:

  • default_project_dir and _spec_path_shape_refusal are shared helpers. Every off-loop caller now gets an unbounded inline answer, so on a wedged mount the thread blocks instead of refusing within the bound. That is an availability tradeoff, not a new refusal, and it is out of this lane's direction.
  • _read_spec now collapses every failure into source_unreadable through suppress(ValueError, FileTooLargeError). That is unchanged from the old error mapping, but it means a gate refusal and a parse failure still report the same cause.

[SCOPE-REVIEWED] 40e66f0

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 09:13
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97
bolichen97 force-pushed the fix/27388-canonical-member-reads branch from 00d01b9 to c81b4f9 Compare November 7, 2026 09:56
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Backend Tests (3.12, 2) and (Windows) (2) fail on test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget. That test fails on main itself (the security package is 34855 lines against a 34845 budget), and this PR changes nothing under src/kiro_crew/security/. The fix is #32183; this PR rebases onto it once it merges.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 7, 2026
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
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Rebased onto main bab2387, which carries the security line-budget fix (#32252, superseding #32183). The patch is unchanged (range-diff identical); CI is re-running.

@bolichen97
bolichen97 force-pushed the fix/27388-canonical-member-reads branch from c81b4f9 to 40e66f0 Compare November 7, 2026 11:31
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red macOS Tests (on demand) shard 2 on 40e66f0 is one test, test/test_resume_retired_agent_names.py::test_a_view_the_real_boot_drain_retired_still_resumes[alias-rewritten], the known flake #29696 (the same node id has gone red on other unrelated heads). This PR does not touch that test or its module. Recorded in #29696 and re-running the failed job once.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved for the on-call. Review lanes pass on 40e66f0, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 123cc51 into main Nov 7, 2026
116 of 118 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/27388-canonical-member-reads branch November 7, 2026 12:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray added a commit that referenced this pull request Nov 8, 2026
…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.
buluoray added a commit that referenced this pull request Nov 8, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:macos Run the on-demand macOS suite against this PR head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky: test_named_crew_keeps_member_identity fails on macOS with CapabilityError: source_unreadable

2 participants