Repository navigation
fix(herdr): converge task tabs past plugin-docked panes on Herdr 0.9.1 - #5484
PhilipVinc wants to merge 10 commits into
Conversation
|
Speaking as Kun's firstmate: Diff review on HEAD VISION per-rule:
contract-class: restore — concrete existing default presentation-spaces path on Herdr ≥ 0.8.0 was broken by plugin panes on 0.9.1; tip makes that specified path hold again. Not a new always-on surface. attestation: MATCH (body binds tip). |
A Herdr plugin creation hook (herdr-sidebar 0.13.0 on Herdr 0.9.1) splits its own Explorer pane into every new tab. The projected workspace then held two panes, the convergence check failed, and abort cleanup closed the task pane and left an Explorer-only workspace behind. The flat path had the same leak at teardown, and first-pane tab resolution named the left-docked Explorer instead of the task pane. Prune only Herdr-registered plugin panes from the one exact tab being created or torn down, through `plugin pane close`, which refuses any pane no plugin opened, so labels and tokens are never identity and a captain's split is never closed. The seeded-tab prune, projection convergence (with a bounded re-read while the hook docks asynchronously), focus-preserving projection close, and task kill use it; a tab holding more than one pane no longer resolves to an endpoint by position. Contribution by the Mistral AI4Science team Co-authored-by: Mistral Vibe <vibe@mistral.ai>
…ction convergence
…d projected creates
The flat create's plugin-pane settle adds two prune-and-read rounds after the replacement tab is created. The husk-order fixture was never shifted for them, so its post-close tab list received an empty response. jq 1.6 exits 0 for `jq -e` on empty input and hid the misalignment locally, while CI's jq 1.7 correctly rejected it. Contribution by the Mistral AI4Science team Co-authored-by: Mistral Vibe <vibe@mistral.ai>
…'s replacement tab
68b902d to
1111a45
Compare
|
i'd love to see this merged. it's annoying not to be able to use firstmate+herdr+ plugins to see the git state |
|
Tested #5484 rebased onto upstream main With native Herdr 0.9.3 and herdr-sidebar 0.12.0 in a guarded named lab session, I opened a real registered Sidebar pane immediately after each workspace/tab creation. One gap: re-docking Sidebar into the old bound husk before reclaim returned the safe flat-fallback signal (rc=2), preserving both panes and the journal. The initial live-binding shape check rejects that extra pane before replacement-tab pruning. Limitations: auto-open was simulated synchronously using native plugin-pane creation with private plugin state; the live global auto_open setting stayed off and unchanged. The worker and worktree allocator were fixtures, so natural asynchronous plugin hooks and active real Codex TUI shutdown remain unverified. No default-session lifecycle operation was performed; guarded teardown passed. |
Intent
Fix it properly: on Herdr 0.9.1, spawning a crewmate with the default Herdr presentation-spaces projection fails, and it should work.
Observed:
bin/fm-spawn.sh tangent-geom-s1 projects/tangent-sampling --scout --harness claude --effort xhighfrom a firstmate running inside Herdr 0.9.1 (unconfiguredconfig/herdr-presentation-spaces, so the projection was on by default above the 0.8.0 floor) failed withError: disposable herdr presentation workspace did not converge to exactly one task pane. It left behind a version 1 journalstate/<id>.herdr-presentationand a new workspace titled└ tangent-geom-s1 · p:<token>. That workspace had exactly one tabfm-tangent-geom-s1(w9:t2) holding exactly one pane, which Herdr labelledExplorer, with pane token{"herdr-sidebar-explorer": ...}, cwd set to the task project, and content that was Herdr's file-explorer UI (m / ctrl+rclick for menus, a git branch footer) rather than a shell or agent. Herdr 0.9.1 appears to add or convert a sidebar file-explorer pane in new workspaces or tabs, and firstmate's convergence check rejects it. After that, the ordinary non-projected layout (config/herdr-presentation-spaces=off) spawned fine. That opt-out is a temporary mitigation in this home and should not be needed once the fix lands.we can also disable that plugin if that's the underlying problem
yes do both
What Changed
fm_backend_herdr_tab_prune_plugin_panes, which closes every other pane in a tab throughherdr plugin pane close. Herdr only lets that command close panes a plugin registered, so shells, agents and a captain's splits are never closed. Addedfm_backend_herdr_tab_settle_plugin_panes, a bounded retry (FM_BACKEND_HERDR_PROJECTION_CONVERGE_ATTEMPTS/_SLEEP) that keeps pruning until the tab reads as exactly the task pane twice in a row, because a hook can dock its pane late. Projected workspace convergence now runs this settle before its one-tab, one-pane check, so spawns under the default presentation-spaces projection no longer fail whenherdr-sidebardocks an Explorer pane. The flat task-tab create and the projected restart reclaim's replacement tab also run it.fm_backend_herdr_kill_serializednow prune registered plugin panes from the target tab before closing the task pane, so no Explorer-only tab or workspace is left behind.fm_backend_herdr_pane_for_tab(used for husk respawn, label recovery and bare selectors) now returns a pane only when the tab has exactly one. Before that it prunes plugin panes a plugin re-docked into the tab, and it no longer takes the first listed pane.docs/herdr-backend.md: a plugin hook can still move focus, and a restored tab with an unregistered extra pane is ambiguous. Recorded the Herdr 0.9.1 / herdr-sidebar 0.13.0 lab evidence indocs/verification/runtime-backends.md, including which paths are covered only by the fake. Extended the stateful Herdr fake intests/fm-backend-herdr.test.shwith regressions for docked, late-docked, re-docked and unregistered-split panes.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The fix-round change is one line in the projected restart reclaim. It calls the existing shared helper
fm_backend_herdr_tab_settle_plugin_paneson the new tab only, after focus is restored and before the tab is verified, and it leaves the restored husk tab untouched as the user asked; the canned fixture's four extra list responses line up with the helper's two prune-and-read rounds, and the new stateful-fake regression would fail without the fix because the final one-pane binding check would roll back.Testing
I ran every plugin-dock, projected-create, restart-reclaim and husk-respawn case in tests/fm-backend-herdr.test.sh (18 cases) against the stateful and canned Herdr fakes. All of them pass under jq 1.7.1 and jq 1.6, which confirms the
tab getmodelling fixes the CI-only failure. The new reclaim regression fails on the backend from before the fix with the reported flat fallback, and passes with the fix. Per the user's instruction I did not rerun the full suite or any real-Herdr live test. No scenario was driven against a real Herdr 0.9.1 with herdr-sidebar enabled, so every scenario is recorded as untested live. Herdr's plugin state is global to the user, so enabling the plugin even for a lab would change the operator's live configuration (this blocker was recorded in earlier rounds).bin/fm-spawn.sh <task> <project> --scoutwith the default projection and herdr-sidebar enabled succeeds, then restart reclaim succeedsEvidence: 18 targeted plugin-dock/reclaim/husk tests under jq 1.7.1 (all ok)
Source: 18 targeted plugin-dock/reclaim/husk tests under jq 1.7.1 (all ok)
Evidence: Same 18 tests under jq 1.6 (all ok)
Source: Same 18 tests under jq 1.6 (all ok)
Evidence: Reclaim regression fails on the pre-fix backend under jq 1.7.1
Source: Reclaim regression fails on the pre-fix backend under jq 1.7.1
not ok - reclaim with a docking plugin should converge: warning: herdr presentation reclaim for dock-r1 did not converge exactly; spawning flat rc=1Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/backends/herdr.sh:2869- The projected restart reclaim path was left out of the plugin-pane fix.fm_backend_herdr_projection_reclaim_taskcreates its replacement task tab withtab create --no-focusin the projected workspace (herdr.sh:2856), but it never prunes or settles the plugin pane that atab.createdhook docks into that tab. With herdr-sidebar enabled, that tab ends up holding an Explorer pane plusnew_pane. The finalfm_backend_herdr_projection_live_binding_matchescheck (herdr.sh:2928, which requires exactly one pane at herdr.sh:2778-2782) then fails. The reclaim rolls back and prints 'did not converge exactly; spawning flat', so with the plugin on, every projected husk respawn after a Herdr restart falls back to the flat layout. This is the same invariant the change enforces infm_backend_herdr_projection_create_task(herdr.sh:2670) and the flatcreate_task(herdr.sh:2542). The rollback does still prune the Explorer pane throughprojection_close_pane_focus_preserving, so nothing leaks. The same one-pane check also runs first against the restored husk tab (herdr.sh:2829), which can hold a re-docked Explorer pane. Smallest fix: after the focus restore at herdr.sh:2869, callfm_backend_herdr_tab_settle_plugin_panes "$session" "$meta_workspace" "$new_tab" "$new_pane" || true, which reuses the shared helper so there is no new loop. Optionally, also prune registered plugin panes frommeta_tabbefore the first binding check.🔧 Fix applied.
✅ Re-checked - no issues remain.
⏭️ **Test** - skipped
env -u HERDR_PANE_ID -u HERDR_TAB_ID -u HERDR_WORKSPACE_ID -u HERDR_SOCKET_PATH -u HERDR_ENV -u HERDR_BIN_PATH -u FM_TASK_ID bash <tests/fm-backend-herdr.test.sh preamble + 18 selected tests>covering reclaim, plugin-dock, husk replacement and projection create (18/18 ok)Regression check: reran test_projection_reclaim_converges_past_a_docked_plugin_pane and test_projection_reclaim_replaces_only_exact_husk_and_advances_binding against HEAD~1's bin/backends/herdr.sh (without the settle line). The new test failed with 'did not converge exactly; spawning flat'. The file was then restored and the worktree left clean.🔧 Fix applied.
1 warning still open:
bin/fm-spawn.sh <task> <project> --scoutwith the default projection and herdr-sidebar enabled succeeds, then restart reclaim succeedsbin/fm-spawn.sh <task> <project> --scoutwith the default projection and herdr-sidebar enabled succeeds, then restart reclaim succeedsTemporary subset copy oftests/fm-backend-herdr.test.shrunning 18 selected cases (every plugin-dock, projection_create, reclaim and husk-respawn test), run underPATH=/tmp/k2-jq:$PATH(jq 1.7.1) with HERDR_PANE_ID/HERDR_TAB_ID/HERDR_WORKSPACE_ID/HERDR_SOCKET_PATH/HERDR_ENV/HERDR_BIN_PATH/FM_TASK_ID unset: 18 ok, rc=0The same 18-case subset under the host's jq 1.6: 18 ok, rc=0Regression check: swapped inbin/backends/herdr.shfromccca8b9^(before the reclaim settle) and rantest_projection_reclaim_converges_past_a_docked_plugin_paneunder jq 1.7.1: not ok, 'did not converge exactly; spawning flat'. Then restored the file withgit checkout, removed the subset file, and confirmed the worktree is clean✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Contribution by the Mistral AI4Science team
Co-authored-by: Mistral Vibe vibe@mistral.ai