Repository navigation
Description
What's the problem
Part of #3557. Telegram alerts have 25 per-event switches plus two tamper alarms (telegram.events.*). Each is rendered as its own TELEGRAM_EVENT_* variable, read into TELEGRAM_EVENTS in the dashboard config, and listed in the control allowlists. telegram.enabled repeats what the bot token and chat id already say. A non-technical user cannot choose among 25 switches.
Owner ruling (lean roadmap and #3566 section F, 2026-10-21; Settings mockup, 2026-10-27): Alerts become Connect Telegram (bot token, chat id), then one level, All / Important / Critical / Off, with the wallet-changed and clearnet-exposed alarms always on and not switchable.
Target model:
- Keys:
telegram.bot_token,telegram.chat_idandtelegram.level(off,critical,important,all). Absent meansoff.telegram.enabledandtelegram.events.*are removed. Telegram delivery exists when the token and chat id are both set. - Optional alerts by level, kept in one table (a product call):
- Critical (6):
node_down,node_recovered,container_unhealthy,db_unhealthy,disk_space,hashrate_loss. - Important adds (13):
worker_offline,worker_recovered,sync_finished,db_reset,xvb_no_share,xvb_registration,hashrate_low,high_reject_rate,hugepages,low_ram,payout_found,payout_confirmed,raffle_win. - All adds (6):
worker_joined,worker_left,stack_online,daily_summary,block_found,new_release. - Off: no optional alerts.
- Critical (6):
- Delivered at every level including Off, whenever the token and chat id are set: the tamper alarms
wallet_changedandclearnet_exposed, andpayout_wallet_down(it has no opt-out today). dashboard.hashrate_drop_thresholdanddashboard.hashrate_drop_minutesstay loadable as Advanced overrides; each level uses 50 % over 10 minutes (today's default) until measured.telegram.daily_summary_timeandtelegram.commands.enabledstay Advanced and unchanged.
What it impacts
- Every user with Telegram configured: after migration some optional alerts start or stop. A user with a token and chat id but
enabledfalse or absent (2.0.0 sent nothing) starts receiving the always-on alarms. - The tamper alarms stop being silenceable, reversing the 2026-09 allowance (typed APPLY and envelope, config panel must be able to change every config field (telegram, hostname, dashboard password, healthchecks), gated where the product's rules require #2367). The owner's lean roadmap asks for this. To stop all Telegram delivery a user clears the token or chat id, which stays on the stricter approval route.
- Webhook and ntfy users: no change intended. Their sinks already carry every event kind; per-event filtering is Telegram-only today.
- The Alerts card on the new Settings page (Sovereign: organize mining and advanced settings without losing fields #2530, which absorbed Sovereign: expose all notification destinations and event subscriptions #2535) is built on this model. The current dashboard UI gets no new behaviour and is deleted at the 2.1.0 cutover (Sovereign: verify complete feature coverage, accessibility and migration #2547).
How I found it
Read-only scan of develop at 9249b0b on 2026-10-21 from the lean roadmap's Config keys and Dashboard controls tables and docs/telegram.md, re-read on 2026-10-27 against the notifier, the sinks and the render step. Nothing was executed. Checked: the 25 events above are exactly today's 25 switches; notify_sinks.py documents that webhook and ntfy push every event kind. Contradiction fixed here: the earlier text called the tamper alarms not switchable yet delivered them only at levels other than Off, while the owner ruling says always on. TELEGRAM_ENABLED is also read by the bot commands and the topology and egress views, not only the alerter.
Operator note, 2026-10-27: this does not wait for the Essentials key cut (#3576). Land it one at a time with the other #3557 children, after #3632, rebased on develop-v2.1.0.
Unknown: the right level for each event beyond this proposal; per-level hashrate thresholds (the roadmap gives only Critical = 50 %/10 min); the level the setup flows preselect once credentials are entered (absent stays off here); whether develop-v2.1.0 still matches the 9249b0b reads.
How important is it
Medium-high. It removes the largest group of settings and a source of silent misconfiguration, makes the tamper alarms impossible to silence, and the Alerts card in Settings (#2530) depends on it. It is not a release emergency.
Acceptance criteria
- Tier-1 (new pytest in
dashboard/tests/service): for each ofcritical,importantandallthe delivered optional events equal the table;offand an absent level deliver no optional event; an unknown level falls back toallwith a log line. At every level includingoff,wallet_changed,clearnet_exposedandpayout_wallet_downare delivered when token and chat id are set, and nothing reaches Telegram when either is missing. - Tier-1: with a webhook and an ntfy sink configured, both still receive every event at every level; the level gates Telegram only.
- Tier-1:
render_envemitsTELEGRAM_LEVELand none of the 27TELEGRAM_EVENT_*variables orTELEGRAM_ENABLED;36-quadlet-units.shand the support-bundle variable list (07-support-bundle.sh) follow. The alerter, bot commands, topology and egress views read the derived "token and chat id set" flag. - Tier-1:
TELEGRAM_LEVELis direct-commit like the toggles were. TheTELEGRAM_ENABLEDapproval rows (APPROVAL_ENV_KEY_PATHSinconfig_operations.py,CONTROL_DASHBOARD_APPROVAL_KEYSin42-control-policy-and-host-checks.sh) are removed; bot token and chat id keep the stricter unlisted route.dashboard/tests/service/test_env_key_perimeter.pyandtests/stack/control/test-control-editable-allowlist.shstay green. - Tier-1 migration fixtures of 2.0.0 configs (in
tests/stack/config/migration.shand the 2.0.0 fixtures if Cut the visible config keys to the Essentials and migrate 2.0.0 configs safely #3576 has added them, otherwise Telegram fixtures of their own; the step sits besidemigrate_removed_telegram_control):- Token, chat id and
enabled = true: the 25 optional toggles (absent counts as on, as in 2.0.0) map by symmetric difference to the nearest level; ties go to the more verbose; an empty set maps tooff. - Credentials with
enabledabsent or false map tooff. - One warning line lists the events whose delivery changes, including the always-on alarms starting. A config with
wallet_changed = falseorclearnet_exposed = falsewarns that the tamper alarms are now always on. - A second run changes nothing and a dry run writes nothing.
- Token, chat id and
- Tier-1:
39a-describe-change-notifications.shdescribes a level change in words (which alert kinds start or stop), drops the tamper-alarm switch-off case and no longer names removed keys;./pithead test-alertstill reaches every configured sink. docs/telegram.mdreplaces the event-key table with a level column and names the always-on alarms; the dropped keys are listed indocs/configuration.md(in Cut the visible config keys to the Essentials and migrate 2.0.0 configs safely #3576's 'Removed in 2.1.0' table when it exists).- The current dashboard UI gets deletions only: references to
telegram.events.*andtelegram.enabled, and the tests asserting them, are removed where they fail once the keys are gone. NoFIELD_OPTIONSentry, warning text or test is added fortelegram.levelthere; the level control is the Alerts card of Sovereign: organize mining and advanced settings without losing fields #2530. No code comments are added.
Possible solutions
- Level table as a single Python mapping, with the bash side only passing
TELEGRAM_LEVELthrough; a drift test compares it todocs/telegram.md. - Keep
telegram.events.*readable for one release as Advanced overrides for the optional events only (never the tamper alarms) instead of dropping them; costs surface, avoids silent changes. - Per-level hashrate thresholds once measured, instead of one fixed pair.
Earlier scope, kept as evidence only (superseded 2026-10-27; do not implement from it)
What's the problem
Part of #3557. Telegram alerts have 25 event switches plus two tamper alarms (config.reference.json, telegram.events), each rendered as its own TELEGRAM_EVENT_* variable (lib/pithead/33-render-env.sh:207-242), read in dashboard/mining_dashboard/config/config.py (TELEGRAM_EVENTS), and listed in the control allowlists (service/control_service.py, lib/pithead/42-control-policy-and-host-checks.sh). telegram.enabled is redundant with the token and chat id being set. A non-technical user cannot choose among 25 switches.
Proposed: telegram.bot_token, telegram.chat_id and one telegram.level: off, critical, important or all. Absent means off, and telegram.enabled is removed. Delivery is on when token, chat id and a level other than off are present. Proposed membership (a product call, kept in one table):
- Critical (6, plus tamper):
node_down,node_recovered,container_unhealthy,db_unhealthy,disk_space,hashrate_loss. - Important adds (13):
worker_offline,worker_recovered,sync_finished,db_reset,xvb_no_share,xvb_registration,hashrate_low,high_reject_rate,hugepages,low_ram,payout_found,payout_confirmed,raffle_win. - All adds (6):
worker_joined,worker_left,stack_online,daily_summary,block_found,new_release. - Every level, not switchable: tamper alarms
wallet_changedandclearnet_exposed, andpayout_wallet_down.
Hashrate-drop thresholds stay loadable as Advanced overrides; the level supplies 50 % over 10 minutes (today's default) at all three levels until measured.telegram.daily_summary_timeandtelegram.commands.enabledstay Advanced.
what it impacts
Every user with Telegram configured: after migration some alerts may start or stop. The tamper alarms become non-silenceable, which reverses the 2026-09 ruling that allowed silencing them behind a typed APPLY and envelope (42-control-policy-and-host-checks.sh comments on #2367); the owner's lean roadmap asks for this. Webhook and ntfy users: the per-event toggles gate the Telegram notifier (telegram_notifier.py:72); whether they also gate the webhook and ntfy sinks was not traced and must be confirmed. The Alerts card in the lean Settings page (#2535, folded into #2530) is built on this model.
How I found it
Read-only scan of develop at 9249b0b on 2026-10-21 from the lean roadmap's Config keys and Dashboard controls tables and docs/telegram.md (event table lines 163-191). Nothing was executed. Unknown: the right level for each event beyond this proposal, and any per-level hashrate thresholds (the roadmap gives only Critical = 50 %/10 min).
how important is it
Medium-high: it removes the largest group of settings and a source of silent misconfiguration. Needs the migration scaffold from the key-diet issue.
acceptance criteria
- Tier-1 (new pytest in
dashboard/tests/service): for each level the delivered event set equals the table; the tamper alarms andpayout_wallet_downare delivered at every level exceptoff; an absent level delivers nothing; an unknown level value falls back toallwith a log line. - Tier-1 (
tests/stack/config/migration.shfixtures): 2.0.0 configs with token, chat id andenabled = truemap by symmetric difference to the nearest level (ties go to the more verbose; an empty set maps tooff); a config with credentials butenabledabsent or false maps tooff, because 2.0.0 sent nothing for it. One warning line lists the events whose delivery changes. A config withwallet_changed = falseorclearnet_exposed = falsewarns that tamper alarms are now always on. - Tier-1:
render_envemitsTELEGRAM_LEVELand none of the 27TELEGRAM_EVENT_*variables;36-quadlet-units.shand the support-bundle variable list (07-support-bundle.sh) follow. - Tier-1:
TELEGRAM_LEVELis direct-commit like the toggles were;TELEGRAM_ENABLEDand its approval row (config_operations.pyAPPROVAL_ENV_KEY_PATHS) are removed; bot token and chat id keep the stricter unlisted route. Drift guards updated:dashboard/tests/service/test_env_key_perimeter.pyandtests/stack/control/test-control-editable-allowlist.sh. - Tier-1:
39a-describe-change-notifications.shdescribes a level change in words (which alert kinds start or stop);./pithead test-alertstill reaches every configured sink. - Webhook and ntfy gating is confirmed in the PR and covered by a test either way.
docs/telegram.mdreplaces the event-key table with a level column. The current panel and its warnings (telegram.levelinFIELD_OPTIONS,configwarnings.mjstext for the tamper alarms) get only the minimum edits needed to follow the keys; no new current-UI behaviour (ruling 4, v2.1.0 lean UI spec: four pages, one profile control, an Advanced drawer #3566). No new explanatory code comments.
possible solutions
- Level table as a single Python mapping, with the bash side only passing
TELEGRAM_LEVELthrough; a drift test compares it todocs/telegram.md. - Keep
telegram.events.*readable for one release as Advanced overrides instead of dropping them; costs surface, avoids silent changes. - Per-level hashrate thresholds once measured, instead of one fixed pair.
Part of #3557.
Owner decision (operator note, 2026-10-27). The owner ruled on 2026-10-21 (lean roadmap, #3566 section F) that Alerts become one control: Connect Telegram, then one level (All / Important / Critical / Off), with the wallet-changed and clearnet-exposed alarms always on. The user-visible effect: today's per-event switches are replaced by one choice on the new Settings page, which is reviewed in the owner's mockups. On 2026-10-27 the owner directed that this work proceed now, as part of the #3557 configuration model that the Settings page depends on.
Activity
pithead-developer commentedon Oct 27, 2026
Operator: unblocked from #3576. One alert level instead of per-event switches does not need the Essentials key cut first. Land it one at a time with the other #3557 children, after #3632, and rebase on
develop-v2.1.0before review. The Settings mockup shows the target: Connect Telegram, then All / Important / Critical / Off, with the tamper alarms always on.pithead-developer commentedon Oct 27, 2026
Blocked on #3632. The trusted operator instruction requires #3578 to follow PR #3632, which remains open. Reconnaissance is complete; the working tree is clean, and no implementation or tests ran. Resume after #3632 merges into develop-v2.1.0, then implement and verify the Telegram alert-level migration.
The runner resumes this issue when that one closes.
2 remaining items
test(stack): drop the retired telegram event label from the verdict-l…
Merge develop-v2.1.0 into the telegram level branch (#3578)
pithead-developer commentedon Nov 13, 2026
Waiting on a transient bench_outage condition, not on another issue. tier4-e2e 868@222989dd preflight refused: live stack unhealthy, Tor clearnet egress unverified (connect-timeout via SOCKS); baseline verified no. The runner re-checks it (first at 2026-11-13T07:30Z, at most 5 times); the durable fix is tracked in #3626.
telegram: make the level migration compile on jq 1.7 (#3578)
Merge develop-v2.1.0 and drop the allowlist test's budget entry (#3578)
test(integration): stop the support-bundle fixture writing the remove…
test(integration): the support-bundle check proves no chat id instead…
Merge develop-v2.1.0 into the telegram level branch (#3578)
pithead-developer commentedon Nov 15, 2026
Waiting on a transient bench_capacity condition, not on another issue. tier4-kvm 3990@04f8e0a5 errored: required shared node inputs/reservation unavailable after 14400s (sync_wait_seconds=14400); no image build started. tier4-e2e 3989 still queued. The runner re-checks it (first at 2026-11-15T17:01Z, at most 5 times).
Merge develop-v2.1.0; map 2.0.0 telegram switches to a level in the w…
test(stack): the 2.0.0 migration fixtures expect the Telegram level (#…
Merge develop-v2.1.0 into the telegram level branch (#3578)
telegram: replace the per-event switches with one alert level (#3578) (…
pithead-developer commentedon Nov 19, 2026
Merged in #3971.