Skip to content

feat(bin): add away-mode escalation alert to supervise daemon - #2978

Closed
Paresh95 wants to merge 4 commits into
kunchenguid:mainfrom
Paresh95:fm/away-mode-escalation-alert
Closed

Paresh95 wants to merge 4 commits into
kunchenguid:mainfrom
Paresh95:fm/away-mode-escalation-alert

Conversation

@Paresh95

Copy link
Copy Markdown

Intent

Add an away-mode escalation alert to firstmate's supervise daemon. The wedge alarm (config/wedge-alarm) only pings an external channel (osascript/herdr/command:) when injection itself fails to confirm delivery into the supervisor pane - a rare failure mode. It never fires when a real, captain-relevant escalation (PR ready for review, ask-user decision, blocker) is successfully injected but the captain is away from the pane and never sees it, which is the far more common case for anyone using /afk. This adds a second, independent alert (config/escalation-alert, FM_ESCALATION_ALERT_CHANNEL, FM_ESCALATION_ALERT_EXEC) that fires on every successful escalate_flush of a genuine escalation digest, reusing the wedge alarm's channel directive syntax (off/auto/osascript/herdr/command:) and safety machinery (bounded process-group execution, argv-safe command dispatch, a dedicated test-seam distinct from FM_WEDGE_ALARM_EXEC so tests for one trigger can never fire the other's real notifier). Deliberately no additional rate limiting beyond the natural escalate_flush batch window (FM_ESCALATE_BATCH_SECS), unlike the wedge alarm's own throttle, since a distinct later escalation should still ping rather than being silently suppressed. Docs updated: docs/wedge-alarm.md (new section), docs/configuration.md (new config section + env var reference), docs/examples/escalation-alert (new copyable example), .agents/skills/afk/SKILL.md (mention), AGENTS.md (config file listing). Tests added to tests/fm-daemon.test.sh mirroring the existing wedge-alarm test patterns (library-mode discard default, successful-flush integration test, off-directive, osascript channel selection, command channel), plus a matching recorder seam added to tests/wake-helpers.sh. Verified locally: tests/fm-daemon.test.sh passes in full (all existing + new tests), and bin/fm-lint.sh's shellcheck pass is clean.

What Changed

  • Added a second, independent alert path (config/escalation-alert, FM_ESCALATION_ALERT_CHANNEL, FM_ESCALATION_ALERT_EXEC) to bin/fm-supervise-daemon.sh that fires on every successful escalate_flush of a genuine escalation digest, reusing the wedge alarm's channel directive syntax (off/auto/osascript/herdr/command:) and bounded process-group/argv-safe dispatch, with its own test-seam (FM_ESCALATION_ALERT_EXEC) kept separate from FM_WEDGE_ALARM_EXEC.
  • Unlike the wedge alarm, no additional rate limiting is applied beyond the natural FM_ESCALATE_BATCH_SECS batch window, so distinct later escalations still notify.
  • Updated docs (docs/wedge-alarm.md, docs/configuration.md, docs/documentation-audiences.json, new docs/examples/escalation-alert, .agents/skills/afk/SKILL.md, AGENTS.md) and added tests (tests/fm-daemon.test.sh, tests/wake-helpers.sh) covering library-mode discard default, successful-flush integration, off-directive, osascript channel selection, and command channel.

Risk Assessment

✅ Low: The change is an additive, well-isolated feature that closely mirrors the existing, already-tested wedge-alarm implementation pattern (independent config file, env overrides, dedicated test-only exec seam, bounded process-group dispatch), with matching tests and docs, and no removal or contradiction of required/forbidden intent constraints.

Testing

Executed the targeted shell test suite tests/fm-daemon.test.sh end-to-end; it exercises the daemon's real escalate_flush/notify code paths (not source-grepping) via temp state dirs and recorder seams, and all tests passed cleanly with exit code 0, confirming the new escalation-alert channel selection, off-directive, and command/osascript dispatch behave as intended without regressing the existing wedge-alarm and escalation-classification tests.

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-daemon.test.sh (full suite, exit 0, all ok)
  • test_escalation_alert_library_mode_defaults_to_discard
  • test_escalation_alert_fires_on_successful_flush
  • test_escalation_alert_off_disables_alert
  • test_escalation_alert_osascript_channel_selected
  • test_escalation_alert_command_channel_receives_summary
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Install actionlint so fm-lint.sh passes; no source changes needed
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

Paresh Sharma added 2 commits August 24, 2026 22:18
…edges

The wedge alarm's off-pane notification channel (config/wedge-alarm) only
fires when injection itself cannot be confirmed - a rare failure mode.
A real, captain-relevant escalation (PR ready, ask-user decision, blocker)
that is successfully injected into the supervisor pane has no way to reach
an away captain who isn't looking at that pane.

Add an independent escalation alert (config/escalation-alert), reusing the
wedge alarm's channel syntax and safety machinery, that fires on every
successful escalate_flush of a real escalation digest. Rate-limited only by
the natural escalation batch window, since a distinct later escalation
should still ping rather than being throttled the way the wedge alarm
intentionally is.
@greptile-apps

greptile-apps Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (3): Last reviewed commit: "docs(AGENTS): fix escalation-alert catal..." | Re-trigger Greptile

Comment thread bin/fm-supervise-daemon.sh Outdated
Comment thread .agents/skills/afk/SKILL.md Outdated
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: first look on current main 038d0f7 (#2942). Never messaged the captain.

class=opt-in. Code: absent config/escalation-alert and unset FM_ESCALATION_ALERT_CHANNEL emit off. Distinct from wedge-alarm default-on auto. Not auto: NM mismatch plus AGENTS.md catalog error.

VISION.md: one-captain interface aligns; authority aligns as opt-in (absent=off); scripts align; restart aligns; spine aligns; vendor aligns; scope aligns.
Related #2917 (herdr busy-guard, 0 sent): this PR does not fix it. Alert fires only after successful inject.
Author note: AGENTS.md says absent means auto. Implementation, tests, docs/configuration.md, docs/wedge-alarm.md, and the example file all say off. Please fix the catalog to absent means off.
This HEAD: bbbe206. MERGEABLE / UNSTABLE, ahead 3 / behind 0.
Attestation 57ab932 does not match THIS HEAD (later no-mistakes apply CI fixes).
Fork CI was action_required; approved this pass after full diff review (first-time fork, Paresh95 has no other firstmate PRs).
Workflows this pass: CI 32780848458, Require no-mistakes 32780848524. Not green at comment time. Greptile is not a merge gate.
Security: none. command: is captain-configured, same bounded pattern as wedge-alarm; library-mode discard default.
Overlap: none with standing holds. bin/fm-supervise-daemon.sh also in leftover #2980 (closing).
Land-eligible rec: NO. Captain-flag NOW: no.
This is waiting-on-author (HEAD-matching attestation plus AGENTS.md auto/off fix). Not a captain-decision yet. Not a merge I will recommend.

Matches implementation, tests, docs/configuration.md, docs/wedge-alarm.md,
and the example file, which all already state absent means off.
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.

2 participants