Repository navigation
fix: use durable spawn leases and repair test fixtures - #53
Merged
Merged
Conversation
Ordinary fresh spawns after the upstream integration were typing `treehouse get` into the pane. A fake or a slow shell never runs that command, so the task published with no lease identity, and several spawn tests failed on main. The same integration split wake and classify helpers into sibling libraries that the failing fixtures never copied. Fresh non-orca, non-secondmate spawns now take the journaled lease t3code already uses, move the pane into that copy, and claim the slot before launch. Herdr uses that lease, and a clean abort returns it by lease identity. An old Treehouse CLI is refused before any endpoint exists. t3code still probes after its own policy checks. The shared test fake prints a bare path from `treehouse get` unless `--json` is passed, which is the real contract. Callers that want the lease object already pass `--json`. Fixtures that failed because a copied script sourced a missing sibling now copy fm-treehouse-slot-lib.sh, fm-wake-surface-lib.sh, or fm-classify-close-lib.sh, and only those fixtures. Left unchanged, with the evidence: - fm-supervision-instructions.test.sh passes on this base. The missing phrase in PR 48's parallel shard is that pull request's own text. - No resource-sweep test in the open-PR failure logs expects an 8s job-state timeout. - fm-remote-secondmate-lifecycle-e2e.test.sh failed on main's last Actions run (42228401006, serial 7) and is not in the current open-PR failure list. - One turn-end attended-alarm run reported the final rewake zero times while other suites ran beside it. The same case alone, then the full file, passed with no further edit.
…lease slots, replaced Kiro’s no-op allocator, and supplied matching homes for Herdr teardown. Five targeted behavioral suites, changed-file lint, and diff checks pass. Real-Herdr E2Es remain unverified because their invocation paths conflict with the required helper-only restriction. Production code is unchanged
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
Q1969 y: start one job that fixes only the broken tests on firstmate main, ending in one PR for a merge word; after that the 5 open firstmate PRs rerun their checks.
Context: GitHub Actions was re-enabled on peterOC26/firstmate on 2026-11-09. All five open firstmate PRs (47, 48, 49, 50, 51) fail the same CI jobs in tests they do not touch: "Behavior portable serial" lanes 2, 3 and 5-12, often "Behavior tests (Herdr)", and "Full suite". Main itself last ran CI on 2026-11-06 (merge #44, run 42228401006), which already failed "Behavior portable serial 7"; the upstream integration merge #45 (5d6b207) then landed while Actions was disabled, so main has never been tested since. Known pieces reported by workers: tests/fm-pi-branch-extension.test.sh broken-branch settlement fixture fails on plain main with "supervision session no longer owns the fleet lock" (and earlier with a missing fm-treehouse-slot-lib.sh / wake-surface library in its copied fixture); tests/fm-remote-backlog-handoff.test.sh fixture misses fm-treehouse-slot-lib.sh; polytoken recovery identity (CI job 129031621921 on PR 50); spawn reservation (job 129031622013 on PR 50); the resource-sweep test file expects an 8 s job-state timeout while the tool uses 15 s, and carries superseded fixtures.
What Changed
CI failures and fixes
Live coverage was tmux and Herdr only.
The product change is the Treehouse slot lease restore in
bin/fm-spawn.sh.Fresh non-Orca spawns lease a slot durably again, move the pane into that copy, and claim the slot.
tests/fm-spawn-slot-ownership.test.shproves main regressed: an old Treehouse CLI is refused before any endpoint exists, and the durable reservation survives that refusal.These are the failing tests from the open pull requests, with the cause and the fix:
tests/fm-afk-return.test.shfailed because the fixture copy omittedfm-treehouse-slot-lib.shandfm-wake-surface-lib.sh. The copy includes them now.tests/fm-spawn-herdr-lease.test.shfailed because the faketreehouse getprinted a JSON object as the worktree path. The fake prints a bare path unless--jsonis passed, and Herdr takes the journaled lease.tests/fm-gotmp.test.shfailed because its fixture links omitted the sibling libraries added in the upstream integration. Those links are present now.tests/fm-polytoken-harness.test.shfailed its recovery-identity case because a fresh spawn no longer recorded a lease. The restored lease keeps the slot claim.tests/fm-claude-stop-autoarm.test.shfailed because the fixture copy omittedfm-treehouse-slot-lib.sh,fm-wake-surface-lib.sh, andfm-classify-close-lib.sh. The copy includes them now.tests/fm-remote-transport-lanes.test.shfailed because the fixture copy omittedfm-classify-close-lib.sh. The copy includes it now.tests/fm-spawn-pool-base-freshen.test.shfailed the unclaimable-slot case because the general path no longer leased before the claim check. The restored lease refuses a slot that already has a claim.tests/fm-turnend-guard.test.shfailed because the fixture copy omittedfm-treehouse-slot-lib.shandfm-wake-surface-lib.sh. The copy includes them now. One attended-alarm run reported the final rewake zero times while other suites ran beside it, then the same case and the full file passed with no further edit.tests/fm-remote-backlog-handoff.test.shfailed because the fixture copy omittedfm-treehouse-slot-lib.sh. The copy includes it now.tests/fm-spawn-dispatch-profile.test.shfailed the Ultra batch because the pane was not moved into the leased copy. The restored path enters that copy.tests/fm-trace-context-spawn.test.shfailed its relaunch reservation because the spawn path no longer held the durable lease. The restored lease keeps it.tests/fm-pi-branch-extension.test.shfailed broken-branch settlement because the copied scripts sourced sibling libraries that were not in the fixture. The copy includesfm-classify-close-lib.sh,fm-treehouse-slot-lib.sh, andfm-wake-surface-lib.sh.The review fix makes an empty journaled allocation print
durable Treehouse acquisition did not report a worktree, removes the fake abort journals intests/fm-backend-herdr-presentation-e2e.test.sh, and points a failed Herdr spawn at the journal recovery steps.The phrase "stays leased to" is unchanged.
Left unchanged:
tests/fm-supervision-instructions.test.shpasses on this base. The missing phrase in PR 48 is that pull request's own text.tests/fm-remote-secondmate-lifecycle-e2e.test.shfailed on main's last Actions run (42228401006, serial 7) and is not in the current open-PR failure list.CI rerun fixes
The first check run on this pull request failed five jobs. The follow-up commit changes only fixtures. Production code is unchanged.
tests/fm-cortex-harness.test.shrefused the xhigh spawn because the allocated copy already carried a slot claim. The fixture now isolates that lease slot.tests/fm-kiro-harness.test.shstopped the listed-model spawn because its fake Treehouse did not offer durable leases. The fixture now uses an allocator that does.tests/fm-hermes-harness.test.shexpectedHermes did not reach its TUIfor the stalled launch, and the fake Treehouse returnedalready leased. The fixture now isolates that lease slot.tests/fm-backend-herdr-launcher-workspace-e2e.test.shcould not tear downdupC, andtests/fm-backend-herdr-workspace-per-home-e2e.test.shcould not tear downcm1. Both stopped onlease and slot claim contradict each other. The fixtures now supply a matching home for teardown.Risk Assessment
Testing
Targeted regressions and real tmux/Herdr lifecycle checks passed after one test-wrapper fix and correction of probe setup and fixture-location refusals. CLI transcripts and backend snapshots were captured, temporary worktree fixtures were removed, and Herdr teardown verified the default-session tripwire. Fixture-based checks do not establish live results for scenarios 3–5. Optional backend live coverage remains unavailable; broad CI and delivery remain with the outer executor.
tests/fm-backend-herdr-presentation-e2e.test.sh; Real Herdr workspace and pane stateEvidence: Real tmux lease lifecycle transcript
Source: Real tmux lease lifecycle transcript
Evidence: Real Herdr workspace and pane state
Source: Real Herdr workspace and pane state
Evidence: Abort diagnostic before fixture fix
Source: Abort diagnostic before fixture fix
Evidence: Correct acquisition error and journal recovery instructions
Source: Correct acquisition error and journal recovery instructions
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-backend-herdr-presentation-e2e.test.sh:950- This change moves Herdr onto the journaled lease helper, but the required real-Herdr E2E still expects the old non-journaled flow. Here is how it fails. The test arms an abort with a faketreehouse getthat exits 0 with no output (tests/fm-backend-herdr-presentation-e2e.test.sh:254-257). Before this change,spawn_lease_herdr_slotprinted "treehouse get --lease did not report a worktree". Now it callsspawn_lease_treehouse_slot(bin/fm-spawn.sh:5474). That helper creates state/abort-{a,b}.treehouse-acquire and gets an empty allocation.json. It then exits silently at theWT=$(jq -er ...) || exit 1step (bin/fm-treehouse-slot-lib.sh:367). As a result the greps at lines 950 and 952 fail. Even past that point, the comment at line 982 ("writes no acquisition journal") is now false. Both journals are left behind for PROJECT_DIR, andfm_treehouse_records_reservedrefuses every later spawn in that project with "unresolved Treehouse acquisition journal" (bin/fm-treehouse-slot-lib.sh:233-236). That breaks spawns at lines 1025, 1140-1150 and 1200. The Herdr lane runs this script ('Behavior tests (Herdr)', real-herdr-gated family), and that is one of the jobs this change is meant to turn green. Fix: (a) havespawn_lease_treehouse_slotprint an explicit error when allocation.json has no usable path, for example "durable Treehouse acquisition did not report a worktree", and update the grep to match it; (b) after the armed aborts, remove$HOME_DIR/state/abort-{a,b}.treehouse-acquire, since the fake took no pool slot; (c) fix the comments at lines 523 and 982-983, which still say Herdr writes no JSON journal.bin/fm-spawn.sh:1999- Herdr's failed-spawn warning still tells the operator to runtreehouse return --force $WT. Herdr now leases through the acquisition journal, sospawn_abort_retain_treehouse_journalprints different recovery steps right after it: a conditional return with--if-lease-id/--if-lease-holder, then removal of the claim and the journal. Example: a dirty-copy Herdr abort prints the old hint, and the operator runs only that bare return. The lease is released, but state/<id>.treehouse-acquire and .fm-slot-owner stay. From then on,fm_treehouse_records_reserved(bin/fm-treehouse-slot-lib.sh:237-241) failsfm_treehouse_lease_matchesfor that journal, so every later spawn in the project refuses until someone repairs it by hand. Following the printed instruction leaves the project unable to spawn. Fix: keep the 'stays leased to $ID' text that tests/fm-spawn-herdr-lease.test.sh asserts, and replace the bare--forcehint with 'follow the journal recovery steps below', as the t3code abort messages do (bin/fm-spawn.sh:1880, 1892, 1923, 1926).bin/fm-spawn.sh:6018- This test-fix change also changes production behavior. Fresh tmux, zellij, cmux, paseo, rex, tern and hc ship/scout spawns now take a durable journaled lease instead of typingtreehouse getinto the pane. An aborted non-Herdr/t3code spawn therefore keeps its lease and journal until someone recovers it by hand, and a same-id retry refuses until then. Git history supports this as a restoration rather than new scope: fix: reserve Treehouse pool copies until explicit task cleanup #32 (3fa9940) introduced exactly this path, the feat: integrate upstream runtime and supervision improvements #45 merge reverted it, and the spawn header contract (bin/fm-spawn.sh:145-147, 222-240, 355-360) and the Herdr unit tests already describe it. Noted only so the merge approver knows the PR changes runtime spawn behavior.🔧 Fix applied.
1 info still open:
bin/fm-spawn.sh:6018- This test-fix change also changes production behavior. Fresh tmux, zellij, cmux, paseo, rex, tern and hc ship/scout spawns now take a durable journaled lease instead of typingtreehouse getinto the pane. An aborted non-Herdr/t3code spawn therefore keeps its lease and journal until someone recovers it by hand, and a same-id retry refuses until then. Git history supports this as a restoration rather than new scope: fix: reserve Treehouse pool copies until explicit task cleanup #32 (3fa9940) introduced exactly this path, the feat: integrate upstream runtime and supervision improvements #45 merge reverted it, and the spawn header contract (bin/fm-spawn.sh:145-147, 222-240, 355-360) and the Herdr unit tests already describe it. Noted only so the merge approver knows the PR changes runtime spawn behavior.tests/fm-backend-herdr-presentation-e2e.test.sh; Real Herdr workspace and pane statebash tests/fm-afk-return.test.shbash tests/fm-claude-stop-autoarm.test.shbash tests/fm-gotmp.test.shbash tests/fm-pi-branch-extension.test.shbash tests/fm-remote-backlog-handoff.test.shbash tests/fm-remote-transport-lanes.test.shbash tests/fm-turnend-guard.test.shbash tests/fm-spawn-slot-ownership.test.sh— rerun with TMPDIR=/tmp after an in-repository fixture-location refusalbash tests/fm-spawn-worktree-settle.test.shbash tests/fm-spawn-herdr-lease.test.shbash tests/fm-polytoken-harness.test.shbash tests/fm-backend-herdr-presentation-e2e.test.sh— reproduced the capability-probe failure, fixed the wrapper, and completed with TMPDIR=/tmp, a worktree-local Treehouse pool, and guarded lab teardownManual private-tmux scout lifecycle: inspect metadata, journal, pane cwd, lease persistence, duplicate refusal, and guarded cleanupbin/fm-herdr-lab.sh run <owned-lab-session> workspace listandpane listChecked optional backend executables withcommand -v; removed transient worktree fixtures and verified the remaining diff✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.