Skip to content

fix: use durable spawn leases and repair test fixtures - #53

Merged
peterOC26 merged 4 commits into
mainfrom
fm/fm-main-ci-red-fix-m1
Nov 9, 2026
Merged

peterOC26 merged 4 commits into
mainfrom
fm/fm-main-ci-red-fix-m1

Conversation

@peterOC26

@peterOC26 peterOC26 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

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

  • Use journaled Treehouse leases for non-Orca ship and scout spawns, verify placement in the leased copy, and refuse conflicting slot claims.
  • Restore missing test fixture dependencies, correct fake Treehouse output formats, and update Herdr abort fixtures for acquisition journals.
  • Update backend documentation to describe the shared worktree allocation contract.

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.sh proves 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.sh failed because the fixture copy omitted fm-treehouse-slot-lib.sh and fm-wake-surface-lib.sh. The copy includes them now.
  • tests/fm-spawn-herdr-lease.test.sh failed because the fake treehouse get printed a JSON object as the worktree path. The fake prints a bare path unless --json is passed, and Herdr takes the journaled lease.
  • tests/fm-gotmp.test.sh failed because its fixture links omitted the sibling libraries added in the upstream integration. Those links are present now.
  • tests/fm-polytoken-harness.test.sh failed 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.sh failed because the fixture copy omitted fm-treehouse-slot-lib.sh, fm-wake-surface-lib.sh, and fm-classify-close-lib.sh. The copy includes them now.
  • tests/fm-remote-transport-lanes.test.sh failed because the fixture copy omitted fm-classify-close-lib.sh. The copy includes it now.
  • tests/fm-spawn-pool-base-freshen.test.sh failed 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.sh failed because the fixture copy omitted fm-treehouse-slot-lib.sh and fm-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.sh failed because the fixture copy omitted fm-treehouse-slot-lib.sh. The copy includes it now.
  • tests/fm-spawn-dispatch-profile.test.sh failed 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.sh failed its relaunch reservation because the spawn path no longer held the durable lease. The restored lease keeps it.
  • tests/fm-pi-branch-extension.test.sh failed broken-branch settlement because the copied scripts sourced sibling libraries that were not in the fixture. The copy includes fm-classify-close-lib.sh, fm-treehouse-slot-lib.sh, and fm-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 in tests/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.sh passes on this base. The missing phrase in PR 48 is that pull request's own text.
  • No resource-sweep test in the open-PR failure logs expects an 8s job-state timeout.
  • tests/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.

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.sh refused the xhigh spawn because the allocated copy already carried a slot claim. The fixture now isolates that lease slot.
  • tests/fm-kiro-harness.test.sh stopped 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.sh expected Hermes did not reach its TUI for the stalled launch, and the fake Treehouse returned already leased. The fixture now isolates that lease slot.
  • tests/fm-backend-herdr-launcher-workspace-e2e.test.sh could not tear down dupC, and tests/fm-backend-herdr-workspace-per-home-e2e.test.sh could not tear down cm1. Both stopped on lease and slot claim contradict each other. The fixtures now supply a matching home for teardown.

Risk Assessment

⚠️ Medium: The change restores the durable-lease spawn contract from #32 for every pane backend, a core path, and moving Herdr onto the journaled helper breaks the required real-Herdr presentation E2E's armed-abort scenario and leaves a misleading recovery hint, both fixable before merge.

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.

  • Live validation: ⚠️ inconclusive - 2 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Spawn a custom-command scout in private tmux; retain its durable lease after endpoint exit, refuse duplicate launch, and release ownership through guarded cleanup ✅ pass live Real tmux lease lifecycle transcript
Spawn, recover, and tear down concurrent Herdr workers across disposable homes while preserving focus and rejecting ambiguous duplicate ownership ✅ pass live tests/fm-backend-herdr-presentation-e2e.test.sh; Real Herdr workspace and pane state
Inject an empty allocation response; emit the explicit reconciliation error, retire fake acquisition journals, and allow subsequent real spawns ⏸️ untested no The prior payload used a test wrapper to inject allocation failure and explicitly recorded live=false. Although Herdr itself was real, this did not establish a live result for this scenario.
Exercise conflicting ownership, dirty aborts, stale pane paths, and failed readiness; preserve leases and print journal recovery guidance ⏸️ untested no The prior payload recorded only regression checks using controlled tool fixtures and live=false; it did not establish a live result for these behaviors.
Run the affected supervision, cleanup, Pi fallback, and remote-transfer regression fixtures without missing-library failures ⏸️ untested no The prior payload recorded automated fixture checks and live=false; those checks did not establish live harness or remote-host behavior.
Spawn workers through the other backends sharing the restored durable acquisition path ⏸️ untested no zellij, cmux, paseo, rex, tern, and hc are absent from PATH. Provide the relevant CLI and an isolated backend service to exercise each adapter live.
Evidence: Real tmux lease lifecycle transcript

Source: Real tmux lease lifecycle transcript

~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh

$ fm-spawn.sh lease-live PROJECT "sh -c ..." --scout --backend tmux
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

🌳 Setting up worktree...
🌳 Leased worktree at ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project. Run 'treehouse return ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project' to release it.
spawned lease-live harness=sh kind=scout window=primary:fm-lease-live worktree=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project

$ task metadata and acquisition identity
window=primary:fm-lease-live
endpoint_task_id=lease-live
worktree=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project
treehouse_lease_id=4c68527b073dc32d5f17acdbd85e5bc6
treehouse_lease_holder=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/lease-live/a1794215532.3929826.16561
project=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/project
harness=sh
kind=scout
tasktmp=/tmp/fm-lease-live
model=default
effort=default
spawn_gen=s1794215534.3929826.30197
project=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/project
treehouse_lease_holder=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/lease-live/a1794215532.3929826.16561
treehouse_lease_id=4c68527b073dc32d5f17acdbd85e5bc6

$ tmux capture-pane (real shell endpoint)
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/project$
 cd -- '~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project'
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project$ cd -- '~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/
.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project'
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project$ export GOTMPDIR=/tmp/fm-lease-live/gotmp
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project$ export COMPACT_ADVISER_DISABLE=1
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project$ export FM_TASK_ID=lease-live
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehous
e/.treehouse/project-80a342/1/project$ . '/tmp/fm-lease-live+deb87146dd0acae1f556dd161be49d77167095309dc432870b01d179aed
ca47e/launch.s1794215534.3929826.30197.sh'


























$ kill exact worker window, then treehouse status --json
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

[{"name":"1","path":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project","status":"leased","flavor":"git","lease_id":"4c68527b073dc32d5f17acdbd85e5bc6","lease_holder":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/lease-live/a1794215532.3929826.16561","leased_at":"2026-11-09T10:12:12.977051653+01:00","processes":[]}]
{
  "name": "1",
  "path": "~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project",
  "status": "leased",
  "flavor": "git",
  "lease_id": "4c68527b073dc32d5f17acdbd85e5bc6",
  "lease_holder": "~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/lease-live/a1794215532.3929826.16561",
  "leased_at": "2026-11-09T10:12:12.977051653+01:00",
  "processes": []
}

$ repeat same-id spawn (must refuse)
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh
REFUSED: task lease-live has a retained Treehouse acquisition journal; reconcile ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/state/lease-live.treehouse-acquire before retrying
Manual recovery: pause allocations and cleanup for this project; inspect the journal, retained task records, pool treehouse-state.json, and slot claim before releasing anything.
journal=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/state/lease-live.treehouse-acquire
Read project= and treehouse_lease_holder= from "$journal/identity".
Set worktree, lease_id, and lease_holder from "$journal/allocation.json"; verify them against that identity and the pool state.
If allocation.json is incomplete, locate the exact holder from identity in treehouse-state.json and recover its path and lease_id; do not guess the holder.
If no pool entry carries the recorded lease holder, confirm this never-acquired case from pool treehouse-state.json, then remove only this journal by hand and stop:
  rm -rf -- "$journal"
Preserve any unlanded work and reconcile any retained task record first.
For a conflicting claim, confirm it is orphaned: no live task record in any local home names the claim's task and home.
Stop if another task owns the claim or lease or orphan status is uncertain.
With worktree, lease_id, and lease_holder set to those verified values, run:
  treehouse return --if-lease-id "$lease_id" --if-lease-holder "$lease_holder" "$worktree"
Only after return succeeds, and the slot claim belongs to this acquisition, is confirmed orphaned, or is absent, remove the claim and journal by hand:
  rm -f -- "$(dirname "$worktree")/.fm-slot-owner"
  rm -rf -- "$journal"
Keep the journal and claim if return fails or ownership is uncertain.
same-id retry exit=1
complete: lease-live captain-call inventory reviewed

$ fm-teardown.sh lease-live
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no live watcher process holds this home lock (last beat: 7s ago).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  repair missing watcher supervision according to the session-start block for this harness; do not use shell &.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
teardown: reaping leaked worktree process group for lease-live: 3929804
teardown: force-killing leaked worktree process group for lease-live: 3929804
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

🌳 Worktree returned to pool.
teardown lease-live complete (window primary:fm-lease-live, worktree ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project)
Backlog: lease-live just finished (config/backlog-backend selects manual editing). Update ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/data/backlog.md - move lease-live to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.

$ treehouse status --json after guarded cleanup
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

[{"name":"1","path":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-lab.0yjhjh/treehouse/.treehouse/project-80a342/1/project","status":"available","flavor":"git","lease_id":"","lease_holder":"","leased_at":null,"processes":[]}]

Verified real tmux cwd, durable lease after endpoint exit, duplicate refusal, and guarded lease release.
Evidence: Real Herdr workspace and pane state

Source: Real Herdr workspace and pane state

Lab session: fm-lab-fm-herdr-present-294767-19146
{"id":"cli:workspace:list","result":{"type":"workspace_list","workspaces":[{"active_tab_id":"w1:t2","agent_status":"unknown","focused":false,"label":"firstmate","number":1,"pane_count":1,"tab_count":1,"workspace_id":"w1"},{"active_tab_id":"w3:t1","agent_status":"unknown","focused":false,"label":"2ndmate-alpha","number":2,"pane_count":3,"tab_count":3,"workspace_id":"w3"},{"active_tab_id":"w4:t1","agent_status":"unknown","focused":true,"label":"2ndmate-bravo","number":3,"pane_count":2,"tab_count":2,"workspace_id":"w4"},{"active_tab_id":"wP:t2","agent_status":"unknown","focused":false,"label":"└ b1 · p:VArCUZ1NSPq_iOk_YCY9Hg","number":4,"pane_count":1,"tab_count":1,"workspace_id":"wP"},{"active_tab_id":"wQ:t2","agent_status":"unknown","focused":false,"label":"└ b2 · p:0-qOIx_TeQQWRN-YCWqGqg","number":5,"pane_count":1,"tab_count":1,"workspace_id":"wQ"},{"active_tab_id":"w0:t1","agent_status":"unknown","focused":false,"label":"firstmate/legacy-seed · p:AbCdEfGhIjKlMnOpQrStUv","number":6,"pane_count":1,"tab_count":1,"workspace_id":"w0"}]}}
{"id":"cli:pane:list","result":{"panes":[{"agent_status":"unknown","cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/1/project","focused":false,"foreground_cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/1/project","pane_id":"w1:p2","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w1:t2","terminal_id":"term_65fd48898a05a1","terminal_title":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/1/project","terminal_title_stripped":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/1/project","workspace_id":"w1"},{"agent_status":"unknown","cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","focused":false,"foreground_cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","pane_id":"w3:p1","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w3:t1","terminal_id":"term_65fd4889916db6","terminal_title":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","terminal_title_stripped":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","workspace_id":"w3"},{"agent_status":"unknown","cwd":"/tmp/fm-herdr-presentation.q6ap6M/home-2ndmate-alpha","focused":false,"foreground_cwd":"/tmp/fm-herdr-presentation.q6ap6M/home-2ndmate-alpha","pane_id":"w3:p2","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w3:t2","terminal_id":"term_65fd4889929847","terminal_title":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/home-2ndmate-alpha","terminal_title_stripped":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/home-2ndmate-alpha","workspace_id":"w3"},{"agent_status":"unknown","cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","focused":false,"foreground_cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","pane_id":"w3:p4","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w3:t4","terminal_id":"term_65fd48b41377b11","terminal_title":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","terminal_title_stripped":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","workspace_id":"w3"},{"agent_status":"unknown","cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","focused":true,"foreground_cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","pane_id":"w4:p1","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w4:t1","terminal_id":"term_65fd48899ab9cb","terminal_title":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","terminal_title_stripped":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","workspace_id":"w4"},{"agent_status":"unknown","cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/10/project","focused":false,"foreground_cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/10/project","pane_id":"w4:p2","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w4:t2","terminal_id":"term_65fd48899bfbbc","terminal_title":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/10/project","terminal_title_stripped":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/10/project","workspace_id":"w4"},{"agent_status":"unknown","cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/6/project","focused":false,"foreground_cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/6/project","pane_id":"wP:p2","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"wP:t2","terminal_id":"term_65fd48899d453d","terminal_title":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/6/project","terminal_title_stripped":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/6/project","workspace_id":"wP"},{"agent_status":"unknown","cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/7/project","focused":false,"foreground_cwd":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/7/project","pane_id":"wQ:p2","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"wQ:t2","terminal_id":"term_65fd48899e02ae","terminal_title":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/7/project","terminal_title_stripped":"zabi@purplevoice: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/herdr-pool/.treehouse/project-46ad7a/7/project","workspace_id":"wQ"},{"agent_status":"unknown","cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","focused":false,"foreground_cwd":"/tmp/fm-herdr-presentation.q6ap6M/project","pane_id":"w0:p1","revision":1,"scroll":{"max_offset_from_bottom":0,"offset_from_bottom":0,"viewport_rows":40},"tab_id":"w0:t1","terminal_id":"term_65fd48b40b4d910","terminal_title":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","terminal_title_stripped":"zabi@purplevoice: /tmp/fm-herdr-presentation.q6ap6M/project","workspace_id":"w0"}],"type":"pane_list"}}
Evidence: Abort diagnostic before fixture fix

Source: Abort diagnostic before fixture fix

warning: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.hK9WwV/home/data/abort-a/launch-brief.md records no ship branch; defaulting to legacy branch fm/abort-a
warning: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.hK9WwV/home/data/abort-a/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
error: Treehouse durable task leases require jq and get --lease --lease-holder --json plus return --if-lease-id --if-lease-holder (use Treehouse v2.3.0 or newer); no allocation or endpoint mutation was attempted
Evidence: Correct acquisition error and journal recovery instructions

Source: Correct acquisition error and journal recovery instructions

warning: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.P5fp1X/home/data/abort-a/launch-brief.md records no ship branch; defaulting to legacy branch fm/abort-a
warning: ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.P5fp1X/home/data/abort-a/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
error: durable Treehouse acquisition did not report a worktree; retain ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.P5fp1X/home/state/abort-a.treehouse-acquire for reconciliation
warning: herdr presentation cleanup could not verify the exact pane; refusing focus-unsafe pane close
warning: retaining Treehouse lease recovery journal ~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.P5fp1X/home/state/abort-a.treehouse-acquire; reconcile this acquisition before retrying task abort-a
Manual recovery: pause allocations and cleanup for this project; inspect the journal, retained task records, pool treehouse-state.json, and slot claim before releasing anything.
journal=~/.no-mistakes/worktrees/7f0ec18181b6/01M6ZRFE3PJJN8KQDW6A33PF0Z/.test-phase-tmp/fm-herdr-presentation.P5fp1X/home/state/abort-a.treehouse-acquire
Read project= and treehouse_lease_holder= from "$journal/identity".
Set worktree, lease_id, and lease_holder from "$journal/allocation.json"; verify them against that identity and the pool state.
If allocation.json is incomplete, locate the exact holder from identity in treehouse-state.json and recover its path and lease_id; do not guess the holder.
If no pool entry carries the recorded lease holder, confirm this never-acquired case from pool treehouse-state.json, then remove only this journal by hand and stop:
  rm -rf -- "$journal"
Preserve any unlanded work and reconcile any retained task record first.
For a conflicting claim, confirm it is orphaned: no live task record in any local home names the claim's task and home.
Stop if another task owns the claim or lease or orphan status is uncertain.
With worktree, lease_id, and lease_holder set to those verified values, run:
  treehouse return --if-lease-id "$lease_id" --if-lease-holder "$lease_holder" "$worktree"
Only after return succeeds, and the slot claim belongs to this acquisition, is confirmed orphaned, or is absent, remove the claim and journal by hand:
  rm -f -- "$(dirname "$worktree")/.fm-slot-owner"
  rm -rf -- "$journal"
Keep the journal and claim if return fails or ownership is uncertain.
- Outcome: ⚠️ 1 warning across 1 run (22m21s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • 🚨 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 fake treehouse get that exits 0 with no output (tests/fm-backend-herdr-presentation-e2e.test.sh:254-257). Before this change, spawn_lease_herdr_slot printed "treehouse get --lease did not report a worktree". Now it calls spawn_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 the WT=$(jq -er ...) || exit 1 step (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, and fm_treehouse_records_reserved refuses 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) have spawn_lease_treehouse_slot print 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 run treehouse return --force $WT. Herdr now leases through the acquisition journal, so spawn_abort_retain_treehouse_journal prints 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) fails fm_treehouse_lease_matches for 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 --force hint 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 typing treehouse get into 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 typing treehouse get into 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.
⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (2 of 6 scenarios were driven live against the product); untested: Inject an empty allocation response; emit the explicit reconciliation error, retire fake acquisition journals, and allow subsequent real spawns, Exercise conflicting ownership, dirty aborts, stale pane paths, and failed readiness; preserve leases and print journal recovery guidance, Run the affected supervision, cleanup, Pi fallback, and remote-transfer regression fixtures without missing-library failures, Spawn workers through the other backends sharing the restored durable acquisition path
  • Live validation: ⚠️ inconclusive - 2 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Spawn a custom-command scout in private tmux; retain its durable lease after endpoint exit, refuse duplicate launch, and release ownership through guarded cleanup ✅ pass live Real tmux lease lifecycle transcript
Spawn, recover, and tear down concurrent Herdr workers across disposable homes while preserving focus and rejecting ambiguous duplicate ownership ✅ pass live tests/fm-backend-herdr-presentation-e2e.test.sh; Real Herdr workspace and pane state
Inject an empty allocation response; emit the explicit reconciliation error, retire fake acquisition journals, and allow subsequent real spawns ⏸️ untested no The prior payload used a test wrapper to inject allocation failure and explicitly recorded live=false. Although Herdr itself was real, this did not establish a live result for this scenario.
Exercise conflicting ownership, dirty aborts, stale pane paths, and failed readiness; preserve leases and print journal recovery guidance ⏸️ untested no The prior payload recorded only regression checks using controlled tool fixtures and live=false; it did not establish a live result for these behaviors.
Run the affected supervision, cleanup, Pi fallback, and remote-transfer regression fixtures without missing-library failures ⏸️ untested no The prior payload recorded automated fixture checks and live=false; those checks did not establish live harness or remote-host behavior.
Spawn workers through the other backends sharing the restored durable acquisition path ⏸️ untested no zellij, cmux, paseo, rex, tern, and hc are absent from PATH. Provide the relevant CLI and an isolated backend service to exercise each adapter live.
  • bash tests/fm-afk-return.test.sh
  • bash tests/fm-claude-stop-autoarm.test.sh
  • bash tests/fm-gotmp.test.sh
  • bash tests/fm-pi-branch-extension.test.sh
  • bash tests/fm-remote-backlog-handoff.test.sh
  • bash tests/fm-remote-transport-lanes.test.sh
  • bash tests/fm-turnend-guard.test.sh
  • bash tests/fm-spawn-slot-ownership.test.sh — rerun with TMPDIR=/tmp after an in-repository fixture-location refusal
  • bash tests/fm-spawn-worktree-settle.test.sh
  • bash tests/fm-spawn-herdr-lease.test.sh
  • bash tests/fm-polytoken-harness.test.sh
  • bash 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 teardown
  • Manual private-tmux scout lifecycle: inspect metadata, journal, pane cwd, lease persistence, duplicate refusal, and guarded cleanup
  • bin/fm-herdr-lab.sh run &lt;owned-lab-session&gt; workspace list and pane list
  • Checked optional backend executables with command -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.

peterOC26 and others added 4 commits November 9, 2026 09:55
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
@peterOC26
peterOC26 merged commit a529b33 into main Nov 9, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant