Spaces:
Sleeping
Sleeping
Add error logging to Activity Log for researcher failures
Browse files- Log errors to Activity Log before re-raising exceptions
- Add A2A request failure logging in research_gateway
- Users can now see WHY research failed in the Activity Log
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- src/nodes/research_gateway.py +7 -1
- src/nodes/researcher.py +4 -2
src/nodes/research_gateway.py
CHANGED
|
@@ -218,7 +218,13 @@ async def call_research_service(
|
|
| 218 |
if add_log:
|
| 219 |
add_log("researcher", f"Submitting research task for {company} ({ticker})...")
|
| 220 |
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
task_id = result.get("task", {}).get("id")
|
| 223 |
|
| 224 |
if not task_id:
|
|
|
|
| 218 |
if add_log:
|
| 219 |
add_log("researcher", f"Submitting research task for {company} ({ticker})...")
|
| 220 |
|
| 221 |
+
try:
|
| 222 |
+
result = await send_message(message)
|
| 223 |
+
except ResearchGatewayError as e:
|
| 224 |
+
if add_log:
|
| 225 |
+
add_log("researcher", f"A2A request failed: {str(e)}")
|
| 226 |
+
raise
|
| 227 |
+
|
| 228 |
task_id = result.get("task", {}).get("id")
|
| 229 |
|
| 230 |
if not task_id:
|
src/nodes/researcher.py
CHANGED
|
@@ -132,7 +132,9 @@ def researcher_node(state, workflow_id=None, progress_store=None):
|
|
| 132 |
raise RuntimeError(f"All MCP servers failed for {company}. Check API configurations.")
|
| 133 |
|
| 134 |
except Exception as e:
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
| 137 |
|
| 138 |
return state
|
|
|
|
| 132 |
raise RuntimeError(f"All MCP servers failed for {company}. Check API configurations.")
|
| 133 |
|
| 134 |
except Exception as e:
|
| 135 |
+
error_msg = str(e)
|
| 136 |
+
print(f"Research failed: {error_msg}")
|
| 137 |
+
add_log("researcher", f"ERROR: {error_msg}")
|
| 138 |
+
raise RuntimeError(f"Research failed for {company}: {error_msg}")
|
| 139 |
|
| 140 |
return state
|