-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Bug: Cron fallback chain broken — models return zero-token success or killed by shared AbortController #97115
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
Bug: Cron fallback chain broken — models return zero-token "success" or are killed by shared AbortController
Summary
Isolated cron agentTurn jobs fail in a cascading way: the primary model times out, the fallback chain either dies instantly (shared AbortController from #37505) or a fallback model "responds" with 0 input tokens, 0 output tokens, and a clean
stopReason: "stop"— which the harness treats as success, so no further fallback triggers. The 0-token model then gets permanently cached insessions.json(#61573), poisoning subsequent runs.Net result: cron fallback chains are non-functional. Jobs that should recover just fail silently.
Evidence
Cron jobs using model fallback chains produce zero-token calls when they reach a provider outside the OpenRouter/Codex families (observed with Google Gemini). Example pattern from a production
usage.db:Every call connects, returns
stopReason: "stop", zero tokens, zero cost. The harness reports "Agent couldn't generate a response" — but treats it as a completed call, not an error, so no further fallback is attempted.Related closed issues (same underlying bug, not resolved)
Cron job timeout aborts entire model fallback chain via shared AbortController #37505 — "Cron job timeout aborts entire model fallback chain via shared AbortController" — stale-closed by barnacle bot, not fixed. Several PRs cross-referenced it but the issue was auto-closed without resolution.
[Bug]: OpenRouter text-inference models return silent empty responses through cron-agent-turn harness in OpenClaw 2026.4.14 #67646 — "OpenRouter text-inference models return silent empty responses through cron-agent-turn harness" — closed as fixed, but the fix was OpenRouter-specific (base URL merge). The same "silent empty response" pattern now manifests on non-OpenRouter providers (e.g., Google Gemini).
Cron sessions permanently cache fallback model in sessions.json #61573 — "Cron sessions permanently cache fallback model in sessions.json" — closed as fixed, but the cache poisoning persists when the fallback model is reached via the zero-token path.
Root cause hypothesis
Two overlapping bugs in the cron harness:
A) The cron runner (
executeJobCoreWithTimeout) creates a singleAbortControllershared across the entire fallback chain. When primary model times out, the signal is already aborted — every subsequent fallback gets a dead signal, failing instantly without making a network request. (#37505)B) When a fallback model does manage to fire, certain providers return a clean-looking response with 0 tokens — the harness doesn't classify this as a failure, so
runWithModelFallbackstops iterating. The job then fails with "Agent couldn't generate a response" instead of trying the next fallback.This affects any provider that layers on top of the cron-agent-turn harness beyond the OpenRouter/Codex families.
Steps to reproduce
deepseek-v4-pro → minimax → google/gemini-flash)sessions.json— the 0-token model is now permanently cached for that cron session keyEnvironment
isolatedcron agentTurn jobs with model chains reaching non-OpenRouter providers