feat: monitor certsync health on heartbeat - #61
Merged
Conversation
added 4 commits
August 3, 2026 14:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Wire certsync into the firstmate watcher heartbeat so certsync health is monitored without adding a separate escalation path. The certsync project's real health interface is its documented Docker Compose certsync status command, which returns JSON containing healthy and reason fields; the watcher should run that bounded command from the heartbeat only when the certsync project/compose files are present. A confirmed healthy:false JSON reading should enqueue an existing check wake for certsync-health with the unhealthy reason. Healthy, missing, unreadable, invalid JSON, missing docker/jq, or absent certsync deployment must be treated as unknown/quiet so the watcher does not spam, crash, or slow normal heartbeat behavior. Add colocated watcher coverage for healthy, unhealthy, and unknown branches and preserve existing supervision behavior.
What Changed
certsync statuscommand when a home-local deployment is present.checkwake for confirmedhealthy: falseJSON results, including during AFK mode, while keeping healthy, missing, invalid, or unreadable states quiet.FM_CERTSYNC_*configuration knobs and extends watcher triage coverage for healthy, unhealthy, AFK unhealthy, and unknown certsync status paths.Risk Assessment
✅ Low: The change is narrowly scoped to heartbeat certsync probing and colocated watcher coverage, with no material correctness, security, or error-handling issues found, captain.
Testing
Captain, I exercised the changed watcher heartbeat path with the focused watcher triage suite plus a reviewer-readable end-to-end certsync heartbeat matrix; unhealthy JSON surfaced through the existing check wake queue, and healthy/unknown readings produced no wake or stdout.
Evidence: Focused watcher triage test log
Evidence: Certsync heartbeat end-to-end matrix
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
bin/fm-watch.sh:986- The default certsync deployment path is resolved from FM_ROOT, but project clones belong to the active FM_HOME. In any home where the tracked code root and operational home differ, the watcher will look in the shared code checkout instead of the home’s projects directory, treat certsync as absent, and never monitor an installed certsync clone unless FM_CERTSYNC_PROJECT is manually set. Default this to$FM_HOME/projects/hlr-certsync(or the home’s project override if that is intended) and add a test withFM_HOME != FM_ROOT_OVERRIDE.🔧 Fix: Captain: Default certsync discovery to FM_HOME
1 warning still open:
bin/fm-watch.sh:1668- When AFK mode is active, the heartbeat path queues a generic heartbeat before reachingcertsync_health_reason, so certsync is never checked and a confirmedhealthy:falseJSON does not enqueue the requestedcheck certsync-healthwake. The away daemon self-handles generic heartbeat wakes and only runs its status-file catch-all, so this health signal is missed until AFK is cleared.🔧 Fix: Captain: Check certsync before AFK heartbeat
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
./tests/fm-watch-triage.test.sh > /tmp/no-mistakes-evidence/01KZ40R867KJ81ASD9R1P5A1YT/fm-watch-triage.test.log 2>&1Manual evidence run usingbin/fm-watch.shwith a fake Docker Composecertsync statuscommand for healthy, unhealthy, and invalid-JSON payloads, followed bybin/fm-wake-drain.shfor the unhealthy case; output saved to/tmp/no-mistakes-evidence/01KZ40R867KJ81ASD9R1P5A1YT/certsync-heartbeat-matrix.txt✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.