Skip to content

Cron fallback model works in normal session but LLM request fails when triggered via cron #97335

Description

@Suidge

Describe the Bug

When a cron job is configured with a primary model (e.g. volcengine-plan/ark-code-latest) and a fallback model (deepseek/deepseek-v4-flash), the cron job fails with "LLM request failed" even when:

  1. The primary model fails (e.g. due to rate limiting on the provider side)
  2. The runtime successfully falls back to the fallback model
  3. The same fallback model works perfectly fine in a normal interactive session

Steps to Reproduce

  1. Create an isolated agentTurn cron job:
    • Primary model: volcengine-plan/ark-code-latest
    • Fallback: deepseek/deepseek-v4-flash
    • Timeout: 600 seconds
  2. Let the primary model fail (e.g. rate limit triggered)
  3. Observe that the runtime falls back to deepseek/deepseek-v4-flash (confirmed in run logs: provider=deepseek, model=deepseek-v4-flash)
  4. The cron session shows the model is actually running and making progress (multiple tool calls succeed)
  5. Then the session is aborted mid-execution with "Request was aborted" error, long before the timeout

Evidence

Cron run log (last run before fix):

model: "deepseek-v4-flash"
provider: "deepseek"
usage: { input_tokens: 42075, output_tokens: 1370, total_tokens: 566837 }
durationMs: 401442  // ran for ~6.7 minutes, well within the 600s timeout
error: "LLM request failed."

Session history shows the model was actively working (4-5 tool calls completed successfully), then abruptly terminated:

role: assistant, stopReason: "toolUse"  ← tool call made successfully
...
role: assistant, stopReason: "aborted"
errorMessage: "Request was aborted"

Verification:

  • The same fallback model (deepseek/deepseek-v4-flash) was then set as the primary model on the same cron job, with no other configuration changes
  • The cron job succeeded immediately (~120 seconds, delivered successfully)
  • The model works normally in interactive sessions (this conversation is running on it)

Expected Behavior

When a cron job falls back to a fallback model, and that model responds successfully, the cron job should complete normally—not abort mid-execution.

Actual Behavior

The cron runtime aborts the request ("Request was aborted") even though the fallback model is responding and producing valid tool calls. The abort happens after several successful model turns.

Additional Context

  • OpenClaw version: 2026.6.10
  • Runtime: isolated session (sessionTarget: "isolated")
  • Cron type: agentTurn with lightContext: true
  • The issue is specifically not about model availability — the fallback model was accessible and working; the cron runtime itself aborted the session

Workaround

Setting the same model (deepseek/deepseek-v4-flash) as the primary model (removing the fallback chain) resolves the issue immediately. The problem appears to be in how the runtime manages session lifecycle when switching to fallback models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.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:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions