Repository navigation
fix(spawn): require a proven worktree root before ending the treehouse poll - #26
Merged
Merged
Conversation
…e poll The worktree-detection poll after `treehouse get` accepted the first pane cwd sample that merely differed from the project path. On herdr that can be an intermediate cwd (the treehouse pool root) sampled while the subshell is still resolving, so validate_spawn_worktree then refused with "worktree root 'none'" even though the pane reached a real worktree moments later. Now a sample is only accepted once `git rev-parse --show-toplevel` confirms it IS a worktree root; the poll otherwise keeps trying until the existing 60s deadline.
fm-spawn.sh's worktree-detection poll now only accepts a sample once git rev-parse --show-toplevel proves it a real worktree root, so a pane that never leaves a non-worktree path polls the full deadline and hits the "did not enter a worktree within 60s" timeout instead of the immediate validate_spawn_worktree message these cases used to hit. Update the two abort assertions to match and stub sleep so the test doesn't cost 60 real seconds per case.
This was referenced Jul 24, 2026
Bre77
added a commit
that referenced
this pull request
Jul 29, 2026
The Stage-7 alert-router cutover moved fm.ba.id.au off this repo's own listener, so every inbound Twilio webhook was 401'd. Teslemetry/tools PR #26 made the router relay /captain-msg verbatim into the existing inbox dir instead of validating it; this teaches the poll path to validate and normalize (or quarantine) that shape, sharing one HMAC implementation with the direct-listener path via a new fm_twilio_sig.py module.
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
bin/fm-spawn.sh's post-treehouse getworktree-detection poll accepted the FIRST pane cwd sample that merely differed from the project path, then handed it tovalidate_spawn_worktree. Reproduced live today (2026-07-22): on the herdr backend that first differing sample can be an intermediate cwd - the treehouse pool root (/home/brett/.treehouse) - captured while the subshell is still resolving, so the spawn refused withworktree root 'none'even though the pane landed in a valid worktree slot moments later. Failed 3 consecutive spawns on the api pool and 1 on the homey pool in the same session; other spawns in the same window won the race and succeeded, confirming it's timing-dependent rather than a hard failure.Fix: only accept a sampled path once it proves out as an actual worktree root - it must differ from the project AND
git -C <path> rev-parse --show-toplevelmust resolve back to that same path. Otherwise the poll keeps trying until the existing 60s deadline, and the existing timeout error message is unchanged.Also updated
tests/fm-tangle-guard.test.sh's spawn-abort case: a pane that never leaves a non-worktree path now correctly polls the full deadline and hits the timeout error, not the old immediatevalidate_spawn_worktreemessage (which is no longer reachable via this path since a worktree is only ever accepted once already proven).Testing
bin/fm-lint.sh(clean, pinned ShellCheck 0.11.0) and the fulltests/*.test.shsuite (1554 assertions passing), including the two newfm-backend.test.shregression cases (an intermediate non-worktree sample followed by the real worktree still succeeds; all-non-worktree samples for the full poll window still fail with the existing timeout error) and the updatedfm-tangle-guard.test.shcase. One unrelated, pre-existing flaky failure infm-afk-launch.test.sh("launcher signal: interrupted lifecycle resumed or retained its lock") was independently reproduced on unmodifiedmain(fails ~2/3 of runs) and is untouched by this change.