Skip to content

fix(backends): scope Herdr crew discovery to recorded workspaces - #7

Merged
Profreshor merged 5 commits into
mainfrom
fm/fm-herdr-crew-scan-scope
Oct 17, 2026
Merged

Profreshor merged 5 commits into
mainfrom
fm/fm-herdr-crew-scan-scope

Conversation

@Profreshor

@Profreshor Profreshor commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Intent

I'll write the fork grant

Context: that was the captain's answer to letting this firstmate open PRs on his fork (Profreshor/firstmate) again, which was asked so that the three follow-ups filed from the Codex review on fork PR #3 could ship as fork PRs. The captain's earlier "Merge now" on PR #3 accepted filing them as follow-ups. This task is one of those three. The Codex finding, verbatim:

Restrict crew discovery to this home's recorded workspaces
When two FM_HOME instances share a Herdr session, their crew workspaces can have the same label (for example, separate primary homes both use firstmate-crew). This loop scans every workspace with that label rather than the IDs recorded in the current home's state, so fm_backend_herdr_list_live reports another home's panes as local recovery/orphan entries. Enumerate the IDs returned by fm_backend_herdr_crew_workspace_recorded instead.
(bin/backends/herdr.sh, around the crew discovery loop near line 4131)

What Changed

  • Scope Herdr crew-pane discovery to workspace IDs recorded for the current home, excluding same-labeled workspaces owned by other homes.
  • Document home-scoped crew list-live behavior in the Herdr backend guide.
  • Add fake and guarded real-Herdr coverage for separate homes sharing a session with identically labeled crew workspaces.

Risk Assessment

✅ Low: The change is tightly scoped to reusing the existing per-home recorded-workspace helper, which validates IDs against the live session and expected label; the new behavioral regression covers the shared-label collision.

Testing

Focused stateful and real-product Herdr validation passed. The live guarded lab created two homes with same-labeled crew workspaces and proved list-live reports only the calling home's recorded panes; its named session was cleaned up by the test. This backend-only change has no rendered UI surface, so CLI/lab transcripts are the reviewer-visible evidence.

  • Live validation: ✅ go - 2 of 2 scenarios driven live against the product
Scenario Result Live Evidence
A home recovers panes from its recorded crew workspace ✅ pass live Live guarded-lab transcript: real herdr: list-live scopes same-labeled crew workspaces to the recording home
Same-labeled foreign crew workspace is excluded from recovery ✅ pass live Live guarded-lab transcript: two homes created separate firstmate-crew workspaces in one named session; each list-live result contained only its own pane and excluded the other home's pane.
Evidence: Live guarded Herdr lab transcript

Source: Live guarded Herdr lab transcript

# lab herdr server 0.9.1 protocol 22, client 0.9.1 protocol 22
ok - real herdr: the first crew task creates one labeled crew workspace right after the home, without moving focus
ok - real herdr: six crew panes fill an even 3x2 grid, top row left to right, then bottom row
ok - real herdr: a seventh crew task opens a second crew workspace right after the first, without moving focus
ok - real herdr: list-live discovers crew panes by their task labels
ok - real herdr: killing one crew pane closes only that pane and keeps focus
ok - real herdr: the next crew task refills the freed slot and restores the even grid
ok - real herdr: a same-labeled agent-free crew pane is replaced only after its successor exists
ok - real herdr: closing a whole crew column rebalances the remaining columns evenly
ok - real herdr: each crew workspace disappears with its last pane and the next spawn recreates one
ok - real herdr: list-live scopes same-labeled crew workspaces to the recording home
ok - real herdr: real spawns on the crew setting become panes of one crew workspace
ok - real herdr: real teardown closes one exact crew pane and the workspace goes with the last one
Evidence: Focused crew regression transcript

Source: Focused crew regression transcript

ok - herdr crew: crew and crew:<1-16> select the crew layout, other values warn and fall back
ok - herdr crew: the first task creates and records one labeled crew workspace without moving focus
ok - herdr crew: six tasks fill an even 3x2 grid, top row left to right, then bottom row
ok - herdr crew: a seventh task overflows into a second crew workspace, which goes with its last pane
ok - herdr crew: a configured cap changes how many panes a crew workspace holds
ok - herdr crew: kill closes one exact crew pane, keeps its siblings and focus, and rebalances
ok - herdr crew: the next task refills a freed slot and restores the grid
ok - herdr crew: the crew workspace goes with its last pane and the next spawn recreates it
warning: herdr presentation ordering API support is unavailable or ambiguous; leaving worker in Herdr's current order
ok - herdr crew: a recorded workspace whose label changed is never adopted
ok - herdr crew: a live same-labeled crew pane refuses a duplicate placement
ok - herdr crew: list-live reports crew panes by their task labels
warning: herdr presentation ordering API support is unavailable or ambiguous; leaving worker in Herdr's current order
ok - herdr crew: list-live lists only this home's recorded crew workspaces
ok - herdr crew: without the layout API placement still works and only the rebalance is skipped

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 2 of 2 scenarios driven live against the product
Scenario Result Live Evidence
A home recovers panes from its recorded crew workspace ✅ pass live Live guarded-lab transcript: real herdr: list-live scopes same-labeled crew workspaces to the recording home
Same-labeled foreign crew workspace is excluded from recovery ✅ pass live Live guarded-lab transcript: two homes created separate firstmate-crew workspaces in one named session; each list-live result contained only its own pane and excluded the other home's pane.
  • bash tests/fm-backend-herdr-crew-workspace-e2e.test.sh (real Herdr 0.9.1/protocol 22 named lab; spawned two homes with colliding crew labels and verified mutually exclusive recovery output)
  • bash tests/fm-backend-herdr-crew.test.sh (focused stateful crew regression)
  • git diff --check
  • git diff | jev find &#34;a change unrelated to scoping Herdr crew recovery to the current home&#39;s recorded workspace ids&#34; (no unrelated hunks flagged)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T21:01:46.943628Z bed8dc2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…re in tests/fm-backend-herdr-crew-workspace-e2e.test.sh. Verified: shellcheck target, bash tests/fm-backend-herdr-crew-workspace-e2e.test.sh, bash bin/fm-lint.sh, and bash tests/fm-remote-reply.test.sh all pass. Behavior portable serial 4 failed only in tests/fm-remote-reply.test.sh ('NUL-bearing line was not captured'), a file unchanged by this PR; it passes locally, so no behavior-code change is warranted. Final diff scope check found no unrelated hunks
@Profreshor
Profreshor merged commit 95495de into main Oct 17, 2026
19 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