From 710684a53f5f366d234907cacbecd646abb5f464 Mon Sep 17 00:00:00 2001 From: Mark Randall Havens Date: Thu, 12 Mar 2026 21:50:22 +0000 Subject: [PATCH] Debug state extraction --- opus_orchestrator/langgraph_workflow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opus_orchestrator/langgraph_workflow.py b/opus_orchestrator/langgraph_workflow.py index 44a4ae5..ab17f42 100644 --- a/opus_orchestrator/langgraph_workflow.py +++ b/opus_orchestrator/langgraph_workflow.py @@ -496,10 +496,14 @@ Write ~{plan.word_count_target} words. Begin with chapter title. result_state = initial_state for node_output in self.graph.stream(initial_state, config): # node_output is {node_name: state} + # Last node should be 'complete' with full state for key, state in node_output.items(): - if hasattr(state, 'stage'): # It's an OpusGraphState + if hasattr(state, 'stage'): result_state = state + # Debug: print what we got + print(f"\n[DEBUG] Final state - chapters: {len(result_state.chapters)}, words: {result_state.total_word_count}") + return result_state