Skip to content

fix(bin): report agent-absent endpoints as stopped in crew state and fleet snapshots - #4

Merged
daoudjk merged 3 commits into
fm/fm-pr-merge-multi-allow-redfrom
fm/stopped-endpoint-state-20261007
Oct 8, 2026
Merged

daoudjk merged 3 commits into
fm/fm-pr-merge-multi-allow-redfrom
fm/stopped-endpoint-state-20261007

Conversation

@daoudjk

@daoudjk daoudjk commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Intent

How can we fix unreadable/invalid Program Management and Workstation Operations records, completed children still in flight in Range Operations and Scenario Fidelity, unavailable Technical Lead activity, and missing endpoints/unreadable primary execution records? I want proper visibility before we start working again so we actually know where we stand. If manual actions are needed, tell me the steps.

What Changed

  • bin/fm-crew-state.sh adds a stopped state with an endpoint source. It is emitted only when a tmux or herdr endpoint exists and fm_backend_agent_state reports no agent process. This covers three cases: the pane is unreadable, the harness busy source cannot answer, or the selected run is terminal with an unverifiable code identity. Missing, unreachable, alive and ambiguous endpoints keep their existing unknown or working readings. An unreadable-pane dead agent used to read unknown · none; it now reads stopped.
  • bin/fm-fleet-snapshot.sh treats a child in stopped state as an owned, non-active hold. It appears in holds and never in active_children. A secondmate home whose only unreadable children are stopped stays valid and reads externally_held. The help text states that stopped means the agent is not running, not that the work is finished or accepted.
  • docs/architecture.md and the fm-crew-state.sh header document the rule. New and updated tests are tests/fm-crew-state-stopped.test.sh (new), tests/fm-crew-state.test.sh and tests/fm-fleet-snapshot-view.test.sh.

Risk Assessment

✅ Low: The fix round is a one-line state change in the unreadable-pane block that reuses the existing classifier verdict, plus help text and behavioral tests. I found no remaining consumer of the old "backend target gone ... agent gone" wording, and missing and unreachable endpoints still read unknown.

Testing

I ran the three targeted test scripts for the changed crew-state and fleet-snapshot code, and all passed. They exercise the real fm-crew-state and snapshot scripts. They cover an unreadable pane with a dead agent reading stopped, missing and unreachable endpoints staying unknown, and the snapshot view rendering. I produced no visual artifacts because this is CLI/script behavior.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • ⚠️ bin/fm-fleet-snapshot.sh:1095 - A crew whose agent process has died now reads as stopped. The snapshot lists it under holds (source child-state), and a home whose only unreadable children are stopped now reads valid / externally_held. A crashed or abandoned agent with unfinished work therefore looks like a deliberate hold, not a child that needs a restart. The detail text does say 'agent process absent', but the home-level verdict no longer flags it. Whether a dead agent should count as a held obligation is a product decision. If it should not, the smallest remedy is a separate stopped_children surface that needs attention. That remedy would extend the change.
  • ⚠️ bin/fm-crew-state.sh:1233 - The stated intent covers several failure classes: unreadable Program Management and Workstation Operations records, completed children still in flight, unavailable Technical Lead activity, and missing endpoints or unreadable primary execution records. It also asks for manual steps where needed. This commit only changes how a stopped endpoint is read. Missing endpoints (backend target gone) and unreadable records still produce unknown and invalidate the home. No manual-recovery steps are provided in the change. The change satisfies only part of the stated goal.
  • ℹ️ bin/fm-crew-state.sh:1233 - The same dead-agent evidence is read two ways. When the pane is unreadable (earlier block, ~line 1214), a dead classifier verdict emits unknown none 'backend target gone ... (agent gone, pane shell remains)'. When the pane is readable but the busy source can't answer, the new code emits stopped endpoint. A dead agent therefore flips between unknown and stopped depending on whether the scrollback read happened to succeed, so the home's validity can change with probe timing. Also, endpoint_agent_stopped re-runs the classifier that the earlier block already ran.

🔧 Fix: Read unreadable-pane dead agent as stopped
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-crew-state-stopped.test.sh
  • bash tests/fm-crew-state.test.sh
  • bash tests/fm-fleet-snapshot-view.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

When the recorded tmux or herdr endpoint exists but its agent process is gone,
fm-crew-state reports stopped (source endpoint) instead of unknown whenever the
semantic busy source cannot answer, or the run-step is unknown only because a
terminal run's code identity is unverified.
The home summary lists a stopped child with an In flight row as a held,
non-active obligation, so such children no longer make the home unreadable.
Running agents, unreadable probes and live or competing runs stay unknown.
@daoudjk
daoudjk merged commit 908b446 into fm/fm-pr-merge-multi-allow-red Oct 8, 2026
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