Skip to content

fix(sandbox): cover 3 sealed dir leaves in delegated-overlap wording (#12182) - #12193

Merged
iamwhatever merged 1 commit into
mainfrom
fix/sandbox-delegated-overlap-wording-12182
Sep 20, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/sandbox-delegated-overlap-wording-12182

Conversation

@bolichen97

@bolichen97 bolichen97 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes the import-time AssertionError in src/kiro_crew/sandbox.py that broke every backend test at collection on main (issue #12182).

The module-level assert requires _DELEGATED_OVERLAP_LEAF_REASONS to cover the full union of sealed leaves (_CREW_NOFOLLOW_READONLY_FILE_LEAVES | _CREW_NOFOLLOW_READONLY_DIR_LEAVES), but the dict only held wording for cloud.json and playwright-cli. The three sealed directory leaves subagents, member-memory-bindings, and decisions had no delegated-overlap entry, so the assert fired at import time. This was unsatisfiable in the commit that introduced it (4ed7335, #11556), whose CI run was cancelled so the assert was never exercised pre-merge.

Change

Added three (reason, consequence) entries to _DELEGATED_OVERLAP_LEAF_REASONS, matching the dict shape dict[str, tuple[str, str]] and the existing entries. Wording is lifted verbatim from PR #12106 (same lane as #11556) so that PR does not gain a conflict in this hunk:

  • subagents -> "sealed run records" / "the agent could rewrite the app owner a cold continuation restores its authorization from"
  • member-memory-bindings -> "sealed run records" / "the agent could rewrite the app owner a retained V1 run restores its authorization from"
  • decisions -> "sealed decision log" / "the agent could append a feedback row the owner's summary counts as a verdict nobody gave"

For decisions, the source comment gave only the consequence; the reason ("sealed decision log") was chosen to match the surrounding sealing comments and the 2-tuple shape of the other entries.

Testing

  • python -c "import kiro_crew.sandbox" succeeds (no AssertionError)
  • pytest test/test_session_control.py --collect-only collects 207 tests with no import error
  • pytest test/test_cloud_config.py test/test_sandbox_crew_home_carveout_spellings.py -> 149 passed, including test_every_strict_leaf_of_either_shape_is_covered_by_the_delegated_guard, which asserts the mapping equals the union of both leaf lists

Closes #12182

Pattern harvest

Rule candidate: merge gate

Pattern: a required check whose newest run ended cancelled (superseded push, or cancel-in-progress) is not evidence that the check passed, so a merge taken on it can land a failure no shard ever executed. That is how this defect reached main: #11556 added a module-level assert pairing _DELEGATED_OVERLAP_LEAF_REASONS against two constant leaf lists while #11993 was adding a name to one of them, the assert was unsatisfiable on the merge commit, and every Backend Tests shard then exited 4 at conftest import. A gate that refuses the merge unless the newest run of each required check concluded success closes the class. The two-lists drift itself needs no new rule -- the assert plus test_every_strict_leaf_of_either_shape_is_covered_by_the_delegated_guard already catch it the moment any shard runs.

[operator: iamwhatever] section added to clear the PR Hygiene gate; no code or wording in the diff was changed.

_DELEGATED_OVERLAP_LEAF_REASONS only carried wording for cloud.json and
playwright-cli, so the module-level assert over the full sealed-leaf union
failed at import time, breaking every backend test at collection. Add the
(reason, consequence) entries for subagents, member-memory-bindings, and
decisions, lifting the canonical wording from PR #12106 to avoid a future
merge conflict in this hunk.

Fixes #12182
@bolichen97
bolichen97 requested review from a team and CrysisDeu September 20, 2026 05:04
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 40f5c8fb7d2289757bed99fa8e90535c5dab16ad and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 40f5c8f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 40f5c8fb7d2289757bed99fa8e90535c5dab16ad: <one-sentence reason>

@iamwhatever

Copy link
Copy Markdown
Contributor

Independent confirmation that this PR is the fix origin/main currently needs, with the evidence, so nobody duplicates it.

main is red at import right now. 4ed7335d88 (feat(cloud): a configuration home for the Fargate lane, #11556) added subagents, member-memory-bindings and decisions to _CREW_NOFOLLOW_READONLY_DIR_LEAVES but not to _DELEGATED_OVERLAP_LEAF_REASONS, so the module-level assert at src/kiro_crew/sandbox.py:1053 fails at import.

Verified on a detached worktree at origin/main = 1fbffb1c7a:

$ PYTHONPATH=src python -c 'import kiro_crew.sandbox'
  File ".../src/kiro_crew/sandbox.py", line 1053, in <module>
    assert set(_DELEGATED_OVERLAP_LEAF_REASONS) == set(_CREW_NOFOLLOW_READONLY_FILE_LEAVES) | set(
AssertionError

Same command on this PR's head 40f5c8fb7d: OK.

Blast radius: every backend job dies loading test/conftest.py (conftest -> kiro_crew.safety_override -> config.loader -> mcp_gateway.rewriter -> mcp_gateway.manager -> kiro_crew.sandbox). Seen on run 35489784213, PR #12156, Backend Tests (3.12, 3).

Why nobody saw it land: main's own runs at 4ed7335d88 / 363c701ac1 / 5883fb014c / 554728404f / 1f46089cb8 were cancelled by the workflow concurrency group, so the red never surfaced on main.

Note for whoever rebases: #12106 (feat(cloud): reach a Fargate crew's turn API from a laptop over SSM) also carries entries for these leaves in its own copy of _DELEGATED_OVERLAP_LEAF_REASONS, so it will conflict here and should rebase onto this once it merges.

This PR is minimal and correct in shape: one file, one commit, three entries added, the assert left intact. PR Hygiene is currently failing on it (the fix PR template wants a pattern-harvest section) — worth clearing quickly, since this unblocks #12156 and everyone else on main.

Pattern class, if useful for the harvest section: a module-level assert over two hand-maintained sets that CI never exercised, because main's own runs were concurrency-cancelled.

@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 Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 40f5c8fb7d2289757bed99fa8e90535c5dab16ad — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 40f5c8f

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 40f5c8fb7d2289757bed99fa8e90535c5dab16ad — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Only the decisions wording is authored here rather than lifted from #12106 — confirm it matches that PR so the hunk stays conflict-free.

What this change ships

Inventory (2 items) — 2 justified

Intent: FIX — restore main to an importable state by completing the delegated-overlap wording map the module-level assert requires (issue #12182).

  1. The gateway and every backend test import again; the sandbox module no longer dies with an AssertionError at collection — justified
  2. Delegated spawns (macOS internal sandbox, Windows) now refuse a workspace overlapping subagents, member-memory-bindings, or decisions, each with a named seal and consequence — justified

The fix is derived, not inherited: the assert at src/kiro_crew/sandbox.py:1068 fails at import on base (dict keys ⊂ leaf union, readable from the diff's unchanged context), the linked issue #12182 names the defect, and test_every_strict_leaf_of_either_shape_is_covered_by_the_delegated_guard pins the completed mapping. No new surface: no config key, flag, default, or export — the refusal targets derive from the same dict the assert governs, per the invariant stated in the module's own comment at lines 1035–1041.

[FIRST-PRINCIPLES-REVIEWED] 40f5c8f

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 40f5c8f

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 40f5c8fb7d2289757bed99fa8e90535c5dab16ad: <one-sentence reason>

@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 Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sandbox: import-time assert fails on main — 3 sealed dir leaves missing delegated-overlap wording

3 participants