feat: emergency dispatch to liquidity-monitoring on HIGH/CRITICAL alerts#142
Open
feat: emergency dispatch to liquidity-monitoring on HIGH/CRITICAL alerts#142
Conversation
… alerts When infinifi fires a HIGH or CRITICAL alert (e.g. liquid reserves drop), dispatch a repository_dispatch event to liquidity-monitoring so it can zero affected market caps and run reallocation immediately. - Add utils/alert.py: structured alert system with severity levels and hooks - Add utils/dispatch.py: GitHub API dispatch with per-protocol cooldown - Update infinifi/main.py: migrate to alert system, register dispatch hook - Add GITHUB_PAT_DISPATCH to workflow env - Add tests for alert system and dispatch logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tapired
reviewed
Mar 1, 2026
Collaborator
tapired
left a comment
There was a problem hiding this comment.
no alerts for alert4 and alert5? Alert4 looks legit to be a "high" too, no?
Also fix MEDIUM silent default in alert tests to match code behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
For alert4 and alert5, alert level is set to high: https://github.com/yearn/monitoring-scripts-py/pull/142/changes#diff-82e25bc51cb58224e74ebaac9ac5355b2c0e5bef96527575455fa86e0d849c3bR59 |
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.
Summary
utils/alert.py) with severity levels (LOW/MEDIUM/HIGH/CRITICAL) and hook supportutils/dispatch.pythat sendsrepository_dispatchtotapired/liquidity-monitoringwhen a HIGH or CRITICAL alert fires for a configured protocolinfinifi/main.pyfrom rawsend_telegram_messagetosend_alert(Alert(...))and registers the dispatch hookGITHUB_PAT_DISPATCHsecret to workflow envHow it works
send_alert(Alert(AlertSeverity.HIGH, ...))dispatch_emergency_withdrawalPOST /repos/tapired/liquidity-monitoring/dispatcheswith{protocol, severity}Companion PR
Receiving side: https://github.com/tapired/liquidity-monitoring/pull/139
Setup required
actions:writescoped totapired/liquidity-monitoringGITHUB_PAT_DISPATCHto this repoTest plan
gh api repos/tapired/liquidity-monitoring/dispatches -f event_type=emergency_withdrawal -f 'client_payload={"protocol":"infinifi","severity":"HIGH"}'🤖 Generated with Claude Code