fix: merge streamed chunks into final_state so reports save correctly

graph.stream() yields per-node deltas, not the full state. Taking
trace[-1] only captured the last node's contribution, so reports
saved to disk were missing every section except the final decision.
Merge all chunks in both the CLI path and trading_graph._run_graph's
debug branch.

#719 #736
This commit is contained in:
Yijia-Xiao
2026-05-10 19:20:23 +00:00
parent db7e0a67e2
commit c405867bde
2 changed files with 10 additions and 3 deletions

View File

@@ -1154,8 +1154,11 @@ def run_analysis(checkpoint: bool = False):
trace.append(chunk)
# Get final state and decision
final_state = trace[-1]
# Streamed chunks are per-node deltas, not full state. Merge them
# so every report field populated across the run is present.
final_state = {}
for chunk in trace:
final_state.update(chunk)
decision = graph.process_signal(final_state["final_trade_decision"])
# Update all agent statuses to completed