sensor-monitor: react to alert message when a rule resolves#8
Closed
Daniel Botros (danielbotros) wants to merge 4 commits into
Closed
sensor-monitor: react to alert message when a rule resolves#8Daniel Botros (danielbotros) wants to merge 4 commits into
Daniel Botros (danielbotros) wants to merge 4 commits into
Conversation
When a rule clears (its reading returns to the non-triggered side of the
threshold), add an emoji reaction — ✅ by default — to the
original alert message so operators get an at-a-glance "handled" marker
without a follow-up notification.
The monitor captures each alert's channel/ts from the notifier's send
response and, on the clearing edge, calls
DoCommand({"command": "react", ...}) on the notifier, then clears the stored
identity so it reacts exactly once. A cooldown re-send reacts to the latest
message. Requires a notifier that supports the react command and returns a
message ts (the viam:notifications:slack bot-token path); when no ts is
available (e.g. a Slack webhook) the step is silently skipped. Configurable
via resolve_reaction (set "-" to disable). Best-effort: failures are logged
and never affect monitoring.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move resolve_reaction from the top-level config onto Rule, next to the message it reacts to, and drop the default/disable sentinel: when a rule's resolve_reaction is set the monitor reacts with that emoji on resolve, and when it's unset nothing is added. Each rule opts in independently, and the sensorMonitor no longer needs a resolveReaction field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… identity Replace the Slack-specific msgChannel/msgTS fields on ruleState with a single opaque sentMessage map holding the notifier's send response. On resolve the monitor copies that response back and adds command/name, so it never has to know how a notifier identifies a message. A test injects an opaque field into the send response and asserts it is echoed verbatim on react. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rom Slack Reword the sentMessage/sendNotification/sendResolveReaction comments to treat the stored value as opaque message metadata rather than a notifier-specific send response, make the test fake return an arbitrary opaque map instead of a Slack-shaped ts/channel (folding the redundant echo test into the main one), and drop the Slack bot-token / ts / webhook specifics from the README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds a per-rule
resolve_reactiontosensor-monitor: when a rule's sensor reading returns to the non-triggered side of the threshold, the monitor reacts to that rule's alert message with the configured emoji.resolve_reactionlives onRule. When unset, no reaction is added — no default, no disable sentinel.sentMessage. On the clearing edge it passes that metadata back viaDoCommand({"command": "react", "name": <emoji>, ...}), so the monitor doesn't know or care how a notifier identifies a message.Why
Closes the maintenance-alert loop: a Streamdeck "Refill" button resets a usage counter, the monitor sees the value drop below threshold on its next poll, and checkmarks the alert it sent.
Depends on
A notifier that supports the
reactcommand — see viam-modules/notifications#4. Best-effort: a failure (e.g. a notifier that can't react) is logged and never affects monitoring.🤖 Generated with Claude Code