Summary
When using opencode-go/deepseek-v4-flash as the primary model for isolated cron sessions (agentTurn in isolated session), the model call enters stream_progress but then stalls indefinitely — the last stream event arrives, then 128+ seconds pass with no progress. The stuck_session_recovery mechanism aborts the run after ~370s, and the error surfaces as LLM request failed..
The same API endpoint works fine when called directly via curl (200, ~2s response time) and works in normal interactive sessions. The issue is specific to isolated cron sessions using opencode-go streaming.
Evidence
All times in Asia/Shanghai:
| Cron Job |
Date |
Duration |
Error |
| 9AM Briefing |
2026-06-21 09:00 |
369,858ms |
LLM request failed. |
| 9AM Briefing |
2026-06-20 09:00 |
380,022ms |
⚠️ ⏰ Cron failed |
| Daily Debate |
2026-06-21 06:00 |
371,426ms |
LLM request failed. |
| Daily Debate |
2026-06-20 06:00 |
365,148ms |
LLM request failed. |
Diagnostic Logs (gateway.log / structured log)
stalled session: ... state=processing age=130s queueDepth=1
reason=active_work_without_progress classification=stalled_agent_run
activeWorkKind=model_call lastProgress=model_call:stream_progress
lastProgressAge=128s ...
stuck session recovery: ... age=370s action=abort_embedded_run
aborted=true drained=true ...
Direct API Test (working)
curl -s https://opencode.ai/zen/go/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Say hello"}],"max_tokens":3}'
# → HTTP 200, 1.78s
Root Cause (Hypothesis)
The opencode-go provider plugin does not properly establish or maintain streaming connections (model_call:stream_progress) within isolated cron sessions. This is likely connected to the known issue where applyOpencodeGoProviderConfig is an empty function (referenced in PR #92913, which tries to fix context window registration for opencode-go models). When isolated sessions attempt to initialize streaming, the provider configuration (context window, max tokens, etc.) may not be correctly propagated, causing the stream to hang after initialization.
Workaround
Adding fallbacks: ["Minimax-M2.7"] (or any non-opencode-go model) to the cron job payload resolved the issue:
{
"kind": "agentTurn",
"message": "...",
"fallbacks": ["Minimax-M2.7"],
"timeoutSeconds": 600
}
After adding this fallback, the cron job completes in ~32s (vs 370s stall) on fallback to Minimax-M2.7.
Steps to Reproduce
- Create an isolated cron job using
agentTurn with model: opencode-go/deepseek-v4-flash (or via agent default primary model)
- Let it run at the scheduled time
- Observe: the job takes >360s and fails with
LLM request failed.
- Diagnostic shows:
activeWorkKind=model_call, lastProgress=model_call:stream_progress, lastProgressAge > 120s
Expected Behavior
opencode-go streaming should work reliably in isolated cron sessions, just as it works in interactive sessions and direct API calls.
Environment
Summary
When using
opencode-go/deepseek-v4-flashas the primary model for isolated cron sessions (agentTurn in isolated session), the model call entersstream_progressbut then stalls indefinitely — the last stream event arrives, then 128+ seconds pass with no progress. Thestuck_session_recoverymechanism aborts the run after ~370s, and the error surfaces asLLM request failed..The same API endpoint works fine when called directly via
curl(200, ~2s response time) and works in normal interactive sessions. The issue is specific to isolated cron sessions using opencode-go streaming.Evidence
All times in Asia/Shanghai:
LLM request failed.⚠️ ⏰ Cron failedLLM request failed.LLM request failed.Diagnostic Logs (gateway.log / structured log)
Direct API Test (working)
Root Cause (Hypothesis)
The
opencode-goprovider plugin does not properly establish or maintain streaming connections (model_call:stream_progress) within isolated cron sessions. This is likely connected to the known issue whereapplyOpencodeGoProviderConfigis an empty function (referenced in PR #92913, which tries to fix context window registration for opencode-go models). When isolated sessions attempt to initialize streaming, the provider configuration (context window, max tokens, etc.) may not be correctly propagated, causing the stream to hang after initialization.Workaround
Adding
fallbacks: ["Minimax-M2.7"](or any non-opencode-go model) to the cron job payload resolved the issue:{ "kind": "agentTurn", "message": "...", "fallbacks": ["Minimax-M2.7"], "timeoutSeconds": 600 }After adding this fallback, the cron job completes in ~32s (vs 370s stall) on fallback to Minimax-M2.7.
Steps to Reproduce
agentTurnwithmodel: opencode-go/deepseek-v4-flash(or via agent default primary model)LLM request failed.activeWorkKind=model_call,lastProgress=model_call:stream_progress,lastProgressAge > 120sExpected Behavior
opencode-go streaming should work reliably in isolated cron sessions, just as it works in interactive sessions and direct API calls.
Environment