feat(notifications): add sf-telegram-notifier Lambda for all 3 alpha-engine SFs#275
Merged
Conversation
…engine SFs Subscribes to EventBridge `Step Functions Execution Status Change` events for the saturday / weekday / eod pipelines and forwards human-readable summaries to the alpha-engine Telegram bot via the canonical `alpha_engine_lib.telegram.send_message` primitive. Purely additive: existing SNS → email path on every SF (NotifyComplete + HandleFailure) is unchanged. New EventBridge rule subscribes to the same status changes in parallel, zero blast radius on the trade-decision pipeline. One rule covers all five status transitions in a single mechanism: RUNNING (silent — avoids 5:45 AM PT daily phone-buzz), SUCCEEDED, FAILED, TIMED_OUT, ABORTED (all push). FAILED enriches the message with the error+cause snippet via best-effort states:DescribeExecution. Telegram credentials reuse the SSM parameters already provisioned for the executor notifier.py arc (ROADMAP L1067, 2026-05-13) — no new secret material. Operator-deployed (--bootstrap + code-only update flows), not wired into CI, matching the spot-orphan-reaper / changelog-cloudwatch-mirror convention to keep the OIDC role's blast radius narrow. Tests: 12 new unit tests covering all 5 status transitions, FAILED cause fetch + fail-soft, duration formatting, unknown-SF fallback, send_message failure surfacing. Full repo suite still 1399 passed / 1 skipped. Co-Authored-By: Claude Opus 4.7 (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.
Summary
infrastructure/lambdas/sf-telegram-notifier/Lambda subscribes to EventBridgeStep Functions Execution Status Changeevents for the saturday / weekday / eod pipelines and forwards human-readable summaries to the alpha-engine Telegram bot viaalpha_engine_lib.telegram.send_message.NotifyCompletesuccess +HandleFailurefailure branches) is unchanged. The new EventBridge rule subscribes to the same status changes in parallel; zero blast radius on the trade-decision pipeline.RUNNING(silent, avoids 5:45 AM PT daily phone-buzz),SUCCEEDED,FAILED,TIMED_OUT,ABORTED(all push).FAILEDenriches the message with the error+cause snippet via best-effortstates:DescribeExecution.Why
Brian asked for Telegram coverage on SF launches, errors, and successes, with email staying as-is. The EventBridge SF-status-change source is the cleanest pickup point — single rule, no SF JSON edits, trivially extensible to future SFs.
Telegram credentials reuse the SSM parameters already provisioned for the executor
notifier.pyarc (ROADMAP L1067, 2026-05-13) —/alpha-engine/TELEGRAM_BOT_TOKEN+/alpha-engine/TELEGRAM_CHAT_ID. No new secret material.Architecture
Deploy
Operator-deployed (matches spot-orphan-reaper / changelog-cloudwatch-mirror convention to keep the OIDC role's blast radius narrow). After merge:
Subsequent code changes use the default zero-arg invocation.
Test plan
send_messagefailure surfacingdeploy.sh --dry-runexercises syntax check + unit tests + pip-install-to-target + zip packaging (22 MB final zip — well under the 50 MB Lambda limit)--bootstrapthen--smoketo verify live wiring (manual; first SF status change after bootstrap will be the real validation)🤖 Generated with Claude Code