Repository navigation
Description
Summary
The canary green→red Slack alert (services/canary_alerts.py) carries invariant_id, severity, violation count, snapshot_time and the persisted row ids — but nothing identifying which Trinity instance produced it. With more than one instance posting to the same webhook, an alert is unattributable: you know S-01 fired somewhere in the fleet, not where to look.
Context
Latent until now because dev was the only instance with CANARY_SLACK_WEBHOOK_URL set (2026-05-11). As of today eu2 carries the same webhook — enabled for the #1766 pull/work-stealing soak — so every alert in that channel is now ambiguous, and it gets worse with each instance added.
This matters most in exactly the situation the alert exists for: during the #1766 soak, an S-01 or L-03 alert needs to be triaged as "eu2, the pilot" or "dev, unrelated" within seconds. Guessing costs the response its value.
Trinity already has the information — no new env var strictly required
In rough order of usefulness:
| Source | On eu2 | Notes |
|---|---|---|
FRONTEND_URL (config.py:94) |
https://eu2.abilityai.dev |
Best fit. Human-readable, the host's first label is the ops slug, already set on managed instances, already forwarded by docker-compose.prod.yml:211. Not guaranteed on OSS/local installs → needs a fallback |
PUBLIC_CHAT_URL (config.py:98) |
https://public-eu2.abilityai.dev |
Set, but names the public-chat host rather than the instance; public- prefix is noise in a label |
installation_id (operator_intake_service.get_or_create_installation_id) |
durable UUID in system_settings |
Genuinely unique and stable, but opaque — useless as a Slack label on its own. Good as a machine-readable secondary field |
| container hostname | docker id | Meaningless to a human |
Proposal
- Add an optional explicit override
TRINITY_INSTANCE_NAME(unset by default) for operators who want a specific label. - When unset, derive one from
FRONTEND_URL's host (first DNS label, e.g.eu2). - Fall back to
installation_id[:8]when neither is available, so an OSS install still gets something distinguishing rather than an unlabelled alert. - Surface it in the Slack payload — the block header and/or a context line — so it's visible without expanding the message.
Deliberately not proposing a new required var: managed instances already carry FRONTEND_URL, and adding a mandatory key would need a fleet-wide .env rollout before alerts improved anywhere.
Acceptance Criteria
- Canary Slack alerts identify the originating instance in the visible part of the message
- Resolution order is override →
FRONTEND_URLhost →installation_idprefix, with no crash when all are absent - Unit coverage for each resolution branch, including the all-absent fallback
- The webhook URL is still never logged or echoed (existing property in
canary_alerts.py— don't regress it) - Instances sharing one webhook produce visibly distinct alerts
Technical Notes
- Sink:
services/canary_alerts.py(_build_slack_payload+ the send path); transport isslack_service.post_webhook. - The label resolver is worth putting somewhere reusable — any future webhook sink (operator-queue alarms, retention-guard alarms) has the identical anonymity problem.
- Alerts fire only on green→red transitions and a continuing-red does not re-post, so each alert is a one-shot and carrying full context in it matters more than it would for a repeating notification.
- Related: Production soak-test of pull/work-stealing coordination (#1081) before default-on #1766 (the soak that made this urgent), Research and implement orchestration invariant catalog + continuous canary harness #411 (CANARY-001).
Activity
docs(canary): state the tier-3 write side effect at its call site (#1987
feat(canary): name the instance that fired a Slack alert (#1987) (#1997)
fix(telemetry): the activation-funnel read no longer mints installati…
refactor(tests): an OSS guard pins the caller set of the identity-min…