Skip to content

feat: instance-level OPS notification Slack webhook (OPS-SLACK) #1100

Open

Description

@vybe

Summary

Add an instance-level Slack webhook so agents can report operational (OPS) notifications to a single configured Slack channel with zero per-agent setup. Configured by one env var, mirroring the existing CANARY_SLACK_WEBHOOK_URL pattern; silent no-op when unset. Agents already emit structured notifications via the send_notification MCP tool (NOTIF-001) — those notifications currently surface only in the Trinity UI. This feature tees them to the configured Slack channel so operators see critical agent events where they already work.

Context / Motivation

Operators need agent OPS events (failures, alerts, questions, custom notifications) visible in Slack without configuring a per-agent Slack channel binding for every agent. The platform already proves this exact shape with the Canary watcher, which posts Block Kit alerts to CANARY_SLACK_WEBHOOK_URL via services/canary_alerts.py. Reusing that pattern gives an "easy integration": set one webhook URL, and any agent's notifications flow to the channel.

This is the instance-level, low-friction complement to the broader per-agent routing tracked in #224.

Scope

Configuration (instance-level)

  • New env var OPS_SLACK_WEBHOOK_URL (mirrors CANARY_SLACK_WEBHOOK_URL).
  • Added to .env.example and docker-compose.yml backend env.
  • Unset = silent sink: notifications still persist + broadcast over WebSocket as today; no Slack post attempted.
  • Optional per-notification-type on/off filter (e.g. route alert and error types, skip routine info).

Integration (easy path)

  • Tee send_notification (NOTIF-001) writes in routers/notifications.py to the webhook after the existing persist + WebSocket broadcast.
  • Fire-and-forget POST; a Slack failure must never fail or block the notification write.
  • Block Kit composition reusing the services/canary_alerts.py-style stateless composer (agent name, type/severity badge, title, body, timestamp, link back to the Trinity UI).

Out of scope (covered elsewhere)

Acceptance Criteria

  • OPS_SLACK_WEBHOOK_URL is read at startup and documented in .env.example + docker-compose.yml.
  • When set, an agent send_notification call results in a Block Kit message in the configured Slack channel.
  • When unset, no Slack POST is attempted and notification persistence/WebSocket broadcast is unchanged (silent sink).
  • A Slack delivery failure (timeout, non-2xx) is swallowed and never fails the originating notification request.
  • Notification type filtering is configurable (which types route to Slack).
  • Message includes agent name, type/severity badge, title, body, and a link back to the Trinity UI.
  • Unit test: composer renders expected Block Kit; sink is a no-op when the env var is empty.

Technical Notes

  • Pattern to copy: src/backend/services/canary_alerts.py (stateless Block Kit composer + webhook POST) and its env wiring in src/backend/main.py / src/backend/routers/settings.py.
  • Integration point: src/backend/routers/notifications.py — tee after the existing _broadcast_notification step. Keep the three-layer boundary: router calls a new services/ops_slack_service.py (or extend the notification service); no HTTP/Slack logic inline in the router.
  • MCP surface: no new tool needed — send_notification (src/mcp-server/src/tools/notifications.ts) is already the agent-facing entry point; this is a server-side fan-out.
  • Reliability: treat the webhook POST as best-effort fire-and-forget (consistent with how the agent liveness heartbeat and canary alerts are non-blocking).

Related Issues

Activity

  1. added
    priority-p2
    type-feature
    theme-channels
    complexity-medium
    on Jun 8, 2026
  2. added
    status-incubating
    on Jun 14, 2026
  3. added
    status-ready
    complexity-low
    and removed
    status-incubating
    on Jul 13, 2026
  4. removed
    complexity-medium
    on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p2status-readytheme-channelstype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions