Repository navigation
Refuse a Malformed Launcher Probe and Check the Wrapper Probe's Exit Status - #4041
Conversation
…Status launcher_problem() refuses a probe that prints the token over a non-numeric version instead of raising, so hook_launcher() moves on to the next candidate. install.sh checks the probe's exit status as well as its output, so a stub printing "ok" and exiting non-zero is passed over. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, with targeted safeguards and regression tests covering malformed versions and unsuccessful wrapper probes.
No open issues 🎉
What changed in this PR
This PR hardens Claude agent-safety launcher selection by refusing malformed version probes and checking wrapper probe success before selecting Python.
Changes:
- Refuses malformed launcher version output instead of raising during installation or reporting.
- Requires the POSIX wrapper's probe command to exit successfully before accepting its output.
- Adds regression tests for malformed versions and failing wrapper probes.
| File | Description |
|---|---|
| host-setup/agent-safety/claude/test_install.py | Adds regression tests covering malformed launcher versions and wrapper probes that print valid output but fail. |
| host-setup/agent-safety/claude/install.sh | Requires the Python probe to complete successfully before using its reported interpreter. |
| host-setup/agent-safety/claude/install.py | Refuses malformed launcher probe version output instead of aborting launcher selection. |
Review effort: Lite
The encoding gate requires every text-mode subprocess call to name its encoding rather than leave it to the locale. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4041 +/- ##
========================================
Coverage 79.03% 79.03%
========================================
Files 37 37
Lines 12676 12676
========================================
Hits 10019 10019
Misses 2657 2657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action performed
|
Summary
Fixes two of the three P1 findings raised on promotion PR #4039 against the agent-safety launcher probe that #4032 added. Each fix fails closed, and each comes with a test built on constructed input that fails against the code on
develop.host-setup/agent-safety/claude/install.py:498(launcher_problem): a probe that printed the token followed by a non-numeric version, such asagent-safety-launcher 3a 11, raisedValueErrorand aborted the install or--report. That output is now a refusal, sohook_launcher()moves on to the next candidate.host-setup/agent-safety/claude/install.sh:16: the wrapper ignored the probe's exit status, so a stub that printedokand exited 3 was handedinstall.py. The output is now captured with an&&status check before it is compared. The exposure was narrower than the finding states, becauseinstall.py's ownhook_launcher()already re-probes the hook launcher and checks its return code. What was at stake is only which interpreter runsinstall.py.Deferred finding
host-setup/agent-safety/claude/install.py:530(registered_launcher) is deferred to Settle Which Shell Runs a Claude Code Hook on Native Windows Before Changing How registered_launcher Splits a Command #4040, on the maintainer's decision. For the double-quoted shapehook_command()writes, the finding is wrong: POSIXshlex.splitkeeps single backslashes, so a quotedC:\...launcher splits intact. A UNC launcher loses one of its leading backslashes inside double quotes, and a bare, unquoted hand-written path loses all of them. Whether either of those is a defect depends on which shell runs a hook on native Windows. Under Git Bash the POSIX split matches what actually runs, and under cmd.exe it does not. Settle Which Shell Runs a Claude Code Hook on Native Windows Before Changing How registered_launcher Splits a Command #4040 settles the executor before the split changes.Tests
New cases in
TestLauncherinhost-setup/agent-safety/claude/test_install.py:test_a_malformed_version_is_refused_and_the_next_candidate_tried: before the fix it raisedValueError: invalid literal for int() with base 10: '3a'.test_install_sh_passes_over_a_python_that_prints_ok_and_fails: runsinstall.sh --helpwith apython3stub that printsokand exits 3, placed ahead of a workingpython. Before the fix the wrapper exits 3.python3 -m unittest test_installruns 196 tests, all OK.shellcheck install.sh,ruff check, andruff format --checkare clean.Local review findings, declined
okwhile failing. Declined: both are P1 findings verified real on Promote Develop: Prose Gate Pin, Agent-Safety Launcher Probe, Kit Install on Release, Cleanup and Handoff Fixes #4039 with constructed inputs, the maintainer kept them, and each fix fails closed in a few lines.A later local pass found that the new
install.shtest's skip condition carried a redundantos.namecheck. That is fixed in this PR.Pre-existing findings, not filed
host-setup/agent-safety/claude/install.ps1, the Windows twin ofinstall.sh, which this PR does not touch, choosespy -3orpython3without running a version probe. Apython3app execution alias would be picked and would then fail loudly throughexit $LASTEXITCODErather than fall through to the next candidate.install.pystill enforces the 3.11 floor on its own.Closes on promotion: none
🤖 Generated with Claude Code
Summary by CodeRabbit