Skip to content

feat: automatically register remote second mates in local Herdr - #13

Merged
dscott98 merged 8 commits into
mainfrom
fm/fm-herdr-machine-auto
Oct 2, 2026
Merged

dscott98 merged 8 commits into
mainfrom
fm/fm-herdr-machine-auto

Conversation

@dscott98

@dscott98 dscott98 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Remote agents should always show up in the local Herdr on this machine, so their activity is visible; if it can be done, it should always be done.
This lives in the dscott98/firstmate fork only, never upstream.

On 2026-10-01 this was done by hand for agent01-03: each host was upgraded to herdr 0.9.3 with herdr update --handoff (which upgraded the fm-remote server live without killing second-mate panes), then saved locally with herdr machine add --label <alias> --remote-session fm-remote <alias>.
Saved machines need a remote server that advertises the surface_interest/health_check capabilities; herdr 0.9.1 refuses with "remote server is not ready for saved machines", while a 0.9.1 local client could still add 0.9.3 machines.

Make remote second-mate provisioning and liveness do this idempotently, including a herdr version floor check in the remote doctor.

What Changed

  • Automatically save remote second-mate hosts in local Herdr after launch and during liveness checks, using idempotent, time-bounded calls with per-host locking.
  • Preserve existing saved machines and warn about mismatches or failed saves without failing launch or liveness checks.
  • Add remote doctor checks for Herdr client and running server versions of at least 0.9.3, with manual upgrade guidance, regression coverage, and documentation of the fork-specific behavior.

Risk Assessment

✅ Low: The changes are bounded, preserve existing saved machines, and satisfy the revised intent without a substantiated source defect.

Testing

Three focused fixture suites passed. The lifecycle fixture verified launch refusal tolerance and idempotent saving before repeating the previously declined inheritance-wait failure. No live Herdr calls or visual artifacts were produced under the recorded fake-only restriction; no source changes were made.

  • Live validation: ⚠️ inconclusive - 0 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Remote launch saves its host without failing when saving is refused ⏸️ untested no Recorded decision requires fake-only Herdr calls. Live proof requires authorization for an isolated Herdr lab and disposable remote endpoint.
Liveness restores a missing saved machine without duplicate additions ⏸️ untested no Recorded fake-only restriction prevents real Herdr execution; authorize an isolated lab and disposable remote endpoint.
Existing machines remain unchanged, with one repair warning for mismatches ⏸️ untested no Recorded decision forbids touching real local Herdr. Live validation requires authorization for isolated saved-machine state.
Unavailable dependencies and save failures preserve best-effort behavior ⏸️ untested no Herdr calls were restricted to fixtures; an authorized isolated Herdr environment is needed for live proof.
Remote doctor reports outdated versions and accepts version 0.9.3 ⏸️ untested no Version checks used fake Herdr responses. Live proof requires authorized disposable endpoints with the relevant versions.
Concurrent remote launch serializes inheritance before publishing its endpoint ⏸️ untested no Live execution is restricted; fixture coverage also stopped at the previously reported, declined inheritance wait failure.
Supervision relaunches a dead remote agent and emits one completion notification ⏸️ untested no Requires an authorized isolated live endpoint; the lifecycle fixture did not reach this check.
  • Outcome: ⚠️ 1 warning across 1 run (5m12s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⚠️ **Rebase** - 1 warning
  • ⚠️ tests/fm-backend-herdr.test.sh - merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/fm-herdr-machine-auto
✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (0 of 7 scenarios were driven live against the product); untested: Remote launch saves its host without failing when saving is refused, Liveness restores a missing saved machine without duplicate additions, Existing machines remain unchanged, with one repair warning for mismatches, Unavailable dependencies and save failures preserve best-effort behavior, Remote doctor reports outdated versions and accepts version 0.9.3, Concurrent remote launch serializes inheritance before publishing its endpoint, Supervision relaunches a dead remote agent and emits one completion notification
  • Live validation: ⚠️ inconclusive - 0 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Remote launch saves its host without failing when saving is refused ⏸️ untested no Recorded decision requires fake-only Herdr calls. Live proof requires authorization for an isolated Herdr lab and disposable remote endpoint.
Liveness restores a missing saved machine without duplicate additions ⏸️ untested no Recorded fake-only restriction prevents real Herdr execution; authorize an isolated lab and disposable remote endpoint.
Existing machines remain unchanged, with one repair warning for mismatches ⏸️ untested no Recorded decision forbids touching real local Herdr. Live validation requires authorization for isolated saved-machine state.
Unavailable dependencies and save failures preserve best-effort behavior ⏸️ untested no Herdr calls were restricted to fixtures; an authorized isolated Herdr environment is needed for live proof.
Remote doctor reports outdated versions and accepts version 0.9.3 ⏸️ untested no Version checks used fake Herdr responses. Live proof requires authorized disposable endpoints with the relevant versions.
Concurrent remote launch serializes inheritance before publishing its endpoint ⏸️ untested no Live execution is restricted; fixture coverage also stopped at the previously reported, declined inheritance wait failure.
Supervision relaunches a dead remote agent and emits one completion notification ⏸️ untested no Requires an authorized isolated live endpoint; the lifecycle fixture did not reach this check.
  • FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-herdr-machine.test.sh — passed
  • FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-remote-doctor.test.sh — passed
  • FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-secondmate-liveness.test.sh — passed
  • FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-remote-secondmate-lifecycle-e2e.test.sh — saved-machine integration checks passed; later inheritance wait failed and temporary-hook cleanup reported permission errors
  • git status --short — clean after testing
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…matically (#4)

Remote agents now always show up in the local Herdr on this machine. After a
remote second mate is launched, and again whenever a liveness probe finds its
route alive, the primary saves its host alias as a machine pointing at the
fm-remote remote session (bin/fm-herdr-machine-lib.sh). The save is idempotent,
bounded, serialized per host, skips silently without a local herdr, reports a
refusal instead of failing the launch or probe, and never removes or rewrites a
saved machine it did not add.

The remote doctor gains a herdr-version readiness check with a 0.9.3 floor, the
first release verified to serve saved machines, covering both the host's client
and, while running, its fm-remote server. Below the floor the gap is human:
the action names `herdr update --handoff`, and --fix never runs the update.

Every test now drives the parent-side save through fake herdr CLIs so no suite
reads or changes the runner's real saved machines; the shared fixture helper
lives in tests/lib.sh, and a colocated suite pins absent-herdr, present,
never-rewrite, added, refused, unreadable-list, and lock-skip behavior. Fork
only, never upstream.
…eplaced the racy Herdr test responses with state-based behavior. Focused bootstrap checks, repeated startup checks, delayed-start regression, and targeted lint pass. Full suites encountered unrelated local environment failures
…by replacing order-dependent mock responses with server-state responses. Reproduced the exact failure with delayed startup; normal and delayed startup now pass. Full backend suite and targeted lint passed, using installed GNU sleep to bypass an unrelated local multicall-sleep issue
…eplaced the racy Herdr test responses with state-based behavior. Focused bootstrap checks, repeated startup checks, delayed-start regression, and targeted lint pass. Full suites encountered unrelated local environment failures
@dscott98
dscott98 force-pushed the fm/fm-herdr-machine-auto branch from d8f9645 to f4fccdf Compare October 2, 2026 02:01
@dscott98
dscott98 merged commit 4aedf7c into main Oct 2, 2026
36 of 37 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