Reaction System Overview
When an event occurs (e.g., CI fails, review requested), the orchestrator:
Push, not pull. The human never needs to check on agents—the orchestrator notifies when judgment is required.
Source:
packages/core/src/lifecycle-manager.ts:422-498
Built-in Reactions
Agent Orchestrator includes 8 built-in reactions with sensible defaults:ci-failed
Triggered when CI checks fail on a PR.Enable automatic handling
What to do when CI fails:
send-to-agent— Send failure info to agent to fixnotify— Immediately notify human
How many times to let the agent retry before escalating
Escalate to human after this many failures
changes-requested
Triggered when a reviewer requests changes.Time-based escalation. Supports:
10m, 1h, 30mThe agent automatically fetches review comments and attempts to address them. Only escalates to human if it can’t resolve within the time limit.
bugbot-comments
Triggered when automated review tools (linters, security scanners) leave comments.- GitHub Actions annotations
- ESLint reporters
- Security scanners
- Coverage reporters
merge-conflicts
Triggered when the PR branch has merge conflicts with the base branch.The agent will attempt to rebase and resolve conflicts. Complex conflicts may require human intervention.
approved-and-green
Triggered when PR is approved by reviewers AND CI passes.agent-stuck
Triggered when agent shows no activity for a duration.Duration of inactivity before considering agent “stuck”
agent-needs-input
Triggered when agent asks a question or hits a permission prompt.- “Should I proceed with this refactoring?”
- Permission prompt for file operations
- Confirmation needed for destructive changes
agent-exited
Triggered when agent process exits unexpectedly.- Agent crashed
- Out of memory
- Unhandled error
- Manual termination
all-complete
Triggered when all spawned agents finish their work.Include summary of all sessions in the notification
packages/core/src/config.ts:215-278
Reaction Configuration Schema
All reactions support these fields:Enable automatic handling. If
false, the reaction is disabled.What action to take:
send-to-agent— Send message to agent to handlenotify— Send notification to humanauto-merge— Automatically merge the PR (only forapproved-and-green)
Custom message to send to agent (for
send-to-agent action) or human (for notify action).Notification priority level:
urgent— Critical issues requiring immediate attentionaction— Action required but not urgentwarning— Something to be aware ofinfo— Informational only
How many times to retry
send-to-agent before escalating to human.Escalation condition:
- Number: Escalate after this many failures (e.g.,
2= after 2 failed attempts) - String: Escalate after this duration (e.g.,
30m,1h)
Duration threshold for time-based triggers (e.g., agent-stuck).Examples:
10m, 30m, 1hInclude summary of all sessions in the notification (for
all-complete).packages/core/src/types.ts:763-788
Global Reaction Configuration
Define default reaction behavior for all projects:Per-Project Reaction Overrides
Override global reactions for specific projects:Per-project reactions merge with global reactions. You only need to specify the fields you want to override.
Auto-Merge Configuration
Auto-merge is the most aggressive automation option. Use with caution.Requirements for Auto-Merge
Before enabling auto-merge, ensure:Comprehensive CI
Your CI pipeline includes:
- Unit tests
- Integration tests
- Linting
- Type checking
- Security scanning
Required Approvals
GitHub branch protection requires:
- At least one approval
- Passing CI checks
- Up-to-date branch
Enable Auto-Merge Globally
Enable Auto-Merge per Project
Disable Auto-Merge (Default)
examples/auto-merge.yaml
Escalation Rules
Escalation determines when to notify a human after automatic handling fails.Retry-Based Escalation
Escalate after a number of failed attempts:- CI fails → agent attempts fix #1
- Still failing → agent attempts fix #2
- Still failing → agent attempts fix #3
- Still failing → escalate to human (urgent notification)
Time-Based Escalation
Escalate after a duration:- Review comments received → agent starts addressing
- Timer starts (30 minutes)
- If agent resolves within 30m → no escalation
- If unresolved after 30m → escalate to human (urgent notification)
Mixed Escalation
Combine both approaches:Custom Reaction Messages
Override default messages:Messages support template variables like
{{prUrl}}, {{sessionId}}, {{projectId}}.Disabling Reactions
Disable a reaction by settingauto: false:
Testing Reactions
Test your reaction configuration:Complete Example
A production-ready reaction configuration:Next Steps
Notifications
Configure how reactions notify you via Slack, Discord, etc.
Projects
Set up per-project reaction overrides
