checkStall (stall-detector.ts)

oh-my-matrix ยท stall-detection, inactivity-monitor, orchestration-state, automation

M2.5 Stall Detector Detects when an autopilot run has been inactive for too long. Only checks stall while orchestrationState is 'running'. /

/**
 * M2.5 Stall Detector
 *
 * Detects when an autopilot run has been inactive for too long.
 * Only checks stall while orchestrationState is 'running'.
 */
export interface StallCheckInput {
  orchestrationState: string;
  lastActivityAt?: number;
  now: number;
  stallTimeoutMs: number;
}

export interface StallResult {
  stalled: boolean;
  stallDurationMs?: number;
}

/**
 * Check if the run has stalled based on last activity time.
 * Considers stall when orchestrationState is 'running' (active turn) or 'claimed'
 * (M3: a claimed run that never receives a turn is a dead-end โ€” detect it so the
 * stall_timeout event can transition it to retry_queued, rather than waiting for
 * the 24h orphan sweep).
 */
export function checkStall(input: StallCheckInput): StallResult {
  const { orche

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key