fix(bin): handle dash-leading harness process names - #2
Merged
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 the macOS guard-path noise caused by BSD basename treating dash-leading process command names from ps as options. On current main at 99533c5, make every equivalent ps-derived basename operand in bin/fm-harness.sh and the shared session-lock ancestry/liveness helpers use an explicit option terminator so a login-shell command name such as literal -zsh is treated as data, preserving existing harness detection semantics. Survey bin/ for comparable basename, dirname, or similar calls that can receive dash-leading values from ps, Git, or user paths; fix direct equivalents and report broader unrelated CLI-path cases rather than expanding this patch. Add a regression test that fails on the unfixed macOS code with literal -zsh-style input, keep the diff proportionate, target the pull request at main on the origin repository, use attribution-neutral wording in the PR, and do not merge.
What Changed
ps-derived command names as literalbasenameoperands in harness detection and shared session-lock ancestry/liveness, preventing BSDbasenameoption noise for dash-leading names while preserving existing matching behavior.-zshancestry and-codexliveness, clearing ambient harness markers so the test exercises process traversal.Risk Assessment
✅ Low: The fix is narrowly scoped, covers all three direct ps-derived basename operands, preserves existing detection semantics, and the regression now hermetically exercises literal dash-leading process names.
Testing
The supplied diff and focused test file passed, and a macOS CLI transcript directly demonstrates the original BSD
basenamefailure and corrected--behavior. This is a CLI-only change, so no screenshot or rendered UI artifact applies.Evidence: macOS dash-leading basename CLI transcript
macOS BSDbasename -zshexits 1 with “illegal option -- z”;basename -- -zshexits 0 and outputs-zsh. The end-to-end regression reports: “ok - harness identity: dash-leading ps command names are basename operands, not options”.Evidence: Focused harness and session-lock test log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
tests/fm-secondmate-harness.test.sh:221- This regression is not isolated from supported harness markers. If the suite is launched withCLAUDECODE=1,PI_CODING_AGENT=true, orGROK_AGENT=1,fm-harness.shreturns from environment detection before consulting the fakeps, so the expectedcodexassertion can fail without exercising the fix. Clear all three markers for this invocation, as other harness-sensitive tests do.🔧 Fix: Make dash-leading harness regression hermetic
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspectedgit diff 99533c5d7d3702050e6084429dddff6ea4fe1aa0..4a690389c077104828d240cad9ec5a7794fdffc3 -- bin/fm-harness.sh bin/fm-session-lock-lib.sh tests/fm-secondmate-harness.test.sh.Rangit diff --check 99533c5d7d3702050e6084429dddff6ea4fe1aa0..4a690389c077104828d240cad9ec5a7794fdffc3.Ran./tests/fm-secondmate-harness.test.sh; the focused regression exercised literal-zshharness traversal, session-lock ancestry, literal-codexliveness, and absence of stderr option noise.Ran/usr/bin/basename -zshand/usr/bin/basename -- -zshon macOS to capture the unfixed BSD failure and corrected operand behavior.Surveyedbin/withrgforps-derived command names and relatedbasename/dirnamecalls; all three directps-derived basename operands use--, while broader user-path cases remain outside this patch.Verified finalgit status --short --branch, exactHEAD, evidence files, and cleanup state.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.