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_agent_entries
The agents: entries of config.yml as written, or router::config::DEFAULT_AGENTS when the key is not set. An entry is a CLI name or runner:process, see registry::parse_entry
configured_agents
The names of the configured agents. For a runner:process entry the name is the process, which is also its key in model_map, its agent: label and its binary on PATH
format_rate_limited_until
Format an epoch second as a local HH:MM:SS for operator-facing output.
orch_footer
serve