Spaces:
Sleeping
Sleeping
Fix: Process partial_metrics on completed status
Browse filesNews and sentiment metrics were not appearing because the polling
loop only processed partial_metrics during WORKING status. When the
task transitioned to COMPLETED, the final poll returned immediately
without emitting the remaining metrics from the last sources.
Fix: Also process partial_metrics when status is 'completed' to
ensure all metrics (including news and sentiment) are captured.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
src/nodes/research_gateway.py
CHANGED
|
@@ -133,8 +133,9 @@ async def wait_for_completion(
|
|
| 133 |
task = await get_task_status(task_id)
|
| 134 |
status = task.get("status")
|
| 135 |
|
| 136 |
-
# Emit partial metrics during WORKING status
|
| 137 |
-
|
|
|
|
| 138 |
partial_metrics = task.get("partial_metrics", []) or []
|
| 139 |
for metric in partial_metrics:
|
| 140 |
# Skip None or invalid metrics
|
|
|
|
| 133 |
task = await get_task_status(task_id)
|
| 134 |
status = task.get("status")
|
| 135 |
|
| 136 |
+
# Emit partial metrics during WORKING or COMPLETED status
|
| 137 |
+
# Important: Also process on COMPLETED to catch metrics from final sources
|
| 138 |
+
if (status in ("working", "completed")) and progress_callback:
|
| 139 |
partial_metrics = task.get("partial_metrics", []) or []
|
| 140 |
for metric in partial_metrics:
|
| 141 |
# Skip None or invalid metrics
|