Skip to content

Commit e0457c0

Browse files
fix: add flow_context field to CrossDatabaseState to preserve topology data between nodes
Without this field, LangGraph silently drops the topology data returned by identify_flow() before verify_mechanism() can read it, making the entire topological flow reasoning feature a no-op in production. Also adds a regression test (test_flow_context_in_state) to ensure the field is never accidentally removed.
1 parent a86c4be commit e0457c0

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/agent/profiles/cross_database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class CrossDatabaseState(BaseState):
3131
uniprot_answer: str # LLM-generated answer from UniProt
3232
uniprot_completeness: str # LLM-assessed completeness of the UniProt answer
3333

34+
flow_context: str # Topological flow data fetched by identify_flow() for mechanistic queries
35+
3436

3537
class CrossDatabaseGraphBuilder(BaseGraphBuilder):
3638
def __init__(

tests/test_flow_reasoning.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,21 @@ async def test_decide_next_steps_mechanistic(builder):
101101
}
102102
decision = await builder.decide_next_steps(state)
103103
assert decision == "generate_final_response"
104+
105+
106+
def test_flow_context_in_state():
107+
"""
108+
Regression test: flow_context must be declared in CrossDatabaseState.
109+
110+
Without this field, LangGraph silently drops the topology data returned
111+
by identify_flow() before verify_mechanism() can read it — making the
112+
entire topological reasoning feature a no-op.
113+
"""
114+
from agent.profiles.cross_database import CrossDatabaseState
115+
import typing
116+
117+
hints = typing.get_type_hints(CrossDatabaseState)
118+
assert "flow_context" in hints, (
119+
"CrossDatabaseState is missing the 'flow_context' field. "
120+
"LangGraph will silently drop topology data between nodes without it."
121+
)

0 commit comments

Comments
 (0)