Skip to content

Eternal Autonomous Mode

Eternal mode lets the Leader self-patrol, continuously monitoring and managing engineering state without human intervention. Through state machine drive, budget circuit breaking, and 3-layer health checks, the autonomous mode is safe and controllable.

StateDescription
IDLEIdle waiting, base 30-second interval
CHECKCheck system status, task queue, and environment health
PATROLPatrol engineering directory, detect file changes and anomalies
THINKAnalyze discovered issues, decide whether action is needed
WAITWait for next cycle, exponential backoff

To prevent Eternal mode from running away, a budget circuit breaker is in place:

  • Consecutive failure counter: Tracks consecutive failure count
  • Circuit breaker threshold: Pauses Eternal mode after 8 consecutive failures
  • Auto recovery: After circuit breaking, requires manual restart or Supervisor auto-recovery
  • Exponential backoff: Cycle interval grows exponentially with failure count
Base interval
30s
Backoff strategy
30s × 2^n (n = consecutive failure count)
Circuit breaker
8 consecutive failures → pause

EternalSupervisor provides 3-layer health checks and auto-restart:

LayerCheck MethodDescription
PID CheckProcess PID liveness detectionCheck if the Eternal process is running
WatchdogHeartbeat watchdogCheck if Eternal is heartbeating normally
HTTP ProbeHTTP health endpointCheck if Eternal can respond normally

When any layer check fails, the Supervisor will:

  1. Record the failure reason and time
  2. Clean up residual processes and locks
  3. Restore last state from SQLite
  4. Restart the Eternal state machine
  5. If consecutive restart failures exceed the threshold, enter a full stop state and notify the user

Configure Eternal mode in ~/.lingxiao/settings.json:

{
"eternal": {
"enabled": true,
"baseInterval": 30000,
"maxBackoff": 600000,
"budgetCircuitBreaker": 8,
"supervisor": {
"enabled": true,
"checkInterval": 60000,
"httpTimeout": 5000
}
}
}
  • Continuous monitoring: Long-running engineering projects needing automatic inspection
  • Auto repair: Automatically trigger repair flows when issues are detected
  • Night patrol: Monitor build and test status during off-hours
  • CI/CD assistance: Continuously observe deployment status and respond to anomalies