fix(bin): lease and refresh the task copy before any worker shell enters it - #3529
Open
rahul2393 wants to merge 6 commits into
Open
fix(bin): lease and refresh the task copy before any worker shell enters it#3529rahul2393 wants to merge 6 commits into
rahul2393 wants to merge 6 commits into
Conversation
…ers it fm-spawn.sh created the task pane, typed `treehouse get` into it, and only then refreshed the copy. The new shell's git prompt and the refresh both took the worktree's index.lock under the shared .git/worktrees/, so on a large repository the refresh was refused and the spawn failed every time. Spawn now leases the copy from its own process with `treehouse get --lease`, refreshes it with no shell inside, and creates the pane already in that path on every session-provider backend (tmux, herdr, zellij, cmux). A refusal before any create call returns a clean lease to the pool; from the first create call on the lease is retained and reported, because `treehouse return` terminates every process still in the copy. A fresh spawn whose record still names a copy (a quarantined Herdr recovery) refreshes that copy instead of leasing another, and refuses when its HEAD holds commits no remote has. A reclaimed Herdr pane is sent one plain `cd` into the copy after the refresh. fm-teardown.sh closes the endpoint before its worktree process reap and the copy's return, since both would now kill the pane's own shell and skip the planned focus-preserving Herdr close. The presentation e2e audits the emptying-close plan's pane-death removal and asserts copy reuse on reclaim.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking defects identified. The changed spawn and teardown paths preserve worktree safety checks, lease ownership, recovery identity, endpoint confirmation, and retryable durable state across the investigated failure paths. Reviews (1): Last reviewed commit: "no-mistakes(document): Correct refresh-b..." | Re-trigger Greptile |
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.
Summary
bin/fm-spawn.shcreated the task pane, typedtreehouse getinto it, and only then refreshed the pooled copy. The new shell's git prompt and the refresh both took the worktree'sindex.lockunder the shared.git/worktrees/, so on a large repository (google-cloud-java) the refresh was refused and every Herdr spawn failed.Spawn now leases the copy from its own process with
treehouse get --lease, refreshes it with no shell inside, and creates the pane already in that path on every session-provider backend (tmux, herdr, zellij, cmux). Orca owns its own worktree and is untouched.Behavior
treehouse returnterminates every process still in the copy.cdinto the copy after it.bin/fm-teardown.shconcludes the task's parked run and closes the endpoint before the cwd-rooted process reap and the copy'streehouse return, so the planned focus-preserving Herdr close still runs. The tmux process-group fallback binds a captured PGID to member identities before signalling. Teardown still returns the lease.Tests
tests/fm-spawn-lease-before-enter.test.sh: refresh completes before any pane exists; a simulated paneindex.lockcannot refuse a clean copy (divergence asserted); clean-lease return, retained lease after create began, dirty copy untouched, unusable lease path, and recovery-identity refusals.tests/fm-backend-herdr-presentation-e2e.test.shaudits the real pane removal and focus transition, arms the post-create abort on the settle read, and asserts copy reuse on reclaim.tests/lib.sh.bin/fm-lint.shpasses.