Skip to content

fix(sandbox): name the stale pre-0.6.0 false behind Windows KAS refusals - #29253

Closed
buluoray wants to merge 1 commit into
mainfrom
crew/slack/win-stale-sandbox-false
Closed

buluoray wants to merge 1 commit into
mainfrom
crew/slack/win-stale-sandbox-false

Conversation

@buluoray

@buluoray buluoray commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Windows user whose sessions are all refused with "agent.sandbox_allow_unsandboxed_exec is set to false" is told where that false most likely came from and how to get the Windows default back.

Since 0.11, Windows users who installed before 0.6.0 see every agent spawn refused:

Sandbox backend unavailable and agent.sandbox_allow_unsandboxed_exec is set to false on this host ... Probe detail: not Linux.

Three users reported it on 11-03. None of them remembers setting the key, and the refusal reads as if they did.

Root cause, checked against the code on main:

  • Builds before 0.6.0 had sandbox_allow_unsandboxed_exec: bool = False and to_dict() wrote asdict(agent), so every full-document save stored "sandbox_allow_unsandboxed_exec": false on every host.
  • feat(sandbox): resolve the no-backend exec default per platform #9758 (v0.6.0) made the Windows default true for an undeclared key, but nothing removed a stored false, and _agent_key_declared (src/kiro_crew/config/loader_document.py) counts any stored key as declared.
  • Through 0.10 Windows sessions ran on the Kiro CLI harness, and wrap_argv hands official kiro-cli spawns on Windows to kiro-cli's own sandbox (delegate_to_kiro, src/kiro_crew/sandbox_wrap.py), so the stored value was never consulted.
  • feat(acp): default new installs to KAS #20359 (0.11) defaults to KAS. _kiro_cli_sandbox_owns_relay (src/kiro_crew/acp/harness/kas.py) is macOS-only, so Windows KAS spawns reach the no-backend gate and hit the "declared false" refusal.

Why it matters

Every session on an affected Windows host fails at spawn. The current text tells the operator they set the key, so they have no reason to suspect a leftover value, and kirocrew doctor describes the state as a deliberate posture.

Not a goal

  • Removing or rewriting the stored false (a migration). Whether an old auto-written value may be dropped is a separate owner decision.
  • Any change to what the gate allows or refuses, on any platform.
  • Changing the Kiro CLI hand-off or the KAS relay's sandbox ownership.

What changed (motivation → approach → change)

Symptom: Windows KAS sessions refused by a false nobody chose. Cause: a pre-0.6.0 auto-write that 0.11's KAS default made reachable. Change: wording and a doctor row only.

  • src/kiro_crew/sandbox_unavailable.py: new stale_windows_false_note() (returns the note on win32, "" elsewhere). One sentence shared by the refusal and doctor, so both give the same diagnosis. It names the config files this process actually reads (config_path() / config_local_path(), which follow KIROCREW_HOME), falling back to the default ~/.kiro/crew/ paths if they cannot be resolved. Windows only, because only Windows has a permitting default to fall back to; elsewhere deleting the key would not unblock spawns.
  • src/kiro_crew/sandbox_wrap.py: the declared-false refusal appends the note on Windows, except under a governance floor (the floor refuses these spawns whatever the key says, so "delete the key" would mislead). The verdict, SEL event and exception kind are unchanged.
  • src/kiro_crew/doctor_checks/confinement.py: in the "REFUSED on this host" + declared branch, print a sessions: ❌ row with the note and record an issue only when _stale_false_refuses_kas_sessions() holds: the main or crewmate harness resolves to KAS, effective_sandbox_mode(configured_sandbox_mode()) is not off (wrap_argv's off branch returns before the stored false is read), and there is no governance floor. Any read that fails answers "no", so the row keeps its existing wording rather than claiming an outage it cannot see.
  • src/kiro_crew/sandbox.py: lists the new name in the facade's TYPE_CHECKING block.

Backwards compatibility

Compatible: only message text and one doctor row are added; no key, value, verdict or signature changes.

Removes nothing: the diff only adds text and a diagnostic row; no path, key, record or function is removed or tightened.

Tests

  • test/test_sandbox_platform_default_exec.py: on Windows the declared-false refusal carries the note (pre-0.6.0 origin, KAS, both config file paths); the note names the resolved config paths, not ~/.kiro; a governance floor withholds it; on Linux/macOS and for an undeclared refusal on Windows it does not.
  • test/test_cli_doctor_refactor_sections.py: Windows + declared false + KAS (main, crewmate, or both) prints the existing rows unchanged, then the sessions: row and note, and records the issue; Windows + Kiro CLI on both roles, macOS + KAS, sandbox=off with no floor, a governance floor, and an unreadable config print exactly the existing rows and record nothing. The existing posture test pins the KAS check off.
  • test/test_sandbox_refactor_facade.py: the new name is listed as owned by sandbox_unavailable.

Proof: PROVEN test/test_cli_doctor_refactor_sections.py::test_a_declared_false_on_windows_with_kas_is_flagged_as_stale[kas-kas], test/test_cli_doctor_refactor_sections.py::test_the_stale_false_row_stays_out_of_other_cases[host2], test/test_sandbox_platform_default_exec.py::TestWrapArgvOnABackendlessHost::test_declared_false_on_windows_names_the_stale_pre_060_write, test/test_sandbox_platform_default_exec.py::TestWrapArgvOnABackendlessHost::test_the_windows_note_names_the_files_this_process_reads, test/test_sandbox_platform_default_exec.py::TestWrapArgvOnABackendlessHost::test_a_governance_floor_withholds_the_windows_note (head 6616dea)

scripts/local-gate.py related set on head 6616dea: 35092 passed, 187 failed, all environment-bound on the run host (nested sandbox, unshare, loopback, subprocess spawn). The doctor exit-code failures in test_cli.py::TestDoctor and test_cli_stt_memory_doctor.py fail identically with the new doctor branch forced off, so they do not come from this change. The touched test files plus test_facade_mirror_guards.py: 741 passed.

Manual verification

N/A: the change is message text and a doctor row, covered by unit tests with the platform and config pinned. Not run on a real Windows host.

Related Issues

N/A: Issue Gate is paused; no tracking issue.

Sibling sweep

Swept: git grep -n "unsandboxed_exec_declared()" -- src/
Sibling: src/kiro_crew/cli_setup.py:1281 -- not affected -- setup returns silently once the key is declared and prints no refusal text
Sibling: src/kiro_crew/config/loader_config.py:833 -- not affected -- save() decides whether to write the key and shows no message

Pattern harvest

Not generalizable: a one-off leftover value from an old default-writing save; the fix only explains it where it surfaces.

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
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 3, 2026 16:54
@buluoray
buluoray enabled auto-merge (squash) November 3, 2026 16:54
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/sandbox.py

  • src/kiro_crew/sandbox_unavailable.py

  • src/kiro_crew/sandbox_wrap.py

  • No reasoning template for 6616dea 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: 6616deab540825a11211b36064ba2e511369a1bc
- 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 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: this only adds wording and a diagnostic row. Verdicts, keys and stored data are unchanged, so a revert undoes it cleanly.

Notes

  • The refusal text appends "Since 0.11, sessions run on KAS" on every Windows declared-false refusal, even for spawns that aren't KAS. Doctor checks the harness first; the refusal doesn't, so it can name the wrong cause for some spawns.
  • The stored false is not a deliberate posture, so the migration listed under "Not a goal" is the real fix. Open a tracking issue so this note doesn't become the permanent answer.

[DESIGN-REVIEWED] 6616dea

Description read

[DESCRIPTION-READ] efdfc96a1d0730d8be37cebd78a9f1d36bb81ed1a8faf4be000852cdbbb88f3c

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 3, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 6616deab540825a11211b36064ba2e511369a1bc 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 3, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🔴 BLOCK

Premise-level review of 6616deab540825a11211b36064ba2e511369a1bc — 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: BLOCK

The new doctor sessions: ❌ row and its issue repeat what config/superseded_defaults.py already does: report a stored value that a pre-change full save wrote. They also count as an issue the state that registry deliberately does not.

Notes

  • Item 1 — symptom-level: the real cause is the stored false itself. "Removing or rewriting the stored false" is listed under Not a goal, and the description names this level, so it is not a blocker.

What this change ships

Inventory (5 items) — 3 justified

Intent: give Windows operators the likely origin of a false that refuses every session, and how to get the default back. FIX (wording and diagnostics).

  1. On Windows, the declared-false spawn refusal now names the pre-0.6.0 auto-write and the config paths — justified
  2. That note is left out under a governance floor — justified
  3. Doctor prints a new sessions: ❌ row with the note on Windows with KAS — duplicate of config/superseded_defaults.py
  4. Doctor records a new issue for that stored value — duplicate of config/superseded_defaults.py
  5. New stale_windows_false_note name on the sandbox facade (2 callers) — justified

Blockers

Doctor stale-value row repeats the superseded-default registry — duplicate of src/kiro_crew/config/superseded_defaults.py
Trigger: SUPERSEDED_DEFAULTS holds 23 dotted_key= rows. SupersededDefault already has note and applies fields for wording and platform narrowing, and its render_doctor_section says "Drift is informational and does NOT become an issue… cannot tell a stale materialized default from a deliberate opt-out". The diff adds issues.append("sandbox exec refused (stale sandbox_allow_unsandboxed_exec=false)").
Outcome: an operator who chose false on Windows on purpose gets a doctor issue on every run. --keep cannot clear it, and two code paths now describe one kind of drift.
Subtraction: delete _stale_false_refuses_kas_sessions, _selected_harness_is_kas and the row; replace them with one report-only SUPERSEDED_DEFAULTS entry for agent.sandbox_allow_unsandboxed_exec, using applies for the Windows/KAS check and note for stale_windows_false_note()'s wording.
Clears when: the doctor row and the issue are removed in favour of a registry entry, or a human overrides.

[FIRST-PRINCIPLES-REVIEWED] 6616dea

Description read

[DESCRIPTION-READ] ead9cca6b6b320446a210a0c55f07b616d70209a1b070b5ddb6d4497155c50bc

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 3, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6616deab540825a11211b36064ba2e511369a1bc — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6616dea

Verdict parsed from the review's SHA-scoped output markers for commit 6616deab540825a11211b36064ba2e511369a1bc.

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

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6616deab540825a11211b36064ba2e511369a1bc and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6616dea

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

@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 3, 2026
A Windows host that ran a build older than 0.6.0 holds an auto-saved agent.sandbox_allow_unsandboxed_exec=false. It stayed harmless while Windows sessions were handed to kiro-cli's own sandbox; since 0.11 made KAS the default, KAS spawns reach the no-backend gate and every session is refused. The refusal and kirocrew doctor now say where the value most likely came from and that deleting the key restores the Windows default. Wording and diagnostics only: the gate and the stored value are unchanged.
@buluoray
buluoray force-pushed the crew/slack/win-stale-sandbox-false branch from 9574771 to 6616dea Compare November 3, 2026 18:09
@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 3, 2026
@buluoray

buluoray commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Disposition for First Principles BLOCK on 6616dea (doctor row vs SUPERSEDED_DEFAULTS): rebutted, not changed.

  • The registry reports drift, and its own render_doctor_section docstring says why drift is never an issue: a stale default and a deliberate opt-out look the same on disk, and both still work. This row is different. It is emitted only when the stored false is what refuses every KAS spawn on this host (_stale_false_refuses_kas_sessions: Windows, KAS harness, effective mode not off, no governance floor). In that state no session can start, whether or not the operator chose the value. Doctor exiting 0 there would be wrong, which is why it records an issue. An operator who set false on purpose on Windows + KAS has disabled every session, and the issue says so.
  • --keep is not the right way to clear it. Deleting the key or setting it to true clears it, and the row names both files.
  • A registry entry would need a platform-dependent new_default and an applies predicate that reads harness and sandbox mode, and it would add a load-path warning. That surface goes beyond this PR's frozen scope (wording plus one doctor row, no behaviour change).
  • The migration that would actually remove the stale value is listed under "Not a goal" and needs an owner decision. A registry entry with auto_adopt is a reasonable way to do it in that follow-up.

@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 3, 2026
@buluoray

buluoray commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the underlying Windows refusal is fixed by #29261 (on main and in v0.12.0-rc.7), so this message-only change is no longer needed.

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.

1 participant