You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provider: openai (OpenAI-compatible) with TRADINGAGENTS_LLM_BACKEND_URL=https://opencode.ai/zen/go/v1
Models: deepseek-v4-flash (both quick & deep think; the 7/31 stable release)
Ticker: 159566.SZ (A-share ETF), all 4 analysts + full pipeline
Symptom
The run hangs indefinitely during the analyst/data-collection phase: process sits in wait_woken with near-zero CPU, the log stops updating after the initial data-fetch errors (StockTwits/Reddit/Polymarket are all non-fatal, expected for A-shares), and no report directory is ever created. Reproduced 3/3 times (pro+flash, flash-only, strict .env flash). A similar run on 2026-07-30 with the previous (pre-7/31) v4-flash completed fine.
Root-cause evidence (direct API tests against the same backend)
Prompt
max_tokens
Result
trivial ("reply OK")
100
OK — content returned, reasoning = 26 tokens
complex (analysis request)
500
empty content — reasoning_tokens: 500, finish_reason: length (reasoning chain ate the whole budget)
complex
2048
OK — reasoning 529 + content 55 tokens
complex
not set
no response in 90s (curl HTTP 000 timeout)
Analysis
The 7/31 stable v4-flash (post-training) produces much longer reasoning chains — 500+ tokens for complex tasks vs ~26 for trivial ones.
_PASSTHROUGH_KWARGS in llm_clients/openai_client.py does not include max_tokens, so TradingAgents sends no upper bound.
With no bound, the backend lets the reasoning chain run long, and a single generation exceeds the ~3 min idle timeout of the gateway (the same timeout documented in feat(llm): add OpenCode Go provider #782 for opencode-go) → connection dropped → process hangs.
With a small bound (wherever a default applies), the reasoning chain consumes the entire budget and content comes back empty → downstream agents get nothing to parse.
Proposed fix
Inject a sensible default max_tokens (e.g. 8192) into the OpenAI-compatible client calls, overridable via a new TRADINGAGENTS_MAX_TOKENS env var (mirroring the existing _ENV_OVERRIDES pattern).
Consider enabling streaming for the OpenAI-compatible path (as feat(llm): add OpenCode Go provider #782 did for opencode-go), including reasoning_content capture from stream deltas, so long generations keep the socket alive.
Bug: TradingAgents hangs indefinitely with DeepSeek V4 Flash (post-7/31 stable) — long reasoning chains exhaust token budget / trip gateway idle timeout
Environment
dev(15caeb9, 2026-08-02)openai(OpenAI-compatible) withTRADINGAGENTS_LLM_BACKEND_URL=https://opencode.ai/zen/go/v1deepseek-v4-flash(both quick & deep think; the 7/31 stable release)159566.SZ(A-share ETF), all 4 analysts + full pipelineSymptom
The run hangs indefinitely during the analyst/data-collection phase: process sits in
wait_wokenwith near-zero CPU, the log stops updating after the initial data-fetch errors (StockTwits/Reddit/Polymarket are all non-fatal, expected for A-shares), and no report directory is ever created. Reproduced 3/3 times (pro+flash, flash-only, strict .env flash). A similar run on 2026-07-30 with the previous (pre-7/31) v4-flash completed fine.Root-cause evidence (direct API tests against the same backend)
reasoning_tokens: 500,finish_reason: length(reasoning chain ate the whole budget)Analysis
_PASSTHROUGH_KWARGSinllm_clients/openai_client.pydoes not includemax_tokens, so TradingAgents sends no upper bound.contentcomes back empty → downstream agents get nothing to parse.Proposed fix
max_tokens(e.g. 8192) into the OpenAI-compatible client calls, overridable via a newTRADINGAGENTS_MAX_TOKENSenv var (mirroring the existing_ENV_OVERRIDESpattern).reasoning_contentcapture from stream deltas, so long generations keep the socket alive.Related