Repository navigation
Conversation
126875a to
8496482
Compare
8496482 to
b6e26a8
Compare
b6e26a8 to
9a883ac
Compare
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The Windows per-feature docs table ships its three rows twice, and the two copies contradict each other about the default unsandboxed posture. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: give Windows operators real OS-level isolation for app scripts, command crons, and hooks by routing them through an opt-in WSL2 distro — an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] a76967c |
UX Review (Fable 5, fork) — 🔴 BLOCKUX-level review of UX-Verdict: BLOCK cannot evaluate: missing screenshots of the new Settings controls — the Sandbox picker's 'wsl2' option and the WSL2 Distribution select. Evidence gaps
Watch
[UX-REVIEWED] a76967c |
GPT 5.6 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/sandbox.py:6719 -- Guest launcher writes namespace records through an untranslated Windows path FINDING -- src/kiro_crew/dashboard/handlers/agents.py:1383 -- function-local [BLOCK-MERGE] a76967c Adjudication (Opus 4.8) — is blocking on each finding proportionate?I've confirmed the mechanism. Line Fenced finding assessment: F1 — Harm rung: the fence classified this residual/crash-data-loss-corruption. Conditions: [ADJUDICATION] a76967c total=0 uphold=0 downgrade=0 |
Design Review (Fable 5, fork) — 🔴 BLOCK (blocking)Design-level review of Design-Verdict: BLOCK Cannot evaluate: missing screenshot of the new Settings sandbox/WSL2-distribution picker — no rendered evidence of this revision. BlockersRequired rendered evidence missing for a reshaped Settings control set. Watch
[DESIGN-REVIEWED] a76967c |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
0d949db to
d066988
Compare
d066988 to
f8a2ab7
Compare
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
|
@bolichen97 — both required changes landed in 1. The guest launcher now pins wrapped += ["--", "python3", *_LAUNCHER_INTERPRETER_FLAGS, staged_path, *argv]The comment above it records the reason in your terms: without 2. The Script-cron-jobs row now states the opposite of what it claimed —
That matches One further commit, unrelated to your review ( Resolved the way Verified locally before pushing: black gate passes, Worth flagging as a repo-level issue independent of this PR: any fork PR that black-formats a baselined file hits the same deadlock, and the only escapes are reverting the formatting or a maintainer override label. |
1a19e9c to
18b35a6
Compare
|
@GoZippy Heads-up on an overlap with the newer #7669 (@rnoack1), which rewrites the same function this PR edits. The shared file is Concrete suggestion: land #7669 first, since it rewrites the function wholesale and pins the resulting shape with tests, then rebase this PR's three hunks onto the new body and guard the wsl2 reap the same way. The reverse order is harder, because #7669's rewrite would then have to carry the wsl2 branch through itself. Neither PR references the other today, and this one is already 99 commits behind main with Posted from the 2026-09-08 open-PR relationship audit (read-only, one auditor per PR); reply here if any of this is wrong. |
|
Rebased onto main Conflicts resolved:
Gates run locally on changed files: black, isort, flake8, Please review the resolutions. A maintainer push makes the maintainer the last pusher, so under the repo's last-push rule a second approver is needed. Reply here if anything looks wrong. |
|
Kiro Crew [operator: chenmingwei23#de330d0c]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:
When you've addressed these, the pipeline will re-assess on its next cycle. |
Windows has no seatbelt and no user namespaces, so `sandbox.wrap_argv` delegated unconditionally and the child ran unconfined. The official Kiro backend hides that because kiro-cli brings its own sandbox, but any spawn that does not -- a script cron, a hook, an app lifecycle script -- reached the host with nothing between it and the operator's files. This adds a WSL2 backend: the same namespace construction the Linux arm builds, run inside a distro, with the Windows-side ceilings materialized and masked before the guest starts. Detection, distro selection and the failure reason are surfaced in config and on the Agent settings tab, so an operator can see which distro was chosen and why a spawn refused. Docker Desktop's utility instances are filtered out of the distro choices: they exist to run the daemon, not arbitrary workloads, and offering them produces a sandbox that fails in a way nobody can read. The state column `wsl.exe --list` prints is locale-dependent, so nothing here branches on it -- only dict membership decides whether a requested distro exists. The guest staging directory is sealed in every launcher path, and the Windows-side ceilings are materialized before the spawn rather than left to an existence check that a default install fails: an absent computer_use.json got no seal and stayed writable through DrvFs, which handed a sandboxed workload the ability to turn on desktop control for itself. Removes the settings screenshot that was committed for the pull request description; it does not belong in the tree.
Security Scope Review (fork) — 🟡 CONCERNSWhich legitimate operations does the reviewer's own judgement; no confirmed regression Scope-Verdict: CONCERNS TIGHTENING: The sandbox spawn-wrap layer, not the shell deny composite. ADJUDICATED: 14 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: windows — 6 rows covering the spellings this diff newly assumes: UNADJUDICATED: The tightening lives almost entirely in guards the shell-command classifier cannot reach — no shell row flows through
The honest verdict is CONCERNS: zero confirmed shell-level regressions, with the substantive tightening living in guards no shell row can classify. [SCOPE-REVIEWED] a76967cSecurity scope review -- adjudicated candidates
No candidate flipped from allowed to refused. |
Open-PR triage (2026-10-05): DISTINCT, needs REBASE, plus a merge discussion with #7414 and #7669I checked head Coverage on main: none.
So this PR is not superseded and not a duplicate, and it should not be closed. Rebase needed. The branch is 2672 commits behind main and
Still open at this head (it was raised by the GPT review but isn't fixed): Breaking change: none. Merge discussion (OVERLAPPING, the PRs complement each other):
Recommendation: REBASE onto current main (re-port onto the split sandbox modules), fix the namespace-record path, then re-request review. |
|
Thank you for this WSL2 sandbox backend; Windows isolation is a real gap. We are closing this PR because the branch is about 7,400 commits behind main and the open security reviews (the guest launcher drops the -I -S confinement flags, the script-cron isolation claim, and two GPT security findings) would need a fresh security review after a rebase. The need is tracked in #21928. A new PR from current main that keeps the native launcher's flags is very welcome. The branch is left untouched, so you can reopen this PR at any time, or open a fresh one on current main, if you want to pick it back up. |
Problem / Motivation
Windows has no OS-level sandbox backend of its own, so
sandbox.wrap_argv()fail-closes for every subprocess spawn that is not an explicitly-identified
kiro-clispawn (PR #5620's delegation). Concretely: app install/enablescripts, script hooks, and command cron jobs either refuse outright with
SandboxUnavailableError, or (command cron jobs specifically) are refusedbefore
wrap_argvis even reached, because Git-for-Windows'ssh.exeisbash and performs brace expansion that would hide a credential path from the
cron command vet gate. The only documented remedy today is
agent.sandbox_allow_unsandboxed_exec=true, which removes isolationentirely for the affected paths.
Meanwhile WSL2 — already installed on a meaningful share of Windows dev
machines — genuinely exposes working Linux user namespaces
(
sandbox.is_wsl()'s own docstring already says so), but nothing in thecodebase reaches into it.
Why it matters
This is a first-run-adjacent outage for a common Windows workflow: installing
a Kiro Crew app (the built-in App Store) runs the app's
onEnablescriptthrough exactly this fail-closed path, and fails with no better remedy than
"turn off isolation everywhere." Command cron jobs are simply unsupported on
Windows today. Both are one WSL2 distro away from working with real
isolation instead of none.
What changed (motivation → approach → change)
Adds
agent.sandbox: "wsl2"(opt-in, never auto-selected — the samepositive-identity posture PR #5620 established for Kiro CLI delegation) as a
third selectable backend on Windows. It reuses the existing Linux
namespace launcher script unmodified — same
unshare(CLONE_NEWUSER)+bind-mount logic — executed inside a WSL2 distribution's real kernel via
wsl.exe, rather than reimplementing sandbox logic for a fourth platform.Scope is deliberately narrow: only the three call sites that already build
POSIX
sh/bash -cargv benefit — app lifecycle scripts(
apps/lifecycle_scripts.py), command cron jobs (cron_script.py,previously unsupported on Windows entirely — WSL2's
/bin/shis a realPOSIX shell, unlike Git-for-Windows's bash-flavored
sh.exe, so this is agenuine capability unlock, not just a re-route), and script hooks
(
hooks.py, previously locked tocmd.exesyntax on Windows — withwsl2selected they use the same
/bin/sh -cform macOS/Linux already do, so aPOSIX-shell hook needs no rewrite). Single portable-binary invocations
(
git, the AWS CLI,tectonic, Piper) are unaffected either way: no shellis involved, so routing them through a Linux VM would buy no isolation and
would need Windows↔WSL path translation for every argument.
Complements, does not duplicate, the open #6808 (read-only WSL2 discovery in
the Electron desktop shell) — that PR's own scope note explicitly defers "a
settings UI plus gateway spawn routing into the chosen distro" as follow-up
work once real requirements are known; this is that follow-up, in the Python
gateway rather than the Electron shell, since the gateway is what actually
calls
wrap_argv.Mechanics, and two bugs found and fixed while proving them live:
WSL_UTF8=1is forced on everywsl.exeinvocation. Verified live:without it, WSL emits UTF-16LE and a plain
text=Truesubprocess captureeither raises
UnicodeEncodeErroror silently mis-decodes — corruptingevery string comparison downstream (distro listing, stderr
classification).
wsl.execall, writing to a Python-generatedrandom name (
secrets.token_hex(16)) underset -C(noclobber) ratherthan a name captured from the guest's own
mktemp. An earlier two-callform (create, then a separate write+chmod) both hit a real WSL2 quirk —
a command substitution combined with piped stdin in one
wsl.exe -- sh -cinvocation reproducibly drops the captured value, verified live — and,
caught in review, left an empty, discoverable file exposed to a same-UID
sibling for the whole gap between the two round trips. Naming the file in
Python needs no substitution at all, closing both at once;
set -Calsorefuses the write outright if the target already exists, rather than
silently overwriting a file a sibling pre-created.
Windows-side builder process (which has no
os.getuid()at all)._build_launcher_scriptgained anidentityoverride for this — everyreal Linux caller leaves it
Noneand sees no behavior change.os.path.join→posixpath.joinfor the launcher script'shome-relative path construction: identical behavior on real Linux
(
os.pathisposixpaththere), but load-bearing when the builder isWindows Python, which would otherwise embed a backslash into a script
meant to run on a Linux filesystem.
wsl.exe --cd, notthe ordinary
cwd=a caller passes toPopen— that setswsl.exe's own(Windows-side) launch directory, not the guest shell's. The Windows→WSL
path translation is verified against the guest's live mount table before
being trusted (
wslpathitself proved unreliable for this — verifiedlive, it silently drops backslashes on some multi-segment Windows paths
even invoked through a plain argv list, no shell involved), and refuses
to translate rather than guess if the guest doesn't mount drives at the
default
/mnt/<letter>location._probe_wsl2mirrors_probe_unshare's exact discipline: on-loop calls defer to a backgroundthread and return a transient (never-cached) failure immediately; off-loop
calls retry once. This matters more here than for the Linux probe — a cold
WSL2 round trip measured 7.5s live, far slower than the Linux
unshare()syscall.looser backend than configured (mirrors
_allow_unsandboxed_exec's owncontract), and a probe or staging failure raises the same
SandboxUnavailableErrorshape the existing no-backend path uses, with aremedy naming the specific fix (
wsl --install,wsl --install -d <name>, or the shared AppArmor-class guidance when the guest's own kernelrefuses
unshare).Dashboard:
agent.sandbox's Settings dropdown and thePATCH /api/config/kirocrewallowlist now read live selectable values ("wsl2"offered only when plausible — Windows, with
wsl.exepresent) instead of astatic list, following the exact pattern already established for
agent.acp_backend— the same file even names the reason: "threeindependent derivations is how the old literal list drifted."
Distribution picker. A host can have several WSL2 distributions — this
was raised in review on a real machine with two Ubuntu installs plus Docker
Desktop's own WSL2 backend.
agent.sandbox_wsl_distronow has its own livepicker (same schema pattern as above), populated from
wsl.exe -l -v(10s-cached to avoid repeat shellouts on rapid Settings loads) and
deliberately excluding Docker Desktop's internal utility instances
(
docker-desktop,docker-desktop-data) from what is offered — they areminimal VMs purpose-built for the container runtime, not general-purpose,
and not guaranteed to ship
unshareor the other tools the launcher needs.This is a picker default, not a hard restriction: the field stays a plain
pattern-matched string at the write layer, so an operator who deliberately
wants one can still set it by hand. Verified live against a real host
carrying exactly this shape (one general-purpose distro, one Docker Desktop
instance): the raw listing shows both, the picker offers only the real one.
On Windows Sandbox as an alternative backend (raised in review,
referencing Microsoft's own docs): investigated and not pursued here for
two disqualifying reasons rather than a scope call — "Windows Sandbox
currently doesn't allow multiple instances to run simultaneously" (a
machine-wide, one-at-a-time limitation that rules out sandboxing concurrent
spawns), and there is no documented headless launch, synchronous completion
signal, or stdout/exit-code capture —
LogonCommandis built for "a humanopens a window, does something, closes it," not a service dispatching a job
and reading back a result, which
wrap_argv's contract requires. It is alsoPro/Enterprise/Education-only (excludes Home) and runs native Windows
executables only, with no Linux/POSIX support. This is a real gap in the
tool's automation surface, not an implementation-effort judgment call, and a
different feature (an interactive "open this untrusted thing in a disposable
desktop" tool) would be a better fit for it than this one.
Security findings from review, and the fixes
Three independent AI reviewers on the original revision of this PR converged
on the same finding, plus two more from a fourth pass. All four are fixed in
the current revision, not worked around.
The credential/keystone leak (the serious one). The wsl2 backend's
credential-hiding only masked the WSL2 guest's own home directory — a
mostly-empty account. WSL2's default DrvFs mount makes the operator's REAL
Windows filesystem reachable inside the guest at
/mnt/<drive>/...,including
C:\Users\<user>\.aws/.sshand the governance keystone underconfig_dir()— none of it was masked, so a sandboxed app-lifecycle script,command cron, or hook could read or overwrite the operator's actual
credentials and the file
security.py's_SENSITIVE_HOME_DIRSexistsspecifically so the agent can never read or write. My own manual
verification (previous revision) had only planted markers in the guest's
own home, missing exactly this. Fixed:
wsl_namespace_argv()now computesthe same sensitive-directory set the native backend would mask, resolves it
against the REAL Windows home, translates each entry through DrvFs, and
passes it in via the existing
extra_hidden_dirsmechanism; DrvFsverification now runs unconditionally and the function fails closed if it
cannot confirm the mount. Re-verified live with a synthetic Windows home
(never my real one) carrying marker credential files — see Manual
verification below for the actual transcript.
Launcher-staging TOCTOU. A same-UID sibling (a concurrently-sandboxed
cron job or hook — exactly the untrusted workload this backend confines)
could race the two-call staging sequence, replacing the file's content
before it ever executed. Fixed by collapsing staging to one round trip with
a
set -C-protected write to an unpredictable name (see the mechanicsbullet above).
A genuinely blocking call on the dashboard's event loop.
wsl2_distro_choices()shelled out synchronously (subprocess.run, up to30s) directly from
GET /api/config/schema's handler — every Settings pageload could stall chat, cron, and the liveness heartbeat for every connected
client. This is exactly the discipline the rest of this PR was careful
about (
_probe_wsl2's own never-block-on-loop handling) but missed at thisone call site. Fixed: every live-enum supplier in that handler now
dispatches through the existing
subprocess_executor()pool.WSLENV. WSL forwards a Windows env var into the guest shell only when
WSLENVnames it — setting a var on the Windows-sideenv=a caller passesto
wsl.exedoes not make it visible inside the guest. So$KIROCREW_HOOK_EVENT/$KIROCREW_HOOK_CONTEXTand lifecycle scripts'$NONINTERACTIVE/extra_envall read empty underwsl2despite the docs'existing claim they work. Fixed with a small
wsl2_env_passthrough()helper both call sites use for exactly the metadata keys they inject — never
the platform-baseline ones (
PATH,HOME, ...), which the guest mustsupply from its own values, not the Windows host's.
A second look at review turned up two more, this time in
cron_script.py.cron_script.pyhas TWOwrap_argvcall sites, and they are notinterchangeable once
wsl2exists:/bin/shby name instead ofprobing it, unlike every other platform's candidate. The existing
_shell_is_posix_strictprobe (already sandbox-routed — it callswrap_argvon the candidate itself) would have caught an unusual distrowhose
/bin/shis secretly bash, transparently, with zero new WSL2-specificprobe code — but the resolver never called it for this branch, just
returned
/bin/shdirectly. Fixed by calling it, with a distro-qualifiedcache key (
wsl2:<distro>:/bin/sh):/bin/shnames a different binarydepending on which distro is selected, and the un-qualified cache would
have let a verdict from one distro vouch for a different one after
agent.sandbox_wsl_distrochanges.run_script_sandboxedwould have silently broken the momentwsl2wasselected. It builds a native-Windows argv (
[sys.executable, launcher_path]) and passed it throughwrap_argvwith zero wsl2awareness — unlike the command-cron path above. Once an operator selected
agent.sandbox: "wsl2", this currently-working Windows feature (scriptcrons) would have routed through the guest launcher, which appends argv
verbatim after itself expecting a POSIX command; a Windows path is neither
a valid guest path nor runnable there. This is a real functional
regression, not just a security gap. Fixed by giving
wrap_argva newposix_shell_argvparameter (defaultTrue— unchanged for the threecall sites that genuinely build POSIX argv); this call site passes
False, sowrap_argvreports wsl2 unavailable for it and falls throughto the exact fail-closed/
sandbox_allow_unsandboxed_exechandling Windowsalready had for script crons before this backend existed.
Both verified live: the shell probe against the real distro's actual
/bin/sh(dash, correctly accepted), and the script-cron guard by spying onwsl_namespace_argv— withwsl2selected andposix_shell_argv=Falseitis never called, and the call fails closed with the identical message
Windows gave for this case before
wsl2existed.A fifth thing surfaced by this review that is deliberately NOT fixed
here. Investigating the credential-masking finding above meant diffing
_build_launcher_script's own sensitive-dir list — shared by every backend,including this one — against
security.sensitive_home_dirs()'s full,authoritative set. The gap is large: most of the
.kiro/crew/*governancetree (
security_policy.json,admission_policy.json,profiles/, andmore) is not masked at its default location, on any platform — I proved
this live by planting a keystone marker in the WSL2 guest's own home (using
the identical
_build_launcher_scriptmechanism native Linux uses, noWindows/DrvFs involvement at all) and reading it straight through the
sandbox. This backend has exact parity with what native Linux/macOS already
does today, which is what this PR set out to deliver — but "parity with
native" is not the same claim as "the keystone is masked," and reconciling
two independently-maintained lists across a launcher every backend shares
is a bigger, riskier change than a platform port should carry. Filed
separately as #7332 rather than folded into this PR; this backend inherits
whatever that resolves to automatically once landed.
The biggest finding, from a first-principles review that counted real call
sites.
wrap_argv/sandboxed_spawn_argvare shared chokepoints withdozens of callers across the codebase, most of which build native-Windows
executable invocations (an MCP server spawn, an
npm install, a terminalcommand, a
gitcall) rather than POSIX shell argv. My initial revisiondefaulted the new
posix_shell_argvparameter toTrue— opt-out: onlycallers known NOT to be POSIX-shaped had to say so. Counting actual call
sites, that polarity meant roughly nine unexamined production spawns —
in
cron_script.py(an MCP server spawn),mcp_gateway/resolve_once.py,five
dashboard/handlers/*.pymodules, andgit_coord.py— would havesilently started routing through the wsl2 guest launcher the moment an
operator selected it, each appending a Windows-shaped argv after a Linux
launcher expecting a POSIX command. This directly contradicted my own "scope
is deliberately narrow" claim earlier in this description, which the
reviewer caught as a real inconsistency between what I said and what the
code did.
Fixed by inverting the default to
False(opt-in): only the threegenuinely-POSIX call sites (
apps/lifecycle_scripts.py,cron_script.py'srun_command_sandboxed,hooks.py) passTrueexplicitly. Every othercaller — all nine named above, and any future one — now keeps its exact
pre-wsl2 behavior with zero code change of its own, which is what the scope
description always claimed and what the default now actually guarantees
rather than merely asserts. Locked with a new test that asserts the default
on the real function signatures (
wrap_argv,wrap_argv_async,sandboxed_spawn_argv,sandboxed_spawn_argv_async), not just the wsl2dispatch branch, so a future edit cannot silently flip it back. This also
surfaced two pre-existing tests (
test_cron_cancel.py,test_mcp_cron_security.py) whosewrap_argvmocks had a signature toonarrow for the new keyword argument — fixed alongside.
Tests
test/test_sandbox_wsl2.py(42 tests): config-reading fail-closedbehavior,
detect_backend's cache policy (positive/permanent/transient,mirroring the existing Linux probe's own pinned tests), the
never-block-on-loop discipline, the pure path-translation function, the
wrap_argvdispatch arm (extra_hidden_dirs rejection, failure→SandboxUnavailableErrorwrapping, no-cleanup-path honesty), the_no_backend_guidanceremedy selection, and the distro-picker's filteringand caching. Added in this revision, driving
wsl_namespace_argv()directly rather than through the
wrap_argv-level mock the tests aboveuse (that mock is exactly what would hide a regression in this function):
extra_hidden_dirsreaching_build_launcher_scriptwith theDrvFs-translated real
.aws/.sshpaths (this test caught a real gapduring development —
.sshisn't in the base sensitive-dir list, it ismasked by a separate
HIDE_SSHmechanism scoped to the guest home only,which needed its own explicit translation), the fail-closed path when
DrvFs can't be verified, the single-round-trip staging with its
noclobber guard, staged-path uniqueness across calls, and
wsl2_env_passthrough's no-op/merge/set behavior. No test depends on areal WSL2 host — every
wsl.exeboundary is mocked, matching how feat(desktop): add WSL2 runtime discovery with host runtime readout #6808'sown WSL2 discovery work is tested. Two rounds of real bugs in the tests
themselves, both caught by CI rather than locally: (1) the three new
tests above called the real
Path.home()unmocked to build their expectedmasking paths — on my Windows dev machine that happens to already be
drive-rooted, so they passed there, but the Linux CI runners this matrix
also uses resolve it to
/home/runner, whichwsl_namespace_argv()thencorrectly (fail-closed) refused to translate; (2) fixing that alone still
left
_relocated_policy_cache_dirs()and_voice_runtime_sandbox_paths()reading the REAL
config_dir()/KIROCREW_HOMEthis repo's own testharness pins to an isolated Linux tmp dir per test — inconsistent with the
now-mocked Windows home, so the "is this relocated from the default?"
check always answered yes and handed back an unmasked POSIX path. Both are
now explicitly neutralized in the test fixture rather than left to the
ambient environment, the same class of host-dependence bug as the
ntpathfix below, this time in test code rather than the function under test.
test/test_spawn_audit.py: oneBENIGN_SPAWNSentry for the newsandbox.py::_wsl_runchokepoint — the centralized point every WSL2helper's
wsl.exeinvocation routes through. Sandboxing it would becircular (it constructs the boundary an agent-influenced spawn is later
confined by), the same disposition already given to
ensure_agents_slice_limits.test/test_sandbox_wsl2.py: one more test forwrap_argv's newposix_shell_argvparameter — with itFalse,wsl_namespace_argvmustnever be called even when
detect_backendsays"wsl2", and the call mustfail closed exactly like Windows' pre-existing no-backend path.
test/test_cron_script.py(TestCommandCronShellResolution, 3 newtests): the wsl2 branch of
_resolve_command_shellactually calls_shell_is_posix_strict(not trusting/bin/shby name), rejects when theprobe fails, and — driving the real (unmocked)
_POSIX_STRICT_CACHErather than stubbing the probe away — that a cached verdict for one distro
is never consulted for a different one.
upstream/mainin a freshworktree:
265 passed, 74 skipped, 0 failed(skips are the existingLinux/macOS-only tests, expected on Windows) — re-run a second time after
upstream advanced one commit mid-review (
#7053, unrelated numeric configbounds) to confirm parity with its new
test_config_load_bounds_parity.pyratchet too.
flake8,isort, this fork's harness-parity gate: clean.tsc,eslint, and — for the distro-picker's new UI text —the full
npm run i18n:checkgate (all 19 checks pass) plus thecatalogParity.test.tssuite (77/77) confirming key parity across all 12shipped languages, including the regenerated
en-XApseudolocale. Thenon-English translations are a good-faith first pass (produced without a
native reviewer for several of the 10 languages); happy to have a
maintainer or community translator refine them — the catalog already
tracks this class of debt via its own "untranslated passthrough" metric,
so it is not a novel category of imperfection.
black(pinned26.3.1, matchingpyproject.toml/setup.cfgexactly):clean. This venv's Python 3.12.5 hits a documented upstream AST safety bug
that makes
blackrefuse to run at all (.fork/preflight.shitselfdetects and skips this case) — worked around by installing the exact
pinned version under a separate Python 3.10 interpreter instead of
guessing at output from a mismatched version.
mypy: now confirmed clean against the current commit(
.fork/preflight.sh lint,mypy --cache-dir ... src/kiro_crew/PASS) —the earlier I/O-bound timeouts on this host did not recur this round.
upstream/mainatb3c3151c3(from this PR's original base,122 commits behind) after CI on the prior push caught a transient upstream
inconsistency —
.github/agent-sdk-boundary-baseline.txtbrieflyrecorded a stale count for
src/kiro_crew/subagent.py— alreadyself-corrected upstream by the time of the rebase. Full suite re-run
post-rebase:
2627 passed, 183 skipped, 0 failed.upstream/mainat7eea2bea1(97 commitsfurther) after the PR sat long enough for
mergeableto flip toCONFLICTING, which was also the likely reason CI stopped triggering onthe prior commit entirely (zero check-runs registered, even while CI's own
queue was otherwise healthy). One real conflict, in
hooks.py: anunrelated upstream commit (fix(dashboard): preserve access-control xattrs across steering and file writes #6961, xattr access-control preservation) had
landed content adjacent to this PR's own hunk; the first conflict
resolution pass accidentally duplicated a block upstream had since
refactored into an
atomic_writeimport (caught byflake8F811, fixedby deferring to the import as upstream now does). Re-verified post-rebase:
.fork/preflight.sh fast/lint/surfaceall green for this PR's owndiff —
lint's one failure (Frontend Lint & Type Check, aTabsPropstype mismatch in
tabs.tsx/DiscoverPage.tsx/McpManagement.tsx/SystemPage.tsx) andsurface's 10 failures (9WinError 1314symlink-privilege gaps plus 1 already-cataloged timing flake) all land in
files this PR does not touch, confirmed pre-existing via
git diff upstream/main HEAD --stat -- <file>returning empty for each.The directly-touched files (
test_sandbox_wsl2.pyand the other fivemodified test modules):
321 passed, 6 skipped, 0 failed.around): (1) black had reflowed two
# fmt: skip-protectedos.chmod(...)lines onto three lines each, which silently broke thetrailing
# nosemgrepsuppression's same-line anchoring and produced twofresh Semgrep findings on lines this PR never touches — restored to the
original single-line form. (2)
_translate_windows_path_to_wsl2usedos.path.splitdrive, which isposixpath.splitdriveon a POSIX host andnever recognizes a drive letter — invisible on a Windows dev machine
(where
os.pathalready isntpath), but it rejected every realWindows path on Linux CI. Fixed by importing
ntpathexplicitly, sincethis function parses a Windows-style path string and its behavior must
not depend on the host running the test.
Backend Tests (namespace sandbox)failed one test —test/test_script_hooks.py::TestRunScriptHook::test_subprocess_routes_allowlist_through_safe_spawn_funnelmocks
sandboxed_spawn_argvwith a narrow(argv, *, env)signature; thisPR's own
hooks.pychange now calls it with an addedposix_shell_argvkeyword, which the mock didn't accept. The same class of fix already
applied to two other test files during earlier review; this one file was
missed. Fixed by widening the mock to
(argv, *, env, **kwargs).Manual verification
Live-tested end to end against a real WSL2/Ubuntu-26.04 host, including the
isolation itself, not just "the command ran":
wrap_argv(["/bin/bash", "-c", …], mode="strict", cwd=<a real Windows path>)→ executed inside the guest withuid=1000(sysop), correct$HOME, andpwdlanding exactly at the--cd-translated path.apps/lifecycle_scripts.run_lifecycle_script(the exact path a CrewManager-style app install failure hits) reproduced the original failure
first, then confirmed the fix: first on-loop attempt defers transiently
(background warm thread kicked, no block), second attempt ~20s later
succeeds with
INSTALL_SCRIPT_RAN, correct translatedcwd, correct uid.applied to a fresh
upstream/mainworktree (not just the fork'sdev-betabranch it was originally developed against) — same result, confirming the
ported diff and not just the original implementation.
A prior verification pass here planted markers only in the WSL2 guest's
own home — exactly the gap review caught. This pass built an isolated,
synthetic Windows-side home (never my real one), planted
.aws/credentialsand.ssh/id_rsamarkers there, pointedPath.home()at it (
USERPROFILE), and calledwsl_namespace_argv()for real againsta live distro. Both markers, read through their real DrvFs-translated
/mnt/...path from inside the sandboxed process, come backNo such file or directory; a control file outside any hidden dir, samedirectory, stayed readable. This is the actual leak path the reviewers
described, now closed and proven closed — not merely "the mechanism
looks right."
/bin/sh -c 'echo $KIROCREW_HOOK_EVENT $KIROCREW_HOOK_CONTEXT'spawn read bothvalues correctly with
WSLENVset to name them, and empty without it —confirming the forwarding is real, not just constructed correctly by
wsl2_env_passthrough's own (also unit-tested) string logic.Screenshots / video
The Settings > Developer > Config panel, with
agent.sandboxset towsl2(the option itself is live-advertised — only offered on Windows with a
working
wsl.exe— via the same schema endpointagent.acp_backendalreadyuses, not a hardcoded list). Selecting it reveals the new WSL2
Distribution row underneath, populated from this machine's real
wsl -l -voutput:Related Issues
Complements #6808 (does not duplicate — that PR is Electron-side discovery
only, and defers this exact gateway-side follow-up in its own scope note).
Discovered and filed #7332 (pre-existing, cross-platform gap in the shared
sandbox launcher's masked-dir list — see "Security findings from review"
above) while reviewing this PR; not fixed here, out of this PR's scope.
Checklist
feat: ...)