Skip to content

bug: flow_context key missing from CrossDatabaseState — topology data silently lost between nodes #145

@bhavyakeerthi3

Description

@bhavyakeerthi3

Bug Description

identify_flow() returns {"flow_context": flow_context} andverify_mechanism() reads state.get("flow_context"), but flow_context is never declared in CrossDatabaseState.

This means the topological reasoning pipeline fetches real API data from the Reactome Content Service but never uses it — the fix is a one-line state declaration.

Minimal Reproduction

# Before fix: topology data silently lost by LangGraph
result = await builder.identify_flow(state, {})
print(result.get("flow_context"))  # Returns data ✓

# But in the next node, state never receives it:
flow_ctx = state.get("flow_context")  # None — key dropped by LangGraph ✗

Why It's Non-Obvious

LangGraph does not raise an error for undeclared state keys — it silently discards them. This makes the bug invisible in unit tests that mock state directly, since those tests never pass through the LangGraph state reducer.

Fix

Add flow_context: str to CrossDatabaseState in src/agent/profiles/cross_database.py and a regression test to prevent recurrence.

Files Affected

  • src/agent/profiles/cross_database.py
  • tests/test_flow_reasoning.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions