Repository navigation
fix(doctor): stop a sandboxed shell reporting the decoder as missing - #31461
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Both changes fix the code that misreported the failure, and each has one existing caller. What this change shipsInventory (3 items) — 3 justifiedIntent: when the user's agent runs
[FIRST-PRINCIPLES-REVIEWED] 58284c8 Description read[DESCRIPTION-READ] 65252aa4a21802c9b2f25c53fa450cb875a3257edba3fd4446cb9eace451bb83 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix goes to the cause: a staging Notes
[DESIGN-REVIEWED] 58284c8 Description read[DESCRIPTION-READ] 462b790d84cb0614c98b8d304f1aaee3b8a8d2f139352eb618269c3340ec18c5 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 |
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: |
|
[operator: bolichen97] The red #31469 raises that budget to main's measured size. This PR waits for it: no rerun and no override for this red. Once #31469 lands, this branch rebases onto it (which also absorbs the The earlier failing |
On macOS every audio decoder except a fixed system one runs from a snapshot staged under the data home's run/ root, which every agent sandbox denies. Run from an agent's shell, kirocrew doctor therefore failed to stage an authentic decoder, logged it as a digest mismatch, reported "ffmpeg: not found" and told the user to reinstall. An OSError, which only reading or staging the decoder raises, now propagates out of _authenticated_ffmpeg, and _open_authenticated_in logs it as a decoder that could not be read or staged, naming the errno's system text and never a path. A size, digest or signature refusal keeps the digest message, and the set of decoders that authenticate is unchanged. From a confined shell on macOS, doctor prints "not checkable from this shell" for a decoder it did not find, adds no issue, and points at the user's own terminal. Linux stages into a memfd, so a miss there keeps its verdict. Closes #27030
69a9836 to
58284c8
Compare
|
[operator: bolichen97] #31469 merged, so this branch is rebased onto |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved by Crew Captain for the on-call, who accepted the open items on this PR. Review lanes clean on this head.
…31461) On macOS every audio decoder except a fixed system one runs from a snapshot staged under the data home's run/ root, which every agent sandbox denies. Run from an agent's shell, kirocrew doctor therefore failed to stage an authentic decoder, logged it as a digest mismatch, reported "ffmpeg: not found" and told the user to reinstall. An OSError, which only reading or staging the decoder raises, now propagates out of _authenticated_ffmpeg, and _open_authenticated_in logs it as a decoder that could not be read or staged, naming the errno's system text and never a path. A size, digest or signature refusal keeps the digest message, and the set of decoders that authenticate is unchanged. From a confined shell on macOS, doctor prints "not checkable from this shell" for a decoder it did not find, adds no issue, and points at the user's own terminal. Linux stages into a memfd, so a miss there keeps its verdict. Closes #27030 (cherry picked from commit d6fc73c) Co-author on main: Bolin Chen
…31461) On macOS every audio decoder except a fixed system one runs from a snapshot staged under the data home's run/ root, which every agent sandbox denies. Run from an agent's shell, kirocrew doctor therefore failed to stage an authentic decoder, logged it as a digest mismatch, reported "ffmpeg: not found" and told the user to reinstall. An OSError, which only reading or staging the decoder raises, now propagates out of _authenticated_ffmpeg, and _open_authenticated_in logs it as a decoder that could not be read or staged, naming the errno's system text and never a path. A size, digest or signature refusal keeps the digest message, and the set of decoders that authenticate is unchanged. From a confined shell on macOS, doctor prints "not checkable from this shell" for a decoder it did not find, adds no issue, and points at the user's own terminal. Linux stages into a memfd, so a miss there keeps its verdict. Closes #27030 (cherry picked from commit d6fc73c) Co-author on main: Bolin Chen
…31461) On macOS every audio decoder except a fixed system one runs from a snapshot staged under the data home's run/ root, which every agent sandbox denies. Run from an agent's shell, kirocrew doctor therefore failed to stage an authentic decoder, logged it as a digest mismatch, reported "ffmpeg: not found" and told the user to reinstall. An OSError, which only reading or staging the decoder raises, now propagates out of _authenticated_ffmpeg, and _open_authenticated_in logs it as a decoder that could not be read or staged, naming the errno's system text and never a path. A size, digest or signature refusal keeps the digest message, and the set of decoders that authenticate is unchanged. From a confined shell on macOS, doctor prints "not checkable from this shell" for a decoder it did not find, adds no issue, and points at the user's own terminal. Linux stages into a memfd, so a miss there keeps its verdict. Closes #27030 (cherry picked from commit d6fc73c) Co-author on main: Bolin Chen
Problem / Motivation
Goal:
kirocrew doctorrun from an agent's shell on macOS no longer reports an authentic audio decoder as missing and no longer tells the user to reinstall Kiro Crew.Run from a crewmate's own shell on macOS,
kirocrew doctorprintedIgnoring ffmpeg-macos-aarch64 in a pinned decoder location: its bytes do not match the digest pinned for that filename.andffmpeg: ❌ not foundwithFix: reinstall Kiro Crew, and countedffmpegas an issue. The decoder was authentic (codesign --verifypasses). The real failure was aPermissionErrorstaging the decoder's snapshot under the data home'srun/root, which every agent sandbox denies by design.Why it matters
Doctor is the command a user, or their agent, runs first when something looks wrong. From an agent's shell on a macOS desktop release it named a supply-chain style failure that did not exist and sent the user to reinstall the app for nothing, and the run exited non-zero over it.
Not a goal
run/snapshot root reachable from an agent sandbox, or any other sandbox, seal or mask change.browser node/npmrow from the same report: it came from the retired playwright-cli stack, which feat: add the live browser harness to chat #26950 removed (first released in v0.12.0).origin/mainhas no such row and nobrowser_cli/, so its "fall back toos.geteuid()" point has no code left to change.What changed (motivation → approach → change)
On macOS every decoder except a fixed system one (Homebrew) runs from a private snapshot staged under
<data home>/run/. An agent's sandbox denies that root, so from an agent's shell the staging call fails before a single byte is hashed._authenticated_ffmpegfolded thatOSErrorinto the sameNoneas a digest or signature refusal, and_open_authenticated_inlogged everyNoneas a digest mismatch; doctor then reported the decoder as absent.transcribe_ffmpegwarningits bytes do not match the digest pinned for that filename.it could not be read or staged for execution (Operation not permitted).ffmpeg:row❌ not found,Fix: reinstall Kiro Crew, counted as an issue⏭ not checkable from this shell, runkirocrew doctorfrom your own terminal, no issueAn
OSError, which only reading or staging the decoder raises, now propagates out of_authenticated_ffmpeginstead of returningNone, and_open_authenticated_inlogs it as a staging failure, naming only the module-constant filename and the system's text for the errno, never a path. A size, digest or signature refusal keeps the digest message, and a decoder that raised is skipped as before, so the set of decoders that authenticate is unchanged. The execution path (_open_ffmpeg_for_execution) resolves through the same_open_authenticated_in, so there too a decoder that cannot be staged is skipped, now under the staging message. In doctor's Speech-to-Text section (doctor_checks/features.py), a decoder not found from a confined shell (confinement._doctor_vantage_confined(), the signal the task-store skip already uses) on macOS prints the skip row instead of the failure, because from there a miss cannot be told apart from the sandbox's denial. A found decoder, an unconfined run and Linux are unchanged.docs/system-specs/modules/cli.mditem 9 states the rule.Backwards compatibility
Compatible: the same decoders authenticate and execute; only one warning's text and one doctor row from a confined macOS shell change.
Removes nothing: doctor still counts a missing decoder from an unconfined terminal and on Linux, and nothing reads the warning text (
git grep "pinned decoder location"finds only the logger).Tests
test/test_transcribe_ffmpeg.py::TestBundledFfmpeg::test_a_snapshot_that_cannot_be_staged_is_not_reported_as_a_digest_mismatch: a snapshot that raisesPermissionError(EPERM, ..., "<path>/run")leaves no decoder, logs the staging message and not the digest one, and the path never reaches the log. Skipped on Windows, which stages nothing.test_same_size_replacement_is_rejected_by_digestadditionally asserts a real digest mismatch keeps the digest message.test/test_cli_stt_memory_doctor.py::TestDoctorStt::test_doctor_in_a_confined_macos_shell_does_not_report_the_decoder_missing: a desktop release whose decoder is not found, seen from a confined macOS shell, printsnot checkable from this shell, no reinstall line, andffmpegis not among the issues.test_doctor_in_a_confined_linux_shell_still_reports_the_decoder_missing: the same from a confined Linux shell keeps❌ not foundand theffmpegissue.TestDoctorStt._hermetic_doctorandTestDoctor._hermetic_sandbox(test/test_cli.py) now pin_doctor_vantage_confinedto unconfined, next to the sandbox backend they already pin. Without that, a macOS run of these files from an agent's own shell takes the new skip row, and eight existing tests that assert theffmpeg:row (the fourtest_doctor_stt_marker_arms_match_platformcases among them) fail on that row. Simulated withKIROCREW_SANDBOX_ACTIVE=1, they failed before the pin and pass with it; the two new doctor tests set their own value.Proof: PROVEN test/test_cli_stt_memory_doctor.py::TestDoctorStt::test_doctor_in_a_confined_macos_shell_does_not_report_the_decoder_missing, test/test_transcribe_ffmpeg.py::TestBundledFfmpeg::test_a_snapshot_that_cannot_be_staged_is_not_reported_as_a_digest_mismatch (head 58284c8)
Determinism: the four tests above and the four
test_doctor_stt_marker_arms_match_platformcases passed 20 of 20 runs at-n0and 10 of 10 at-n 2 --dist loadgroup --max-worker-restart=2besidetest_cli_doctor_refactor_family_reads.pyandtest_cli_doctor_parts.py; every test in the three changed test files ran green in a shuffled order (seed 24417, 115 passed, 1 skipped). A mutation run broke each new guard in turn (dropping the macOS gate, folding theOSErrorback intoNone, logging the error's own text, giving every refusal the staging message) and a named test failed every time.Run locally on macOS, ten existing
TestDoctorStttests andTestDoctorEmbeddings::test_doctor_blames_the_override_dir_not_the_bundled_treefail on unmodifiedmainthe same way: the macOStls trust:doctor row reports the system trust store as not enabled under pytest and adds an issue. They pass withSSL_CERT_FILEset. The runs above andprove.pyalso used a scratchHOME, because the runner's own kiro-cli settings add an unrelated doctor issue that fails the same exit-code assertions on unmodifiedmain. The new doctor tests do not assert the exit code for these reasons.Manual verification
On macOS 26.7.2 (Apple silicon), against the installed KiroCrew Nightly 0.13.0-nightly.20261105t060755 desktop release and this branch. The agent-shell vantage is the command run inside the Seatbelt profile the gateway confines agent sessions with (
sandbox.sandboxed_spawn_argv, modeauto), with a scratchHOMEso nothing touched a real data home; the bundled decoder is the release's ownkirocrew_ffmpeg/bin/ffmpeg-macos-aarch64, whichcodesign --verify --strictaccepts.Before (unmodified release,
kirocrew doctor, agent-shell vantage). Excerpt in output order:...marks rows left out, and the stderrWARNINGline, which printed glued onto an earlier stdout row, is shown on its own line without its timestamp:The same release from an unconfined terminal prints
ffmpeg: ✅ available. Neither run has abrowser noderow. From the agent-shell vantage,sandbox_unavailable.agent_confinement_evidence()returnsthe kernel reports this process is Seatbelt-confined(with the launcher marker dropped, ascli.main()does), andNoneunconfined._open_authenticated_in(<release decoder dir>, allow_signature_anchor=True)onmainthere logs the digest warning and returns[]; the snapshot call itself raisesPermissionErrorerrno 1.After (this branch):
_open_authenticated_in(<release decoder dir>, allow_signature_anchor=True):Ignoring ffmpeg-macos-aarch64 in a pinned decoder location: it could not be read or staged for execution (Operation not permitted).and[].1(the signed decoder still authenticates through its Developer ID signature). The scratch home was deleted afterwards.kirocrew doctorfrom this branch's source install:ffmpeg: ✅ available, because this Mac has a Homebrew ffmpeg, a fixed system decoder that is not staged.The same run unconfined prints
ffmpeg: ✅ available.Screenshots / video
N/A: no frontend change. The doctor text is quoted under Manual verification.
Related Issues
Closes #27030
Sibling sweep
Swept: git grep -n "_find_ffmpeg|_open_ffmpeg_for_execution|ffmpeg_source()|_new_executable_snapshot" -- src/
Sibling: src/kiro_crew/transcribe_ffmpeg.py:660 -- changed here
Sibling: src/kiro_crew/doctor_checks/features.py:242 -- changed here
Sibling: src/kiro_crew/dashboard/handlers/core_stt_settings.py -- not affected -- runs in the gateway process, which an agent sandbox never confines
Sibling: src/kiro_crew/dashboard/handlers/core_stt_status.py -- not affected -- runs in the gateway process, which an agent sandbox never confines
Sibling: src/kiro_crew/stt/decoder.py:640 -- not affected -- the decoder fetch runs in the gateway process, never from an agent shell
Pattern harvest
Rule candidate: review-prompt
Pattern: a broad
except OSErrorthat returns the same sentinel as a verification refusal, so the caller's message blames the bytes for an environment failureChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license (see the Licensing section of CONTRIBUTING.md).