Notifications¶
Discord notification system for task updates and agent events.
Notification formatting for Discord messages about task lifecycle events.
String formatters (format_*) produce human-readable markdown strings
that are easy to unit test without a live Discord connection and are used for
logging and plain-text fallback.
Embed formatters (format_*_embed) produce discord.Embed objects for
rich Discord presentation — color-coded by severity, with structured fields for
task metadata. The orchestrator passes both versions through the notification
callback so the bot can choose the appropriate format.
Interactive views (TaskFailedView, TaskApprovalView,
AgentQuestionView) attach action buttons to notification embeds so users
can retry, skip, approve tasks, or reply to agent questions directly from
Discord without memorizing slash commands.
classify_error pattern-matches raw error messages against known failure modes
and returns an actionable fix suggestion -- this turns opaque stack traces into
guidance the user can act on immediately from Discord.
Classes¶
TaskStartedView ¶
Bases: View
Action button attached to task-started notifications.
Provides a one-click "Stop Task" button so the user can cancel a running task directly from the notification message without needing to find the task ID or type a slash command — especially useful on mobile.
Source code in src/discord/notifications.py
TaskFailedView ¶
Bases: View
Action buttons attached to failed task notifications.
Provides one-click Retry and Skip buttons so the user doesn't
have to remember /restart-task or /skip-task slash commands.
The handler is passed at creation time and called when buttons are pressed.
Source code in src/discord/notifications.py
TaskApprovalView ¶
Bases: View
Action buttons attached to PR-created / awaiting-approval notifications.
Provides one-click Approve and Restart buttons for tasks in AWAITING_APPROVAL status.
Source code in src/discord/notifications.py
AgentReplyModal ¶
Bases: Modal
Modal dialog for replying to an agent's question.
Opens a text input where the user can type their response. On submit
the reply is forwarded via CommandHandler.execute("provide_input", …)
so the agent's next execution cycle receives the user's answer.
Source code in src/discord/notifications.py
TaskBlockedView ¶
Bases: View
Action buttons for blocked task notifications.
Provides Restart and Skip buttons for tasks that have exhausted retries.
Source code in src/discord/notifications.py
AgentQuestionModal ¶
Bases: Modal
Modal dialog for typing a reply to an agent question.
Opened when the user clicks the "Reply" button on an agent question
notification. On submit, calls CommandHandler.execute("provide_input", ...)
to transition the task from WAITING_INPUT → READY with the user's reply
appended to the task description.
Source code in src/discord/notifications.py
AgentQuestionView ¶
Bases: View
Action buttons attached to agent question notifications.
Provides a one-click "Reply" button that opens a modal text input so the user can answer the agent's question without memorizing slash commands. A secondary "Skip Task" button allows skipping the task entirely.
Source code in src/discord/notifications.py
Functions¶
format_server_started ¶
Plain-text message indicating the server is back online.
format_server_started_embed ¶
Rich embed announcing the server is back online.
Uses a green success embed to clearly signal that the system is operational and ready to accept work.
Source code in src/discord/notifications.py
classify_error ¶
Return (error_type_label, fix_suggestion) for a given error message.
Falls back to a generic label when no pattern matches.
Source code in src/discord/notifications.py
format_chain_stuck ¶
Format a notification about downstream tasks stuck because of a blocked task.
Source code in src/discord/notifications.py
format_stuck_defined_task ¶
format_stuck_defined_task(task: Task, blocking_deps: list[tuple[str, str, str]], stuck_hours: float) -> str
Format a notification for a DEFINED task stuck waiting on dependencies.
Source code in src/discord/notifications.py
format_plan_generated ¶
format_plan_generated(parent_task: Task, generated_tasks: list[Task], *, workspace_path: str | None = None, chained: bool = True) -> str
Format a plain-text notification for auto-generated plan subtasks.
Returns a human-readable markdown string listing all tasks created from a plan file, suitable for logging and fallback display.
Source code in src/discord/notifications.py
format_task_started_embed ¶
format_task_started_embed(task: Task, agent: Agent, workspace: Workspace | None = None) -> discord.Embed
Rich embed version of :func:format_task_started.
Uses the IN_PROGRESS status color (amber) to visually indicate that the task is now actively being worked on by an agent.
Source code in src/discord/notifications.py
format_task_completed_embed ¶
Rich embed version of :func:format_task_completed.
Source code in src/discord/notifications.py
format_task_failed_embed ¶
Rich embed version of :func:format_task_failed.
Source code in src/discord/notifications.py
format_task_blocked_embed ¶
Rich embed version of :func:format_task_blocked.
Source code in src/discord/notifications.py
format_pr_created_embed ¶
Rich embed version of :func:format_pr_created.
Source code in src/discord/notifications.py
format_agent_question_embed ¶
Rich embed version of :func:format_agent_question.
Source code in src/discord/notifications.py
format_chain_stuck_embed ¶
Rich embed version of :func:format_chain_stuck.
Source code in src/discord/notifications.py
format_stuck_defined_task_embed ¶
format_stuck_defined_task_embed(task: Task, blocking_deps: list[tuple[str, str, str]], stuck_hours: float) -> discord.Embed
Rich embed version of :func:format_stuck_defined_task.
Source code in src/discord/notifications.py
format_budget_warning_embed ¶
Rich embed version of :func:format_budget_warning.
The embed color shifts from amber to orange to red as the budget utilization increases, providing an at-a-glance severity indicator.
Source code in src/discord/notifications.py
format_plan_generated_embed ¶
format_plan_generated_embed(parent_task: Task, generated_tasks: list[Task], *, workspace_path: str | None = None, chained: bool = True) -> discord.Embed
Rich embed for auto-generated plan subtasks.
Builds a visually structured embed that displays all relevant metadata for each auto-generated task: title, priority, project, workspace, task type, and dependency chain — making it easy to scan at a glance.
Parameters¶
parent_task: The task whose completion produced the plan file. generated_tasks: The list of newly created subtasks from the plan. workspace_path: The workspace directory used by the parent task (shown when available). chained: Whether tasks are chained in a sequential dependency order.
Source code in src/discord/notifications.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
format_merge_conflict ¶
Plain-text notification for a merge conflict during sync-and-merge.
Source code in src/discord/notifications.py
format_merge_conflict_embed ¶
Rich embed for a merge conflict during sync-and-merge.
Source code in src/discord/notifications.py
format_push_failed ¶
Plain-text notification for a push failure after retries.
Source code in src/discord/notifications.py
format_push_failed_embed ¶
Rich embed for a push failure after retries.