Related:
Cycle Manager maintains system-wide convergence for long-running operation.
It runs monitoring, cleanup, and replanning periodically to support non-stalling operation.
Out of scope:
- Directly modifying individual task implementation content
- PR diff approve/rework decisions
- Monitor loop
- Cycle end condition evaluation
- Anomaly detection
- Cost limit monitoring
- Issue preflight / replan decision when backlog is depleted
- Cleanup loop
- Recovery of expired lease / offline agent / stuck run
- Requeue of failed/blocked tasks after cooldown
- Stats loop
- Cycle stats and system state updates
Research orchestrator loop:
- Runs in monitor loop (
runResearchOrchestrationTick) - Drives
planning/collecting/challenging/composing/judging/reworking - Queues targeted research stage tasks until quality convergence
- Restore existing
runningcycle on startup (or auto-start if none) - End conditions:
- Maximum elapsed time
- Maximum completed task count
- Maximum failure rate
- On cycle end, start next cycle after cleanup when needed
- Monitored:
- High failure rate
- Cost spike
- Stuck task
- No progress
- Agent timeout
- For some critical anomalies like
stuck_task, cycle restart is performed - Anomalies have duplicate notification cooldown
- After task backlog is empty, first sync issue backlog via
/system/preflight - Replan is deferred while issue backlog exists
- Replan only when backlog is empty and conditions such as planner idle are met
- Requirement hash + repo head are signed to suppress no-diff replan per config
- In
directmode, replan signature uses requirement hash only (no git HEAD);replanWorkdirstays as openTiger root for pnpm spawn CWD while requirement path resolves againstLOCAL_REPO_PATH
Research-specific backlog note:
- Research jobs with active stages are converged via research orchestration before normal replan progression.
statusanomaliesclear-anomaliesend-cyclenew-cyclecleanup
- Startup and common control:
apps/cycle-manager/src/main.ts,apps/cycle-manager/src/cycle-controller.ts - Main loop:
apps/cycle-manager/src/main/loops.ts - Backlog sync and replan:
apps/cycle-manager/src/main/backlog-preflight.ts,apps/cycle-manager/src/main/replan.ts - Anomaly detection:
apps/cycle-manager/src/monitors/anomaly-detector.ts - Recovery cleanup:
apps/cycle-manager/src/cleaners/cleanup.ts,apps/cycle-manager/src/cleaners/cleanup-retry.ts - Research orchestration:
apps/cycle-manager/src/main/research-orchestrator.ts
MONITOR_INTERVAL_MSCLEANUP_INTERVAL_MSSTATS_INTERVAL_MSAUTO_START_CYCLEAUTO_REPLANREPLAN_INTERVAL_MSREPLAN_REQUIREMENT_PATHREPLAN_COMMANDREPLAN_WORKDIRREPLAN_REPO_URLSYSTEM_API_BASE_URLISSUE_SYNC_INTERVAL_MSISSUE_SYNC_TIMEOUT_MSFAILED_TASK_RETRY_COOLDOWN_MSBLOCKED_TASK_RETRY_COOLDOWN_MSSTUCK_RUN_TIMEOUT_MSCYCLE_MAX_DURATION_MSCYCLE_MAX_TASKSCYCLE_MAX_FAILURE_RATERESEARCH_ENABLEDRESEARCH_PLANNER_PENDING_WINDOW_MSRESEARCH_MAX_CONCURRENCYRESEARCH_MAX_DEPTHRESEARCH_MIN_EVIDENCE_PER_CLAIMRESEARCH_MIN_DISTINCT_DOMAINS_PER_CLAIMRESEARCH_REQUIRE_COUNTER_EVIDENCERESEARCH_MIN_REPORT_CONFIDENCERESEARCH_MIN_VERIFIABLE_RATIO
Replan requirement path note:
- Relative
REPLAN_REQUIREMENT_PATH(for exampledocs/requirement.md) is resolved underREPLAN_WORKDIR(orLOCAL_REPO_PATHin direct/local-git modes). - If not found and github-mode remote is configured, Cycle Manager falls back to managed repo cache (
~/.opentiger/repos/<owner>/<repo>).