Scheduling & Notifications
Relevant source files
The following files were used as context for generating this wiki page:
Scheduling and Notifications provide the infrastructure for automated tool execution and alerting within superglue. The system enables users to run multi-step workflows on recurring schedules and receive real-time or summarized alerts regarding tool performance and failures.
The scheduling engine, located in packages/core/scheduler/, manages cron-based execution of tools. The notification system, primarily handled by the NotificationService, monitors these runs and dispatches alerts via supported channels like Slack or Email.
Notification System Architecture
The NotificationService manages the lifecycle of alerts by processing run completions and applying organizational rules. It uses a rate limiter and a circuit breaker pattern to ensure system stability and avoid alert fatigue.
The diagram shows the logic flow from a run completing to a notification being dispatched.
Sources: packages/core/notifications/notification-service.ts:25-50
Key Components
| Component | Responsibility |
|---|---|
NotificationService | Orchestrates run processing, rule matching, and channel dispatching. |
SlackNotifier | Constructs message blocks and sends alerts via Slack Webhooks or Bot Tokens. |
RateLimiter | Enforces global limits on the number of notifications sent per organization. |
Circuit Breaker | Disables failing channels after three consecutive errors to prevent wasted resources. |
Sources: packages/core/notifications/notification-service.ts:13-20, packages/core/notifications/notifiers/slack-notifier.ts:12-25
Notification Rules and Filtering
Notifications are triggered based on NotificationRule configurations. Each rule contains conditions that must be met before an alert is dispatched.
- Status Filtering: Rules specify if they apply to
failed,success, oranyrun status. - Source Exclusion: Requests from
frontendandmcpsources are ignored by the notification service. - Pattern Matching: The system supports glob patterns (e.g.,
*) for matchingtoolIdvalues. - Source Verification: Rules can be restricted to specific request sources like
scheduler,webhook, orapi.
This class diagram represents the structure of notification triggers defined in the system.
Sources: packages/core/notifications/notification-service.ts:77-110
Slack Notifier Implementation
The SlackNotifier handles three primary types of communication: single run alerts, test notifications, and period summaries.
Message Delivery Methods
- Webhooks: Sends a JSON payload to a pre-configured URL.
- Bot Tokens: Uses the Slack API
chat.postMessagewith an OAuth token and handles automatic channel joining.
Failure Handling
When a notification fails, the service increments a consecutiveFailures counter. If the counter reaches 3, the channel status changes to disabled. Successful sends reset this counter.
Sources: packages/core/notifications/notifiers/slack-notifier.ts:230-280, packages/core/notifications/notification-service.ts:173-195
Alert Investigation
Failure notifications include deep links to the superglue web interface:
- View Details: Links to the admin dashboard for the specific run.
- Investigate Failure: Links to the AI agent investigation tool, passing the
runId.
Sources: packages/core/notifications/notifiers/slack-notifier.ts:182-220, packages/web/src/lib/agent/agent-context.ts:210-250
Scheduling and Run Investigation
Scheduled runs are identified by the scheduler request source. When a scheduled run fails, the system provides specific diagnostic approaches for the AI agent.
The sequence shows how scheduled failures transition into investigation contexts for the user.
Sources: packages/web/src/lib/agent/agent-context.ts:285-300, packages/core/notifications/notification-service.ts:25-35
Scheduled Run Analysis
When investigating failures triggered by the scheduler, the agent focuses on:
- Checking availability of external dependencies (APIs, services).
- Identifying rate limiting issues for frequent schedules.
- Verifying if credentials or tokens expired at the scheduled execution time.
Sources: packages/web/src/lib/agent/agent-context.ts:290-305
Summary Notifications
The system generates daily or weekly summaries of tool performance. The NotificationSummaryPayload contains statistical data including successCount and failedCount for each tool.
| Field | Description |
|---|---|
period | The summary timeframe: daily or weekly. |
toolStats | Array of objects containing toolId, successCount, and failedCount. |
adminUrl | Link to the organizational dashboard. |
The Slack summary includes a formatted table of the top 20 performing tools.
Sources: packages/core/notifications/notifiers/slack-notifier.ts:60-125
Scheduling and Notifications ensure that superglue tools remain operational without manual intervention. By combining cron-based triggers with a robust, circuit-breaking notification layer, the project provides visibility into automated workflow health and immediate pathways for failure resolution through AI-assisted investigation.