Skip to content

feat(bin): add fm-orchestrator.sh and fm-relaunch.sh for crewmate session resume#896

Open
imemdev wants to merge 5 commits into
kunchenguid:mainfrom
imemdev:fm/fm-orchestrator-tool
Open

feat(bin): add fm-orchestrator.sh and fm-relaunch.sh for crewmate session resume#896
imemdev wants to merge 5 commits into
kunchenguid:mainfrom
imemdev:fm/fm-orchestrator-tool

Conversation

@imemdev

@imemdev imemdev commented Jul 23, 2026

Copy link
Copy Markdown

Intent

Add bin/fm-orchestrator.sh, a firstmate helper script for orchestrating multiple crewmate sessions. Code already went through a local no-mistakes review/test/lint/document cycle by the original author; final commit updated docs/scripts inventory to list both fm-relaunch.sh and fm-orchestrator.sh. Re-validating now only to push through the required no-mistakes gate (this fork/PR channel skipped that step originally).

What Changed

  • Added bin/fm-relaunch.sh, an on-demand session-resume helper with no auto-trigger.
  • Added bin/fm-orchestrator.sh, a recurring watchdog that resumes crewmate sessions and records a cooldown timestamp even when the underlying fm-relaunch.sh run fails, propagating the error rather than swallowing it.
  • Added test suites tests/fm-orchestrator.test.sh and tests/fm-relaunch.test.sh, plus docs (docs/orchestrator-tool.md, docs/relaunch-tool.md) and an updated docs/scripts.md inventory listing both new scripts.

Risk Assessment

✅ Low: Self-contained macOS-only shell tool with two independent safety gates (session-liveness + pending-work), cooldown throttle, no billing/network side effects, matching docs and tests added, and final commit correctly lists both scripts in docs/scripts.md per user intent.

Testing

Ran both dedicated test suites: fm-orchestrator.test.sh 16/16 pass covering install/uninstall/status/check-trigger logic including cooldown and stall detection; fm-relaunch.test.sh 13/13 pass covering install/run/uninstall/no-auto-trigger guarantees. Confirmed docs/scripts.md and docs/orchestrator-tool.md reference fm-orchestrator.sh per the final commit intent. No code changes needed. No product-level visual artifact produced since this is a headless bash CLI tool with no UI surface; CLI test transcripts serve as evidence.

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.

  • bash tests/fm-orchestrator.test.sh
  • bash tests/fm-relaunch.test.sh
  • grep -rl fm-orchestrator docs/
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

imemdev added 5 commits July 23, 2026 12:50
…trigger

Registers a launchd LaunchAgent with no RunAtLoad/StartInterval/
StartCalendarInterval/watch-path key, so the job can only fire via an
explicit launchctl call, never on its own. install/status/uninstall/run
manage the job; run kickstarts it, which opens claude in a terminal and
drives the trust-dialog and first-message handshake needed to actually
trigger session-start. Supersedes the ad hoc dev.firstmate.relaunch
prototype on the captain's machine by reusing its label.
Second, distinct launchd job (allowed a real StartInterval, unlike
fm-relaunch.sh's deliberately trigger-free one) that fires
`fm-relaunch.sh run` only when no firstmate session already holds the
lock AND real pending work exists (wake queue, a stalled task with a
dead backend endpoint, or an unblocked queued backlog item), then
self-throttles via a cooldown file so a fast-failing relaunch can't
tight-loop. Closes the gap where a shared account spend/usage limit
stalls the whole fleet overnight with no one awake to notice it clear.
@imemdev
imemdev force-pushed the fm/fm-orchestrator-tool branch from 510e098 to 44fd6c2 Compare July 23, 2026 10:59
@imemdev imemdev changed the title feat(bin): add fm-orchestrator.sh, recurring resume watchdog feat(bin): add fm-orchestrator.sh and fm-relaunch.sh for crewmate session resume Jul 23, 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