fix(spawn): acquire crew worktrees via treehouse get --lease - #324
Open
nbdSteve wants to merge 2 commits into
Open
fix(spawn): acquire crew worktrees via treehouse get --lease#324nbdSteve wants to merge 2 commits into
nbdSteve wants to merge 2 commits into
Conversation
treehouse v2.0.0's interactive `get` opens a subshell in the worktree whose
cwd tmux's #{pane_current_path} does not report, so fm-spawn's old
worktree-discovery poll timed out at 60s on every crewmate/scout spawn even
though the worktree was created. Switch to `treehouse get --lease` (path on
stdout, banners on stderr) - the same durable primitive fm-home-seed.sh
already uses for secondmate homes, and the mode bootstrap already requires -
then cd the pane into the leased worktree. Spawn drops from a 60s timeout to
~2s.
Also fix a numeric-session-name collision: when firstmate runs inside a tmux
session whose name is a plain integer, `new-window -t <n>` is parsed as a
window index, so a second task collides with 'index <n> in use'. Address the
session as '<session>:' to force session interpretation.
Update the fm-spawn/backend tests to the lease contract and add a regression
test proving spawn no longer depends on pane-cwd polling.
…e-and-forget A freshly created pane's shell can drop the first keystroke, so `cd <worktree>` arrives as `d <worktree>` and the pane never leaves the primary checkout - the agent then launches in the wrong directory. Read the pane cwd back and re-send `cd` (up to 30x, 0.5s apart) until it matches the worktree, comparing physically-resolved paths; abort with a clear error if it never lands. Re-adds the small spawn_current_path backend dispatcher for the read. Also make tests/fm-spawn-batch.test.sh hermetic: it used FM_CONFIG_OVERRIDE='' (the real config dir), so a live config/crew-dispatch.json tripped the explicit-harness backstop before the missing-brief check the test targets; point it at an empty config dir. Update the spawn/backend test tmux stubs to answer pane_current_path so the verify loop is exercised, and add a regression test proving a dropped first cd is retried until the pane enters the worktree.
Author
|
Follow-up commit (668a703): the post-lease |
This was referenced Jul 24, 2026
Closed
Closed
Closed
Closed
This was referenced Aug 1, 2026
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.
Problem
treehousev2.0.0's interactivetreehouse getopens a subshell inside the worktree ("Type 'exit' to return"). tmux's#{pane_current_path}does not report that subshell's cwd, sofm-spawn.sh's worktree-discovery poll never observed the pane leaving the project directory and timed out at 60s on every crewmate/scout spawn - even though the worktree was created successfully. This blocks all crewmate dispatch on the current treehouse release.Fix
Acquire the worktree via
treehouse get --leaseas a subprocess (path printed to stdout, banners to stderr), thencdthe pane into it. This is the same durable primitivefm-home-seed.shalready uses for secondmate homes, andfm-bootstrap.shalready requires--leasesupport - the crewmate/scout path was simply left on the old interactive approach. Spawn drops from a 60s timeout to ~2s.Also fixes a latent collision: when firstmate runs inside a tmux session whose name is a plain integer (e.g.
58),tmux new-window -t 58is parsed as a window index, so a second task fails withindex 58 in use. Addressing the session as<session>:forces session interpretation (correct for named sessions too).Tests
fm-spawn/backend tests to the lease contract (treehouse stub prints the worktree path onget --lease).Verified end-to-end: real crewmate spawns now complete in ~2s and launch into the leased worktree.