Skip to content

Detect and break non-progressing turn loops with an explicit recovery path #4414

Description

@Hmbown

Problem

A task can remain visibly working while its turn is no longer making meaningful progress—for example, repeatedly awaiting a stale subagent/model-wait state, retrying the same request, or re-rendering the same pending state. From the user’s perspective this looks like an infinite “turn loop” with no clear indication whether it is active, blocked, or safe to cancel.

This is related to #4408 (orphaned subagent terminal reconciliation), but is broader: the parent turn itself needs a no-progress watchdog and a clear recovery experience.

Acceptance criteria

  • Define meaningful progress for a turn (new tool/model event, state transition, checkpoint, or subagent terminal result) and distinguish it from repeated status refreshes.
  • Detect a configurable no-progress threshold and repeated equivalent wait/retry cycles.
  • Surface a clear in-product state such as “No progress detected” with the blocking reason and elapsed time.
  • Offer safe actions: retry the current operation, cancel/reconcile children, checkpoint-and-restart, or return to the prompt.
  • Ensure stop/cancel cannot leave a parent awaiting a non-terminal child.
  • Record a compact diagnostic trail for support without leaking internal transcript events into resumed context (Prevent raw internal subagent events from leaking into resumed session context #4409).
  • Add deterministic tests for stale child waits and repeated model/tool retry loops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestreliabilityReliability, flaky behavior, retries, fallbacks, and robustnesstuiTerminal UI behavior, rendering, or interactionv0.9.1Targeting v0.9.1

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions