From eec6ca4b53eee475f9111bb4cc46637640ce867a Mon Sep 17 00:00:00 2001 From: Yijia-Xiao Date: Sun, 15 Mar 2026 17:54:32 +0000 Subject: [PATCH] fix: initialize all debate state fields in propagation.py InvestDebateState was missing bull_history, bear_history, judge_decision. RiskDebateState was missing aggressive_history, conservative_history, neutral_history, latest_speaker, judge_decision. This caused KeyError in _log_state() and reflection, especially with edge-case config values. --- tradingagents/graph/propagation.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tradingagents/graph/propagation.py b/tradingagents/graph/propagation.py index 7aba5258..0fd10c0c 100644 --- a/tradingagents/graph/propagation.py +++ b/tradingagents/graph/propagation.py @@ -24,14 +24,26 @@ class Propagator: "company_of_interest": company_name, "trade_date": str(trade_date), "investment_debate_state": InvestDebateState( - {"history": "", "current_response": "", "count": 0} + { + "bull_history": "", + "bear_history": "", + "history": "", + "current_response": "", + "judge_decision": "", + "count": 0, + } ), "risk_debate_state": RiskDebateState( { + "aggressive_history": "", + "conservative_history": "", + "neutral_history": "", "history": "", + "latest_speaker": "", "current_aggressive_response": "", "current_conservative_response": "", "current_neutral_response": "", + "judge_decision": "", "count": 0, } ),