Repository navigation
fix(spawn): re-export PWD after worktree entry to prevent gate path failures - #192
briceparrott1 wants to merge 8 commits into
Conversation
|
Thanks for the PR! It looks like this branch has a merge conflict with the base branch right now. When you get a chance, could you rebase onto (or merge in) the latest base branch, resolve the conflict, and push? Once GitHub shows the PR as mergeable again, it'll be picked back up for review. Noted for firstmate#192 at |
5d269a8 to
46e2428
Compare
treehouse get's subshell reliably chdir()s the crewmate pane into its worktree but has been observed to leave $PWD stale, which every child process (including git push's post-receive hook chain) inherits verbatim. Re-export PWD from pwd -P, which forces physical resolution via getcwd() instead of trusting the possibly-stale env var.
…brief and AGENTS.md
… not raw tmux send-keys
…d with the PWD re-export fix and spawn/brief changes
…warnings on new PWD lines
…names in pwd-export test
… spawn-time command
46e2428 to
e6f9b59
Compare
|
Thanks for the PR! It looks like this branch has a merge conflict with the base branch right now. When you get a chance, could you rebase onto (or merge in) the latest base branch, resolve the conflict, and push? Once GitHub shows the PR as mergeable again, it'll be picked back up for review. Noted for firstmate#192 at |
|
Automated reminder: this PR still looks blocked on a rebase or merge conflict fix. If you are still interested, please rebase onto the current base branch, resolve the conflict, and push. If I do not hear back, I may close this as inactive. |
|
I am closing this because it has been waiting on a rebase or merge-conflict fix since 2026-07-06, and I have not seen a comment or push since then. If you still want to keep working on this, please reopen it or open a new PR and mention this one. Happy to take another look when there is an update. |
|
Fixed in Red evidence before the production root fix: Separate finding, not changed by this commit:
|
|
This comment was published to the wrong repository. Please disregard it. |
…unchenguid#192) * feat(desk-floater): smaller button, voice controls, hotkeys and dictation The floater's talk button is half its former size and sits beside four small controls: Stop talking, Repeat the last reply, Mute voice, and Type. Holding Right Option talks to Firstmate like holding the button; tapping Right Command, or clicking Type, starts and finishes dictation, which pastes the transcript into the focused text box and restores the clipboard, never touching Firstmate's mailbox. bin/fm-speak.sh gains --stop, --repeat, --mute, --unmute and --muted to back the voice controls. * no-mistakes(review): Treat mouse clicks during hotkeys as shortcut chords * no-mistakes(review): Skip concealed clipboard items; show muted status on Repeat * no-mistakes(ci): I fixed the failing "Declared fork surface" check. Its "Fail on changed source without test ownership" step stopped with `no changed-test mapping for source path: desk-floater/Sources/DeskFloater.swift`. **Cause:** PR kunchenguid#155 added a rule in `bin/fm-test-run.sh` that sent `desk-floater/Package.swift` and `desk-floater/Sources/*` to `tests/fm-deepgram-desk.test.sh`. The re-base in kunchenguid#160 (70082c3) removed that rule. Since then, test ownership for fork-only paths has been declared in `tests/fork-test-registry.conf`, but nobody moved the floater rule there. No test mentions the Swift sources by name, so the runner's fallback search finds no owner either. This PR is the first change to `DeskFloater.swift` since the re-base, so it is the first to hit the gap. **Fix** (two files, not yet committed): - `tests/fork-test-registry.conf`: added `covers` rows so that `desk-floater/Package.swift` and `desk-floater/Sources/*` both map to `tests/fm-deepgram-desk.test.sh`. That is the same owner as before, now declared where fork paths belong. - `fork-surface.conf`: added `modifies = tests/fork-test-registry.conf` to the `desk-floater-voice` capability, since the capability now edits that file. **Checks run locally:** - `bin/fm-fork-surface.sh check` passes: `FORK_SURFACE OK capabilities=76 owned_paths=232`. - `bin/fm-test-run.sh --list --changed --base 62182cb…` now exits 0 and includes `tests/fm-deepgram-desk.test.sh`. The CI log is the before case: that same command stopped with exit code 2. - `tests/fm-deepgram-desk.test.sh`, `tests/fm-fork-surface.test.sh` and `tests/fm-test-run.test.sh` all pass. The last one checks the registry's no-shadow rules. **Not handled:** "Behavior portable parallel 1" was cancelled without a result. It still needs a decision from you, not a code fix * fix(desk-floater): turn hotkeys back on after a rebuild macOS ties the floater's Accessibility grant to the exact build, so every rebuild left Right Option and Right Command silently off: the floater only ever asked for the permission once, and the only sign was a small "(keys off)" label. It now asks once per build, shows an orange ! badge and an orange status line while keys are off, and the badge asks again and opens the Accessibility settings.
Intent
The developer directed a crewmate agent to fix a firstmate bug where crewmate shells inherited a broken $PWD="." environment variable from treehouse's worktree-entry chain, causing the no-mistakes gate's post-receive hook to fail with "invalid gate path: .". Requirements: confirm the bug empirically, add a minimal, targeted re-export of PWD (via pwd -P) in bin/fm-spawn.sh right after worktree entry for ship/scout launches (not necessarily secondmates), add a matching bash-style test following existing test conventions, and document the diagnosis/rationale in AGENTS.md, without touching the external no-mistakes tool or treehouse binary. After discovering mid-session PWD corruption could recur beyond spawn time, the developer explicitly asked for the fix to be strengthened by also having bin/fm-brief.sh instruct crewmates to re-export PWD immediately before any git push to a no-mistakes gate, with that limitation likewise noted in AGENTS.md. The developer also gave explicit unblocking instructions for a wedged no-mistakes run (re-export PWD, delete-and-repush the branch) and, once genuinely confirmed by a 403 error, directed the agent to push to the captain's own fork (briceparrott1/firstmate) and open the PR from there since the agent lacked direct write access to the upstream template repo (kunchenguid/firstmate).
What Changed
bin/fm-spawn.shre-exportsPWD="$(pwd -P)"right after the isolation guard passes for ship/scout launches, fixing a stale$PWD="."inherited from treehouse's worktree-entry chain that broke the no-mistakes gate'spost-receivehook withinvalid gate path: ..bin/fm-brief.shadds mid-session guidance instructing crewmates to re-runexport PWD="$(pwd -P)"immediately before any push to the no-mistakes gate, since the corruption can recur later in a long-lived session, not just at spawn time.bin/backends/tmux.shandbin/backends/herdr.share updated to route the PWD re-export command through each backend's own send/exec abstraction rather than a raw call.AGENTS.md,docs/architecture.md,docs/scripts.md, anddocs/herdr-backend.mddocument the diagnosis and the PWD re-export as a fixed spawn-time (and pre-push) command.tests/fm-spawn-pwd-export.test.sh(new) andtests/fm-backend.test.shcover the re-export behavior against the backend abstraction.Risk Assessment
✅ Low: The change is a small, well-scoped defensive re-export of PWD mirroring the existing GOTMPDIR pattern, correctly guarded to non-secondmate launches and routed through the existing backend abstraction (tmux/herdr) rather than raw send-keys; the brief/AGENTS.md/docs updates and the incidental empty-array quoting fix in fm-pr-merge.sh/fm-spawn.sh (needed for bash 3.2 compatibility under set -u) are all consistent and verified, and the accompanying test, while structural rather than behavioral, matches the repo's established test conventions (e.g. fm-gotmp.test.sh).
Testing
Ran the full baseline test suite (all tests/*.test.sh, tmux 3.7 present) which passed cleanly, then specifically re-ran tests/fm-spawn-pwd-export.test.sh (new structural test asserting the PWD re-export is present, correctly ordered between GOTMPDIR and launch, and scoped to non-secondmate) and tests/fm-backend.test.sh (updated conformance test verifying the real tmux command log fm-spawn.sh produces now includes the PWD re-export send at the right point) — both passed. Because the structural tests only assert the source contains the right lines, I additionally drove a real tmux session (the actual mechanism fm-spawn.sh uses) reproducing the documented bug: simulated a pane whose real cwd is correct but whose $PWD env var is stale ("PWD=.", matching the "invalid gate path: ." failure), confirming a child process inherits the broken value, then sent the exact line bin/fm-spawn.sh now sends (
export PWD=\"$(pwd -P)\") and confirmed the pane's PWD env var and any child process's inherited PWD are corrected to the real absolute path. This end-to-end tmux transcript is stronger evidence than the unit tests alone since it exercises the real send-keys mechanism and the real bug/fix behavior. Overall result: fix behaves as intended, no issues found.Evidence: tmux transcript reproducing the stale-$PWD bug and confirming the fix
BEFORE_FIX_ENV: PWD=. child-inherited-PWD=. (after sending the exact line bin/fm-spawn.sh now sends into the pane) AFTER_FIX_ENV: PWD=/private/tmp/fm-pwd-evidence-test/worktree-real child-inherited-PWD=/private/tmp/fm-pwd-evidence-test/worktree-realPipeline
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.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"command -v tmux >/dev/null; for t in tests/*.test.sh; do bash "$t"; done (baseline, all passing)bash tests/fm-spawn-pwd-export.test.shbash tests/fm-backend.test.shmanual tmux session: reproduced stale PWD=. bug, confirmed child process inherits broken PWD, applied the exact fm-spawn.sh PWD re-export line via tmux send-keys, confirmed PWD env var and child-inherited PWD corrected to the real physical path✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.