Skip to main content

Module engine

Module engine 

Source
Expand description

Engine — the core orchestration loop.

The engine is the central coordinator. It owns the tick loop, backend connections, channel registry, transport layer, and tmux session manager.

Submodules handle the heavy lifting:

  • tick — core tick phases (session polling, stuck recovery, routing, dispatch)
  • sync — periodic sync operations (cleanup, PR review, mentions)
  • review — PR review pipeline (review agent, auto-merge, change handling)
  • [cleanup] — worktree cleanup and merged-PR detection

This file contains struct definitions, project initialization, and the main event loop (serve()).

Modules§

agents
Per-agent runner trait, error types, and agent registry.
ci
CI timers, required checks and red CI context
git
Git work in task worktrees: commits, pushes, PRs, worktree setup and diffs
review
PR review pipeline — review agent orchestration.
router
Agent router — selects the best agent and model for each task.
runner
Task runner — executes tasks using AI agents.
service
The daemon around the engine: the service loop, startup, channel messages, the relay client and the control session
subscribers
sync
Sync tick — periodic operations that run less frequently than the core tick.
tasks
tick
Core tick loop phases.

Structs§

EngineConfig
Engine configuration.
ProjectEngine
Per-project engine state.
RunTimeouts
The limit the timeout wrapper puts on one agent run, per complexity

Constants§

RATE_LIMITED_UNTIL_KEY
KV key holding the epoch second the GitHub core window resets, so orch task status can show the limit from a separate process.
RUN_TIMEOUT_GRACE_SECS
Seconds a live session may run past its own timeout before stuck recovery takes it. The timeout wrapper ends the agent at the limit, and the runner still collects the result

Traits§

WebUi
Start the orch service.

Functions§

attribution_footer
Build a standard attribution footer for GitHub comments posted by orch bots.
configured_agents
Return the configured agent list from top-level agents in config.yml, falling back to router::config::DEFAULT_AGENTS when not set.
format_rate_limited_until
Format an epoch second as a local HH:MM:SS for operator-facing output.
orch_footer
serve