fix(spawn): resume recorded worktree on ship relaunch - #122
Merged
Conversation
…profile restoration
…ed recorded harness and a journaled Herdr endpoint fail with the explicit unsafe-recovery refusal before unknown-harness handling. bash -n, shellcheck, and the Herdr presentation regression reached the restart-recovery pass
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
Fix bin/fm-spawn.sh so ship --relaunch resumes the exact recorded worktree and endpoint across supported backends, preserves WIP, restores recorded harness/model/effort when flags are omitted, requires no project positional, and refuses unsupported raw or unsafe relaunches instead of allocating fresh worktrees. Keep secondmate and normal spawn behavior unchanged. Add executable regression tests and maintainer-verification evidence. Firstmate-Validation-Generation: def2aecdd97439865a03f8929121bed4
What Changed
bin/fm-spawn.shto relaunch from the recorded project, worktree, profile, and backend endpoint without requiring a project positional, preserving existing WIP and avoiding fresh worktree allocation.Risk Assessment
Testing
Ran the focused executable relaunch suite; all ship relaunch regression scenarios passed. A broader dispatch-profile suite was also started but did not complete within the targeted validation window and was terminated; no source or worktree artifacts were left behind.
Evidence: Focused ship relaunch regression output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (5) ✅
bin/fm-spawn.sh:3419- A tmux ship relaunch verifies only the pane cwd, then proceeds to sendGOTMPDIR, the launch command, and Enter to the recorded pane.fm_backend_tmux_current_pathis passive and does not prove the pane is an idle shell, so if the prior Codex/Claude process is still running while cwd remains the recorded worktree, these inputs are injected into the active harness and can corrupt or duplicate the task. Before any relaunch writes to a tmux endpoint, require the existingfm_backend_tmux_idle_foreground_shell_pidproof (or refuse).🔧 Fix: Require idle tmux shell before ship relaunch
1 error still open:
bin/fm-spawn.sh:3166- The Herdr presentation relaunch path does not preserve the recorded endpoint: when a projection journal is present,fm_backend_herdr_projection_reclaim_taskcreates a replacement tab/pane and lines 3174-3178 overwriteHERDR_TAB_ID/HERDR_PANE_IDwith the new IDs. This contradicts the required “ship --relaunch resumes the exact recorded worktree and endpoint across supported backends” and the prior decision to preserve the recorded Herdr session/pane binding or refuse loudly. The smallest remedy is to revert this replacement/reclaim behavior to an exact-binding check with refusal when recovery is not possible; changing the recovery contract needs authorization.🔧 Fix: Refuse Herdr relaunch endpoint replacement
1 warning still open:
docs/verification/spawn-relaunch.md:9- The maintainer-verification transcript is stale:tests/fm-spawn-worktree-settle.test.shnow emits the added active-tmux regression result (ok - a ship relaunch refuses an active tmux endpoint before sending input), but the output block at lines 9-17 omits it while presenting the transcript as complete. Update the evidence to match the current executable test output.🔧 Fix: Update relaunch verification transcript
1 error still open:
bin/fm-spawn.sh:2910-validate_spawn_worktreeonly checks thatWTis the root of some separate Git checkout and differs fromPROJ_ABS; it never verifies that the recorded path is a worktree belonging to the recorded project. A corrupted/stale metadata pair with project A and worktree B (an unrelated repository) therefore passes lines 2910-2915, and the relaunch can send the worker into B while rewriting the task metadata. Validate the worktree's Git common directory/git worktree listmembership against the recorded project before endpoint reuse.🔧 Fix: Validate relaunch worktree project ownership
1 warning still open:
docs/verification/spawn-relaunch.md:9- The maintainer-verification transcript is incomplete:tests/fm-spawn-worktree-settle.test.shnow emits the additionalok - a ship relaunch refuses a worktree from an unrelated repositoryresult, butdocs/verification/spawn-relaunch.mdomits it while presenting the output as complete. Update the evidence block to match the current executable test output.🔧 Fix: Update relaunch verification transcript
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
bash tests/fm-spawn-worktree-settle.test.shbash tests/fm-backend-herdr-presentation-e2e.test.sh(started; environment/tool timeout prevented complete transcript)bash tests/fm-spawn-dispatch-profile.test.sh(started; interrupted after environment hang)🔧 Fix: Added executable regression for recorded relaunch profile restoration
✅ Re-checked - no issues remain.
tests/fm-spawn-worktree-settle.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.