feat(orchestrator): no way to stop a worker stuck in an infinite loop — add a stop/interrupt lever

Author: axisrowCreated Sep 29, 2026Updated Sep 29, 2026

Problem

A worker session can enter a no-op loop: it keeps making repetitive edits / re-running the same checks without converging, and the orchestrator has no way to stop it.

Observed today: a claude-code worker burned 45M tokens ($1.5) over 45 minutes while looping, and the orchestrator's periodic status checks just piled up in the worker's input queue.

What the orchestrator can do today (not enough)

  • ao send — delivery waits for the worker's next turn boundary (#3634). A busy looping worker never reaches a boundary, so even an explicit "stop now" message never lands. In-band "please stop" is not a control.
  • ao session kill <id> — the hammer: terminates the whole session. Nothing exists between "queue a message it won't read" and "end the session".
  • The orchestrator has no interruption surface at all: POST /api/v1/sessions/{id}/conversation/interrupt (→ InterruptTUI) exists, but it is restricted to TUI-mode sessions on harnesses with semantic acceptance (ErrSemanticAcceptanceUnsupported otherwise), has no CLI verb, and is not surfaced in the UI — Session Controls only offers toggles (auto-fix CI / auto-fix review comments / terminate-on-merge), no stop button.

Proposal

  1. Soft interrupt — a CLI verb (e.g. ao session interrupt <id>) that cancels the worker's current turn immediately: an Esc-equivalent delivered out-of-band, not queued at the turn boundary. Reuse the existing conversation-interrupt path; for harnesses without semantic interrupt support, fall back to a process-level interrupt (SIGINT to the session's process group).
  2. Escalation path — interrupt first; if the worker immediately re-loops, escalate to ao session kill. Kill already exists, but it ends the session — it's the last resort, not the nudge.
  3. UI affordance — a Stop control on the session inspector / kanban card wired to the same endpoints, so the human has the same lever the orchestrator gets.

Loop detection is a separate concern (#5701 was rejected at the hook layer); this issue is only about the missing stop lever the orchestrator — or the human — can pull once a loop is suspected.

Related

  • #3634 — stop messages wait for the turn boundary and never land on a busy worker
  • #5701 — loop-guard exploration (closed; hook layer rejected)

Source: Untrivial-ai/agent-orchestrator