Hmbown/CodeWhale · warning

turn interrupted

Error message

turn interrupted

What it means

Raised when a runtime API turn reaches `TurnTerminalStatus::Interrupted`. The handler converts the terminal event into an error, preferring the error message from the turn event and falling back to the literal "turn interrupted" string when none is provided. It signals the turn stopped mid-run due to an interruption rather than completing or failing outright.

Solutions

  1. Determine what issued the interrupt (user action, watchdog, runtime limit) from session logs.
  2. If the interrupt was unintended, re-issue the turn without sending the interrupt signal.
  3. If interrupts are expected, treat this status as a non-error outcome in the caller and branch on it rather than surfacing it as a failure.
  4. Increase any client-side watchdog timeout if it is cutting long turns short.
Defensive patterns

Strategy: try-catch

Try / catch

match run_turn(...).await {
    Err(e) if e.to_string().contains("turn interrupted") => { /* treat as expected interrupt, not failure */ }
    other => other?,
}

Prevention

When it happens

Trigger: A turn ends with the Interrupted terminal status — e.g. an interrupt request was issued to the runtime while the turn was still executing.

Common situations: User or system issues a cancel/interrupt (Esc key, client shutdown, timeout watchdog) during a long-running turn; runtime-enforced limits cutting a turn short.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/dd000e96e6595963. Report an issue: GitHub.

Appendix: source

Thrown at crates/app-server/src/lib.rs:1888

        match status {
            TurnTerminalStatus::Completed => Ok(json!({
                "thread_id": thread_id,
                "status": "accepted",
                "thread": Value::Null,
                "threads": [],
                "model": Value::Null,
                "model_provider": Value::Null,
                "cwd": Value::Null,
                "approval_policy": Value::Null,
                "sandbox": Value::Null,
                "events": [],
                "data": { "turn_id": turn_id },
            })),
            TurnTerminalStatus::Failed => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn failed".to_string())
            )),
            TurnTerminalStatus::Interrupted => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn interrupted".to_string())
            )),
            TurnTerminalStatus::Canceled => Err(anyhow!(
                "{}",
                error.unwrap_or_else(|| "turn canceled".to_string())
            )),
        }
    }

    async fn stream_turn_events<W: AsyncWrite + Unpin>(
        &self,
        thread_id: &str,
        turn_id: &str,
        response_id: &str,
        writer: &mut W,
        since_seq: u64,
        mut transcript: Option<&mut TurnTranscript>,

View on GitHub (pinned to 73e0f67d83)