Repository navigation
fix(browser): name the missing library when chromium cannot start - #32468
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix goes at the cause: the start now watches the browser it launched instead of only the daemon that depends on it. The stderr tail it shows is size-bounded and passes through the repo's one stderr-tail redaction check. Notes
[DESIGN-REVIEWED] dc8676a Description read[DESCRIPTION-READ] 0c37368cfa8ff7800c03b5ef372ea0555abca683e38922110b12080eec23cea0 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One rider is a note: a new public export in Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: when Kiro's Chromium can't load a system library, the person is told right away which library is missing, instead of waiting 60 s for a timeout that blames the daemon. This is a FIX (#30312, with a test that fails on base).
[FIRST-PRINCIPLES-REVIEWED] dc8676a Description read[DESCRIPTION-READ] 62d9432f13ee2f168353b119b5a40a8edd092662cc205dc6836dfc0d5c6d3c80 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
9735304 to
da0924b
Compare
Sensitive Change ReviewSensitive files changed:
|
da0924b to
0fd4789
Compare
|
Sensitive change review
|
A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312
0fd4789 to
dc8676a
Compare
Sensitive change review
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head dc8676a the review traced the start path from _start to _start_daemon. A Chromium that exits during start now fails at once with its exit code, where before it waited out the 60 s daemon timeout. The review also checked that the stderr pipe ends are closed on every failure path. Each of three close-site mutations fails an existing fd-leak test, and the new end-to-end test fails when the fix is reverted. The Windows port path never reads the stderr buffer, and the browser.md spec update matches the code.
Done well: the fix goes at the cause. The new test runs the real /bin/sh pipe launcher against a stand-in chrome that prints the loader line and exits 127, so it reproduces the issue end to end.
Security: the PR publishes Chromium stderr that was discarded before, and safe_stderr_tail now accepts a redact= argument. Every kept line is judged in both spellings through the companion-aware redact_via_context, which fails closed. Only the last 3 lines are published, and only after they pass that check. The partial line cut by the 4 KiB cap is dropped, and the agent sees at most the first line, capped at 300 characters. The existing callers of safe_stderr_tail keep the default security.redact.
Optional:
Closes #30312will close an issue that also asks for a package-manager hint, and this PR rules that hint out. ConsiderPart of #30312plus a follow-up issue, or a comment on the issue that records the narrower scope.- Add a withholding case where the key is split across the 3-line cut. The current wrapped-key case has 2 lines, so it cannot tell "judge all kept lines" apart from "judge only the published lines".
- In
published_stderr_tail(agent_sdk/init.py:167), check withsepso the spelling that is judged is the same one that is published. Once the Design note is answered, the helper could also leave__all__.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
…2468) A Kiro's Chromium that cannot load a shared library exits 127 at once, but its stderr went to /dev/null and the start only watched the Harness daemon, so the person waited about 60 s for "the Harness daemon did not start in time" with no hint of the cause. On macOS and Linux the browser's stderr now goes to a pipe the gateway drains for the browser's life, keeping its newest 4 KiB in memory. The daemon wait also watches the browser: one that exits fails the start at once with its exit code and its last stderr lines, redacted, which for a missing library is the loader's own line naming it. Closes #30312 (cherry picked from commit 908add8) Original author: @bolichen97 Hand-resolved: added the TYPE_CHECKING import of Callable that main carries from an earlier commit, so the new published_stderr_tail annotation resolves on release.
Problem / Motivation
Goal: When Kiro's Chromium cannot start because a system library is missing, Browser Harness says so at once and names the library, instead of a 60 s wait that ends in a generic timeout.
On a Linux host whose Kiro's Chromium needs a shared library the system lacks, Settings > Browser > Connect (or an agent's first browser call) shows "connecting to Kiro's Chromium" for about 60 s, then
Connection failed · the Harness daemon did not start in time. The log says onlysupervisor unavailable: the Harness daemon did not start in time. Nothing names the browser or the library.Why it matters
Anyone running the gateway on a server or a minimal Linux image hits this the first time they use the browser: the agent has no browser, and the message blames the Harness daemon, which is healthy, instead of naming the one library they need to install. They wait a minute per attempt and still have nothing to search for.
Not a goal
dnf provides ...,apt-file search ...) or any mapping from a library name to a package: the loader's own line already names the file to look up.What changed (motivation → approach → change)
The browser's stderr went to
/dev/null, and the start only watched the Harness daemon. A Chromium that dies at load exits 127 within milliseconds, but nothing noticed until the daemon's 60 s deadline passed.browser_harness/supervisor.pyKiro's Chromium exited with code 127: <its last 3 stderr lines>. For a missing library that is the loader's line,error while loading shared libraries: libnss3.so: cannot open shared object file.acp/stderr_tail.py:safe_stderr_tail, checks every kept line in both spellings. If anything looks like a secret, even one wrapped across two lines, the whole tail is replaced bystderr withheld: redacted content. The judge takes an optionalredact=so the supervisor keeps the companion-awareredact_via_context; its other callers are unchanged. The supervisor reaches it throughpublished_stderr_tailinsrc/kiro_crew/agent_sdk/__init__.py, as application code must not import the ACP layer. When the 4 KiB cap has cut the oldest line, that piece is dropped first.docs/system-specs/modules/browser.mdsrc/kiro_crew/security_posture.pyacp/stderr_tail.pyentry names the supervisor as its third caller.Backwards compatibility
Compatible: a browser that starts behaves as before; only a start whose browser has already exited ends sooner, with a different
detailstring in the sameerrorstate.Removes nothing: no key, route, state or message a reader relies on is taken away; the 60 s timeout still applies to a daemon that never answers while its browser runs.
Tests
test/test_browser_harness_supervisor.py::test_a_chromium_missing_a_library_fails_the_start_naming_itrunsensure()through the real/bin/shpipe launcher against a stand-inchromescript that prints the loader's line and exits 127. It pins that the start raisesexited with code 127and thatstatus()["detail"]carrieserror while loading shared libraries: libnss3.so. Onorigin/mainit fails withthe Harness daemon did not start in timeonce the daemon's deadline passes; with the fix it passes in about 0.1 s.test_a_key_chromium_wrapped_across_lines_withholds_its_stderrfeeds the supervisor a 40-character key split over two stderr lines and pins that the detail is withheld, that a clean tail keeps only its last 3 lines, and that a line the byte cap cut is never shown._start_daemonfakes intest_browser_harness_supervisor.pyandtest_browser_harness_credentials.pytake the browser argument the start now passes.-n0, 10/10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_browser_harness_supervisor_cov.py, and once with both supervisor files' tests in a shuffled order (seed 30312).test_a_pipe_launch_that_cannot_spawn_leaves_no_pipe_end_open,test_a_pipe_launch_whose_upstream_fails_stops_the_browser) cover the stderr pipe on both failure paths.Proof: PROVEN test/test_browser_harness_supervisor.py::test_a_chromium_missing_a_library_fails_the_start_naming_it (head dc8676a)
Manual verification
A real dynamic-loader failure, not a stand-in: a small binary linked against
libkcfake.so, with the library then deleted, prints./chrome: error while loading shared libraries: libkcfake.so: cannot open shared object file: No such file or directoryand exits 127. With that binary as Kiro's Chromium, a throwaway data home, and a daemon that stays up but never answers,HarnessSupervisor(home).test(90)on this branch returned after 0.5 s withconnection='error'anddetail="Kiro's Chromium exited with code 127: <path>/chrome: error while loading shared libraries: libkcfake.so: cannot open shared object file: No such file or directory", and left no process behind. The same start onorigin/mainwaits outDAEMON_START_TIMEOUT_SECS(60 s) forthe Harness daemon did not start in time, as the issue reports.Related Issues
Closes #30312
Sibling sweep
Swept: git grep -n -E "chromium.executable|_launch_chromium" -- src/
Swept: git grep -n -E "stderr"?]? ?= ?subprocess.DEVNULL|stderr=subprocess.DEVNULL|stderr=asyncio.subprocess.DEVNULL" -- src/kiro_crew/browser_harness/ src/kiro_crew/computer_use/
Sibling: src/kiro_crew/browser_harness/supervisor.py:857 -- not affected -- the Windows port launcher already polls the browser's exit, and the helper worker below it reports its own failures over stdout
Sibling: src/kiro_crew/computer_use/launch_macos.py:569 -- not affected --
open -ahands off and the launch is confirmed by its window, not its exitSibling: src/kiro_crew/computer_use/overlay.py:313 -- not affected -- the overlay speaks JSON over stdout and is not a browser the start waits on
Pattern harvest
Rule candidate: review-prompt
Pattern: a supervisor that launches a child with stderr discarded and then waits on a second process that depends on it, so the first child's death surfaces only as the second one's timeout
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)