Skip to content

Heartbeat sessions report 'assistant turn failed before producing content' on model initialization failure #90049

Description

@zenassist26-create

Description

When a heartbeat session's configured model fails to initialize (cloud provider timeout, rate limit, transient error), the gateway logs:

[assistant turn failed before producing content]

This phrasing implies the assistant's code failed, but in these cases no assistant code has run. The model layer failed before the turn began. The result is:

  1. Misleading diagnostics — logs suggest a code bug when it's actually provider-side
  2. Silent failures for autonomous functions — heartbeats produce no output, no state update, and no retry path
  3. No differentiation — gateway cannot distinguish "provider down" from "assistant crashed"

Steps to reproduce

  1. Configure heartbeat with a cloud model (e.g., kimi-k2.6:cloud via Ollama proxy)
  2. Trigger heartbeat during provider instability
  3. Observe [assistant turn failed before producing content] in logs
  4. Note: zero assistant code executed, zero state change, next heartbeat retries blindly

Routing context

The failure path is: heartbeat → Ollama localhost proxy → cloud provider. The provider hiccups, Ollama returns an error, and the gateway sees that as "assistant turn failed." This could be an OC issue, or an Ollama issue — the logging makes it hard to tell.

Expected behavior

Failure Mode Log Message Action
Model fails to initialize (provider error) [model initialization failed: <reason>] Retry with fallback model if configured; else log and continue
Assistant code throws after turn starts [assistant turn failed: <error>] Standard error handling
Assistant produces no output (empty) [assistant turn produced empty output] Flag for review

Suggested fix

In gateway heartbeat handling, distinguish between:

  • model.init() failure → provider error
  • assistant.run() failure → code error
  • Empty output → valid but suspicious

For heartbeat specifically: if model init fails and a fallback model is configured (e.g., local Ollama), retry once with fallback before giving up.

Environment

  • OpenClaw v2026.4.1+ (observed on v2026.5.7)
  • macOS, Apple Silicon, Ollama + cloud hybrid setup
  • Heartbeat is autonomous infrastructure — silent failures mean memory hygiene, process health, and spend checks simply don't run

Impact

Medium — not a crash, but degrades reliability of autonomous functions and makes provider issues harder to diagnose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions