fix(bin): resolve relative homes before persisting paths - #3
Merged
Conversation
Resolve relative home, data, and state inputs before durable charter generation, and fail when caller-relative directories cannot be resolved. Use absolute paths at the related spawn, AFK daemon, and X-mode cross-process handoffs so later processes cannot reinterpret them from another working directory.
… path normalization
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
Prevent relative
FM_HOME,FM_STATE_OVERRIDE, andFM_DATA_OVERRIDEvalues from baking unresolvable durable paths into generated charters or cross-process state, while preserving absolute path spellings unchanged.What Changed
FM_HOME,FM_STATE_OVERRIDE, andFM_DATA_OVERRIDEvalues before generating briefs, launching agents, starting AFK mode, or persisting X-mode poll shims.CDPATH, and report named errors when relative directories cannot be resolved.Risk Assessment
✅ Low: The change is well-bounded, and the corrective commit closes the prior CDPATH path-redirection defect at every affected normalization boundary with focused competing-directory coverage.
Testing
At exact target
2fb2366over base488cbf7, four focused path-consumer test scripts passed; a retained CLI transcript demonstrates relative-home charter generation, absolute parent-status routing, persisted correlated output, and fail-loud invalid input, with the worktree left clean.Evidence: Relative secondmate CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-brief.sh:75- Relative-path normalization inheritsCDPATH. With an exported value such asCDPATH=.:..,cd "$path"can print its destination into the command substitution, producing a multi-line path; it can also select a same-named directory outside the caller's working directory. That corrupts the durable status/launch path this change is intended to fix. ClearCDPATHand usecd -- "$path"at this boundary and the equivalent sites infm-spawn.sh,fm-afk-launch.sh, andfm-bootstrap.sh. Add a regression case with non-emptyCDPATH.🔧 Fix: Ignore inherited CDPATH during relative path normalization
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspectedgit diff 488cbf7804ab3f6b0625941df66f4df2fc869e02..2fb236610d879c34f1c66ecb36ac2615bf7834afand verified exact HEAD/base ancestrybash tests/fm-brief.test.shbash tests/fm-spawn-dispatch-profile.test.shbash tests/fm-afk-launch.test.shbash tests/fm-x-mode.test.shGenerated a secondmate charter using relativeFM_HOME=homewith a conflictingCDPATH, verified its absolutestate/routing-sm.statusroute, appended and read back a correlated completion event, then verified missing relativeFM_HOMEexits 1 with a named diagnosticVerifiedgit status --shortremained empty after testing✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Fix empty CDPATH assignments for ShellCheck
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.