fix(bin): handle dash-leading harness commands portably - #1263
Open
harsh9200 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Fix firstmate's recurring macOS Claude Stop-hook wake noise caused when BSD basename interprets a login-shell command such as -zsh as an option. Reproduce the stderr failure first, then make every process-command extraction in the session-lock and harness detection composition portable without adding GNU coreutils, using pure-shell suffix extraction. Sweep bin/ for the same basename or dirname GNU-flag portability class, including bin/fm-harness.sh detect_own, add or extend colocated regression coverage proving the Stop auto-arm stale-owner path and harness detection emit no stderr under BSD basename semantics, and keep touched shell scripts ShellCheck-clean. Limit the change to this portability fix and its focused tests.
What Changed
basenameprocess-command parsing with portable shell suffix extraction in harness detection and session-lock ancestry/liveness checks, preventing BSDbasenameerrors for commands such as-zsh.Risk Assessment
✅ Low: Captain, the change is narrowly scoped, preserves command-name extraction semantics, removes BSD basename option parsing from all identified process-command paths, and adds focused regression coverage for both affected flows.
Testing
Reproduced the native and base-commit BSD stderr leak first, then verified the target harness emits no stderr and manually exercised stale-owner Stop auto-arm through lock reclamation to a clean persisted epoch. Both focused automated suites completed successfully, evidence transcripts were preserved, and the worktree remained clean. ShellCheck/static analysis was not run because this testing step explicitly prohibited it; no visual artifact applies to this silent shell-hook/CLI change.
Evidence: BSD failure reproduction
Native macOSbasename -zshexited 1 with the BSD illegal-option diagnostic.Evidence: Base-to-target harness comparison
Base commit leaked 108 stderr bytes forcomm=-zsh; the target returnedunknownwith zero stderr.Evidence: Stale `-zsh` Stop-hook evidence
The manual Stop-hook flow exited silently, reclaimed the stale lock, executed auto-arm, and recorded a clean epoch.Evidence: Focused Stop auto-arm tests
Focused regression transcript covering BSD basename semantics and stale-owner Stop auto-arm behavior.Evidence: Harness regression tests
Surrounding harness-resolution and launch compatibility regression transcript.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
basename -zshusing native macOS BSD basenameBase-commitbin/fm-harness.shfrom99533c5dwith an exportedpsprobe returningcomm=-zshTargetbin/fm-harness.shwith the samecomm=-zshprobebin/fm-test-run.sh tests/fm-claude-stop-autoarm.test.shManual Claude Stop-hook stale-owner flow usingcomm=-zsh, a BSD-failing basename shim, and persisted lock/arm/epoch inspectionbin/fm-test-run.sh tests/fm-secondmate-harness.test.shrgsweep ofbin/**/*.shfor GNU-style basename/dirname options and process-command extraction sitesgit status --short --untracked-files=all✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.