vn6295337 Claude Opus 4.5 commited on
Commit
dc70069
·
1 Parent(s): dd14be4

fix: Add MCP 'executing' state for process flow visualization

Browse files

- Add set_mcp_executing() to workflow_store.py
- Call it at start of research phase in researcher.py
- MCP containers now show 'executing' while fetching data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

src/nodes/researcher.py CHANGED
@@ -102,6 +102,11 @@ def researcher_node(state, workflow_id=None, progress_store=None):
102
  end_date=end_date, fiscal_year=fiscal_year, form=form)
103
 
104
  try:
 
 
 
 
 
105
  # Fetch via Research Gateway (A2A protocol)
106
  print("[Research Gateway] Calling Research Service via A2A...")
107
  result = asyncio.run(_fetch_via_research_gateway(
 
102
  end_date=end_date, fiscal_year=fiscal_year, form=form)
103
 
104
  try:
105
+ # Set all MCP servers to "executing" state before research starts
106
+ if workflow_id and progress_store:
107
+ from src.services.workflow_store import set_mcp_executing
108
+ set_mcp_executing(workflow_id)
109
+
110
  # Fetch via Research Gateway (A2A protocol)
111
  print("[Research Gateway] Calling Research Service via A2A...")
112
  result = asyncio.run(_fetch_via_research_gateway(
src/services/workflow_store.py CHANGED
@@ -79,6 +79,13 @@ def add_metric(workflow_id: str, source: str, metric: str, value,
79
  WORKFLOWS[workflow_id]["mcp_status"][source] = "completed"
80
 
81
 
 
 
 
 
 
 
 
82
  def _quarter_from_date(date_str: str) -> int:
83
  """Extract quarter number from a date string (YYYY-MM-DD)."""
84
  if not date_str:
 
79
  WORKFLOWS[workflow_id]["mcp_status"][source] = "completed"
80
 
81
 
82
+ def set_mcp_executing(workflow_id: str):
83
+ """Set all MCP servers to 'executing' state when research starts."""
84
+ if workflow_id in WORKFLOWS and "mcp_status" in WORKFLOWS[workflow_id]:
85
+ for source in WORKFLOWS[workflow_id]["mcp_status"]:
86
+ WORKFLOWS[workflow_id]["mcp_status"][source] = "executing"
87
+
88
+
89
  def _quarter_from_date(date_str: str) -> int:
90
  """Extract quarter number from a date string (YYYY-MM-DD)."""
91
  if not date_str: