Skip to content

fix(sandbox): name the command and reason when exec fails - #18511

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
jcjaskula-aws:fix/sandbox-launcher-exec-error
Oct 20, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
jcjaskula-aws:fix/sandbox-launcher-exec-error

Conversation

@jcjaskula-aws

@jcjaskula-aws jcjaskula-aws commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When a sandboxed command cannot be exec'd, the error the user sees names the command and the reason.

On Linux, a Changes panel call whose gh or glab binary the namespace sandbox cannot exec fails with a message made of Python stack frames, cut off mid-frame (... File "<frozen os>", line 612, in e). Neither the reason nor the path appears. Steps and full output are in #18496.

Why it matters

The gateway checks a provider binary before it spawns it, so the exec fails only where the sandbox's view differs from the gateway's: a binary or link inside a masked directory such as ~/.docker/bin, or one replaced after the check. That is rare, but when it happens the error is the only clue, and today it carries none. Every other surface that shows the launcher's stderr gets the same traceback, whose last line names no path.

Not a goal

  • Changing how much of a provider's stderr the Changes panel keeps (the first 600 characters in sanitize._safe_error_text). With one line from the launcher, the panel shows this failure whole.
  • A separate exit status for a command that never started (126/127). The launcher's stops all exit 1.
  • Backports. release/0.9.0 has the same three files and the commit applies there cleanly; release/0.8.0 keeps its launcher in a template string in sandbox.py.
  • Launcher failures before the exec, which already end in one line.

What changed (motivation → approach → change)

Symptom. A failed exec inside the namespace sandbox reaches the user as a truncated traceback.

Cause. exec_agent in sandbox_launcher_program.py lets the OSError from the exec escape, so Python prints a traceback. The exception names no path (execv sets no filename), and it comes last, after four launcher frames. The panel keeps the first 600 characters, so the exception is cut off (at character 648 in #18496's run).

Change. exec_agent catches OSError around both exec branches and exits with sandbox: FATAL — cannot exec <path> (<reason>), status 1 like the launcher's other stops. A command that execs is untouched.

The prefix is the existing sandbox: FATAL, not a new one. LAUNCHER_EXIT_PREFIXES is the definition every reader of launcher stderr but the worktree handler keys on, and two tests pin every string in the launcher against it. With FATAL, each reader keeps its verdict:

  • launcher_refusal returns None, as it does for the unreadable-known_hosts FATAL line: the sandbox was built and the command is missing inside it. The ACP sandbox-init check reads no sandbox failure. Both read the traceback the same way.
  • The Auto-Improvement clone probe still reports a launcher failure, now with the line that names the command as its detail.
  • The ACP read-back diagnosis gives the same phrase ("the path does not exist", "the OS refused to execute it").
  • The worktree handler reads no refusal, with the second commit.

A new prefix such as sandbox: cannot exec fails both pinning tests, and the clone probe would read the exit as git's own, the misreport #8151 was about. Keeping the tail of stderr in the panel instead would help only the panel, and the tail names no path.

The prefix tuple's comment and launcher_refusal's docstring now list the failed exec among the FATAL cases.

Second commit. The worktree handler reads launcher stderr itself (_launcher_failure_line) and takes every sandbox: line but a WARNING as a refusal, so with the first commit alone a git the launcher cannot exec makes worktree creation answer 503 "This host has no OS sandbox backend…", and audit "sandbox backend unavailable", on a host whose sandbox works. It now skips ^sandbox: FATAL \S+ cannot exec , so the call fails as git's own, the handler's only other outcome, and creation answers 400 "Not a git repository", as on main. The unreadable-known_hosts FATAL line still refuses there; routing the reader through launcher_refusal, which returns None for it, would not. The dash is any token: under a non-UTF-8 locale the launcher writes it as \u2014. A child printing the line is treated as any failing git. A backport to release/0.9.0 needs both commits.

Backwards compatibility

Compatible: a command that execs is untouched, and a failed exec still exits 1; only its stderr changes, from a traceback to one sandbox: FATAL line. Every reader of launcher stderr reaches the verdict it reaches on main, the worktree handler through the second commit.

Removes nothing: the diff adds an exception handler, a message and a line shape the worktree handler skips, and no key, field, path or function is removed or renamed.

Tests

test/test_sandbox_launcher_refusal.py, new TestAFailedExecIsOneLauncherLine (5 tests):

  • a missing command, through the real os.execvp, ends in the FATAL line naming the path and No such file or directory;
  • a refused exec names its own reason (Permission denied);
  • an OSError without an errno still gives a reason;
  • a command that execs gets its argv unchanged;
  • each reader keeps its verdict: launcher_refusal and the ACP sandbox-init check see no sandbox failure, the clone probe's detail is the line, and the worktree handler sees no refusal.

test/test_worktree_create.py, 3 new cases: _run_git returns the line as git's own failure, with the dash as UTF-8 or \u2014, and the endpoint answers 400 with no "sandbox backend unavailable" audit.

The existing TestClassifierMatchesTheLauncher pins the new string's prefix. Five breakages of the launcher change each fail at least one test: no handler (4), a new prefix (5), exc.strerror alone (1), the path dropped (3), only the injected exec guarded (1). Four breakages of the worktree skip do too: none (4), every FATAL line (1), the UTF-8 dash only (1), cannot alone (1).

Regression, both commits, on main 19190b68e6: 147 test files that read, render or run the launcher, read its stderr, exercise the worktree handler or import the sandbox module: 12,578 passed, 2 failed, 109 skipped, 5 xfailed (unpatched main: 12,570 passed, the same 2 failed). Fast Gate, the black gate, isort, flake8 and mypy pass.

Manual verification

In an ubuntu:24.04 container with the real namespace sandbox (uid 1000, --network none, docker/seccomp/kirocrew-seccomp.json; backend namespace), before and after the change:

Command main This change
binary in masked ~/.docker/bin 16-line traceback; panel shows frames only sandbox: FATAL — cannot exec /home/ubuntu/.docker/bin/probe (No such file or directory), shown whole
missing binary same traceback ... cannot exec /home/ubuntu/tools/absent (No such file or directory)
file without the execute bit traceback ending PermissionError ... cannot exec /home/ubuntu/tools/noexec (Permission denied)
true, false, sh -c 'echo own-message >&2; exit 3' exit 0, 1, 3 with their own stderr unchanged

Through the Changes panel's own _run_json("gh", "api", "user") (real audit, sandbox wrap and spawn, resolver pointed at the masked binary), the SourceProviderError text goes from the cut-off traceback to the FATAL line.

Worktree creation in the same container, which has no git: 400 "Not a git repository" on main, the 503 and its audit with the first commit alone, and 400 with no refusal audited with both.

Not run: a host where systemd-run wraps the launcher (the container has none), and macOS, whose Seatbelt path does not use this launcher.

Related Issues

Closes #18496.

Pattern harvest

Rule candidate: review-prompt
Pattern: an error surface that keeps the head of a child's stderr loses the cause when the child ends in a traceback (also #10043's tunnel error and #17934's Notes git sync).

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

Contributed under the project's Apache-2.0 license.

@jcjaskula-aws
jcjaskula-aws requested review from a team and KiroCrewCaptain as code owners October 9, 2026 15:55
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 6bf88f528bc8a6db2e2c469997ad107419754eb0 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 6bf88f528bc8a6db2e2c469997ad107419754eb0 via the fork AI-review pipeline — 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

Not run on a host where systemd-run wraps the launcher. Confirm the one-line FATAL still reaches the Changes panel's stderr there.

What this change ships

Inventory (6 items) — 4 justified

Intent: when a sandboxed gh/glab/git cannot start, the user sees which command failed and why, not a truncated traceback (#18496). FIX.

  1. A command the launcher cannot exec now fails with one sandbox: FATAL — cannot exec <path> (<reason>) line instead of a traceback — justified
  2. Worktree creation with an unexecutable git answers 400 "Not a git repository" instead of the 503 that item 1 alone would cause — justified
  3. New public LAUNCHER_EXEC_FAILURE_RE, read by launcher_refusal and the worktree handler (2 consumers outside tests) — justified
  4. Unprintable characters in the failed command's path are written as escapes, so no forged second launcher line can appear — undeclared: the description never mentions escaping
  5. launcher_refusal checks for the exec-failure line before its "did not publish" test, so a path containing those words is not read as transient — undeclared
  6. The security spec and the prefix comment now list the failed exec as a FATAL case — justified

[FIRST-PRINCIPLES-REVIEWED] 6bf88f5

Description read

[DESCRIPTION-READ] a4a8eefa6fb3915afc6fde4a134662a27a17d2016586397c532bfda31cf1d37a

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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 6bf88f528bc8a6db2e2c469997ad107419754eb0 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm the one-line FATAL stderr still arrives intact when systemd-run wraps the launcher; the author says that host path was not run.

[DESIGN-REVIEWED] 6bf88f5

Description read

[DESCRIPTION-READ] 8f4f0f284df380ded9218a725fa743c34cf62176c19324ef0f2f9a1186bad20c

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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 6bf88f528bc8a6db2e2c469997ad107419754eb0 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6bf88f5

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 6bf88f528bc8a6db2e2c469997ad107419754eb0 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6bf88f5

@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from 680665e to 016b467 Compare October 10, 2026 04:06
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from e3e1312 to d45d4f8 Compare October 14, 2026 21:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@jcjaskula-aws jcjaskula-aws changed the title fix(sandbox): report a failed exec as one launcher line fix(sandbox): name the command and reason when exec fails Oct 15, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

This branch conflicts with main. Please rebase it on main.

@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from d45d4f8 to 4c73bd5 Compare October 19, 2026 17:40
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the rebase. Reviewed head 4c73bd5d3e4a211a883ff4ad2ba129960d231994, which is now current with main. The conflict is gone: the comment and docstring edits moved to sandbox_unavailable.py, and sandbox.py dropped out of the diff.

The change is right in shape. One sandbox: FATAL line replaces a cut-off traceback, and each reader of launcher stderr keeps its verdict (launcher_refusal returns None, the ACP sandbox-init check sees no failure, the clone probe gets the line as its detail, the worktree handler reads no refusal). Only argv[0] and strerror are printed, so no arguments or environment values leak.

One should-fix remains from the previous round, plus a small nit:

  1. argv[0] is still interpolated raw into the line (inline comment on sandbox_launcher_program.py). A newline in the path lets the line carry a forged sandbox: BLOCKED line that _launcher_failure_line returns as a refusal. Reproduced against this head's _launcher_failure_line logic.
  2. Nit: a rewrapped docstring line in sandbox_unavailable.py runs to 136 columns (inline comment).

Minor, not blocking: launcher_refusal returns transient for any FATAL line containing did not publish. Since the path is now inside a FATAL line, a command path containing that phrase would be classified as a handshake failure. Checking cannot exec before the handshake match would close it.

Maintainer notes: fork CI on this head is still waiting for run approval, and the PR touches the sandbox launcher, so it needs the sensitive-path review from a maintainer before it can merge.

Comment thread src/kiro_crew/sandbox_unavailable.py Resolved
@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from 4c73bd5 to 918a1b4 Compare October 19, 2026 19:04
@jcjaskula-aws

Copy link
Copy Markdown
Contributor Author

@bolichen97 thanks for the review. All three points are fixed, folded into the PR's two commits (a14fb72 and 918a1b4). The two inline ones are answered in their threads.

On the minor point: launcher_refusal matches the failed-exec line (^sandbox: FATAL \S+ cannot exec , the pattern the worktree reader skips) before it looks for "did not publish", so a command path holding those words reads as a failed exec, not a handshake failure. test_a_path_holding_the_handshake_words_is_still_a_failed_exec covers that, and checks that the handshake line itself still reads as transient.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, both points from the last round are fixed. Reviewed head 918a1b4b75006773b1a73bbec1dc15eb2a112604.

  1. argv[0] escaping: exec_agent now writes every unprintable character of the command and the reason as its escape, so the FATAL line stays one line under str.splitlines(). Using str.isprintable() rather than a control-byte class is the better choice, since it also covers U+2028, U+2029 and U+0085. test_an_unprintable_character_in_the_path_is_written_as_its_escape pins a newline, a terminal escape and U+2028 in one path, and checks that launcher_refusal, the ACP sandbox-init check and _launcher_failure_line all keep their verdict.
  2. Test coverage: that test plus test_a_non_ascii_path_is_written_as_it_is cover the escaping, and test_a_path_holding_the_handshake_words_is_still_a_failed_exec covers the handshake ordering in launcher_refusal, which now matches cannot exec before did not publish.

The over-long docstring line is rewrapped, and no line this PR adds goes past 100 columns.

What I verified: I ran test/test_sandbox_launcher_refusal.py and test/test_worktree_create.py locally at this head, and all 136 tests passed. I also read the full diff. I found no new issues.

Maintainer checks still open before this can merge: fork CI on this head is waiting for run approval, so readiness is not passed yet, and the change touches the sandbox launcher, which needs the sensitive-path review from a maintainer.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 19, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 19, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CI has now run on head 918a1b4b75006773b1a73bbec1dc15eb2a112604. All test, lint and AI review lanes pass. Two checks are red, and only one of them needs a change from you.

  1. Internal Content Scan (needs a change in this PR). The scan flags 2 added lines under its home directory path rule: test/test_sandbox_launcher_refusal.py lines 494 and 495, where the non-ASCII fixture path sits under /home/<user>/. Moving the fixture out of a home directory, for example to /opt/zoë/outils/gh, keeps what the test pins (a non-ASCII path written as it is) and should clear the scan.
  2. Sensitive Change Review (not yours to fix). The PR touches sandbox_launcher_program.py and sandbox_unavailable.py, which are sensitive paths. This gate cannot pass from a fork by design: a maintainer has to carry the change on a branch of this repository with you kept as co-author and run the real sandbox there. That is on the maintainer side.

PR Readiness is red only because of these two checks.

@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from 918a1b4 to efd17b6 Compare October 20, 2026 08:30
@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 Oct 20, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed at efd17b6. The home-directory fixture from the last round is fixed: the exec-failure test now uses /opt/tools/bin/gh, and Internal Content Scan passes on this head. The exec-failure handling reads correctly: the launcher prints one escaped FATAL line, launcher_refusal and the worktree handler both match LAUNCHER_EXEC_FAILURE_RE before anything else, and a failed exec is reported as the command's own failure, not as a missing sandbox backend. No new findings from me.

Two CI notes. Backend Tests shard 3 fails on test_chat_follow_default_slot_kinds, which was red on main and is fixed there now; this branch is 110 commits behind main, so a rebase should clear it. Shard 2 hit the 120 second timeout in the facade mirror tree scan rather than an assertion; a rebase rerun should show whether that was runner load.

This PR changes the sandbox launcher, which is a sensitive path, so approval stays with a human maintainer.

@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 Oct 20, 2026
When the Linux namespace launcher cannot exec its command, exec_agent
lets the OSError escape and the child dies with a Python traceback. The
exception names no path, and it comes last, after four launcher frames,
so the Changes panel, which keeps the first 600 characters of stderr,
cuts it off and shows only stack frames.

exec_agent catches OSError around both exec branches and exits with
"sandbox: FATAL — cannot exec <path> (<reason>)", status 1 like the
launcher's other stops. FATAL is already one of LAUNCHER_EXIT_PREFIXES,
so launcher_refusal and the ACP sandbox-init check reach the same
verdict they reach for the traceback (no sandbox refusal), and the
Auto-Improvement clone probe still reports a launcher failure, with the
line that names the command as its detail. A command that execs is
untouched.

Unprintable characters in the path and the reason are written as
escapes, so the line stays one line. The line's shape is
LAUNCHER_EXEC_FAILURE_RE, defined beside LAUNCHER_EXIT_PREFIXES, and
launcher_refusal matches it before it looks for the handshake's "did
not publish", which a command's path can also hold.

The prefix tuple's comment and launcher_refusal's docstring name the
failed exec among the FATAL cases, and the security spec lists it among
the lines launcher_refusal reads as no refusal.
The worktree handler reads the sandbox launcher's stderr itself, and to
it every "sandbox: " line except a WARNING is a refusal. A git the
launcher cannot exec ends with "sandbox: FATAL — cannot exec git
(<reason>)", so on a host whose sandbox works, creating a worktree
answered 503 "This host has no OS sandbox backend" and audited "sandbox
backend unavailable".

The reader skips that line, matched with the sandbox's
LAUNCHER_EXEC_FAILURE_RE, the pattern launcher_refusal reads, so the
failed call comes back as git's own failure and the handler reports it
the way it reports any other. The launcher's other FATAL line, the
host-trust pre-read, still refuses. The dash is matched as any one
token: the launcher inherits the gateway's locale, and where stderr is
not UTF-8 its interpreter writes the dash as an escape.
@jcjaskula-aws
jcjaskula-aws force-pushed the fix/sandbox-launcher-exec-error branch from efd17b6 to 6bf88f5 Compare October 20, 2026 10:29
@jcjaskula-aws

Copy link
Copy Markdown
Contributor Author

@bolichen97 thanks for the re-review. I rebased onto current main (6bf88f5 on f62ab4f), which includes #22433, and test_chat_follow_default_slot_kinds passes locally on the new head. The rebase leaves both commits unchanged.

Shard 2's timeout was test_every_name_the_test_trees_patch_through_a_facade_reaches_its_readers, the tree-scan timeout tracked in #22004, #22007 and #22281. On the new head it passes locally in 33 s, and CI runs it again.

Is there anything else you need from me before a maintainer picks up the sensitive-path step?

@jcjaskula-aws

Copy link
Copy Markdown
Contributor Author
  • Check: a kiro-cli that fails to exec is still reported as not installed

Checked, holds. kiro_prerequisite_process._run_process calls corroborate_launcher_refusal only when launcher_refusal(output) is not None, and launcher_refusal returns None for the failed-exec line, so the line starts no trusted-launcher run.
corroborate_launcher_refusal also returns None at once for such output: its first check is the same launcher_refusal call.
With no sandbox_failure, the probe takes the plain-failure path that test_missing_binary_still_reports_not_installed pins: installed is False and sandbox_unavailable is False.
test_every_reader_of_launcher_stderr_keeps_its_verdict pins launcher_refusal(line) is None for the line the launcher prints.

@jcjaskula-aws

Copy link
Copy Markdown
Contributor Author
  • Check: the known_hosts FATAL line still gets a 503 from the worktree handler

Checked, holds. _launcher_failure_line skips only a line that matches LAUNCHER_EXEC_FAILURE_RE (^sandbox: FATAL \S+ cannot exec ). The known_hosts pre-read line reads sandbox: FATAL — cannot read ..., so it is still returned as the refusal, _run_git raises SandboxUnavailable, and both create paths answer 503.
TestLauncherAdvisoryIsNotARefusal.test_the_fail_closed_pre_read_line_still_refuses pins that _run_git raises SandboxUnavailable carrying that line; test_a_fatal_launcher_line_still_refuses does the same for the unshare line.
The worktree handler keeps its own reader on purpose: launcher_refusal returns None for the known_hosts line, so routing the handler through it would drop that refusal.

@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 Oct 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 6bf88f528bc8a6db2e2c469997ad107419754eb0.

I found no defect. exec_agent now prints one escaped sandbox: FATAL — cannot exec <command> (<reason>) line instead of a traceback. launcher_refusal and the worktree reader both match that line before anything else, so a failed exec is reported as the command's own failure, not a missing sandbox. The known_hosts FATAL line still refuses. The earlier newline-injection finding is fixed and was accepted by the reviewer.

This needs a human for two reasons:

  1. It changes the sandbox launcher and what counts as a sandbox refusal (sandbox_launcher_program.py, sandbox_unavailable.py, dashboard/handlers/worktree.py). The Sensitive Change Review check is red, as expected for a fork, and a maintainer has to carry it and run the real sandbox.
  2. Both Design and First Principles on this head ask to confirm the FATAL line still arrives intact when systemd-run wraps the launcher. The description says that host was not run, and there is no disposition for this head.

What would clear it: a disposition, or a maintainer run, covering the systemd-run path, and the maintainer's sensitive-path review.

def exec_agent(launch, argv):
"""Replace this process with the agent command, in the scrubbed environment.
A command the kernel will not exec ends the launcher the way its other stops do:
one FATAL line naming the command and the reason, then exit 1. The exception's
own text names no path, and a traceback puts it last, where a caller that keeps
the head of stderr cuts it off.
"""
try:
if launch.execvp is None:
os.execvp(argv[0], argv)
else:
launch.execvp(argv[0], argv)
except OSError as exc:
# Unprintable characters go out as escapes: a newline in the path would start a
# second line that a reader of launcher stderr could take for the launcher's own.
command, reason = (
"".join(c if c.isprintable() else ascii(c)[1:-1] for c in str(part))
for part in (argv[0], exc.strerror or exc)
)
sys.exit("sandbox: FATAL — cannot exec %s (%s)" % (command, reason))

— crew-pr-reviewer (r115)

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving. The repository maintainer has taken ownership of this sandbox launcher change and accepts it in place of the fork Sensitive Change Review.

Verified on head 6bf88f5:

  • Head is a rebase of efd17b6, which was reviewed in full and found good to ship. The patch itself did not change.
  • Readiness label is passed and the required PR Readiness check is green. The only failing check is Sensitive Change Review, which this approval covers.
  • AI review lanes on this head: Opus, GPT, design and first principles all pass with no blocking findings. UX review was skipped as no user-facing surface changed.
  • No requested changes from any reviewer. The linked issue is tier T1.
  • Base is main and the branch is mergeable.

Enabling squash auto-merge.

@bolichen97
bolichen97 merged commit 3f862f2 into kirodotdev:main Oct 20, 2026
99 of 100 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 2026
@jcjaskula-aws
jcjaskula-aws deleted the fix/sandbox-launcher-exec-error branch October 20, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux sandbox launcher reports a failed exec as a raw traceback; the Changes panel cuts off its error line

3 participants