feat(backend): 完善 Workflow 与 DeepResearch 的运行链路与持久化能力
功能说明:\n- 重构并增强工作流网关执行链路,支持更完整的 proposal 与 run 调度参数透传\n- 增加 DeepResearch/workflow 运行事件持久化能力并补齐建表 SQL 与查询/保存接口适配\n- 优化 lead agent 与 deep research runner 的中间态处理,增强线程收集与执行链并发控制\n- 调整工作流执行器与任务路由,提升兼容性并完善错误与回放行为\n- 补充回归测试:deep_research 持久化、workflow 并发、定义加载、引擎执行、run 流程等覆盖
This commit is contained in:
1 parent
f5bf7897b9
commit
6d326a21cd
28 files changed
+836
-135
No files matched your search
@@ -1501,27 +1501,42 @@ class DeepResearchJobExecutor:
|
||||
runtime_thread_id=runtime_thread_id,
|
||||
query=query,
|
||||
)
|
||||
await events.emit(
|
||||
"collection_completed",
|
||||
phase="collecting",
|
||||
payload={
|
||||
"source": "chat_thread",
|
||||
"materialCount": len(harvested),
|
||||
"agentSummaryChars": len(agent_summary),
|
||||
},
|
||||
)
|
||||
for material in harvested:
|
||||
# Freeze the harvested list before publishing any progress. Source
|
||||
# event persistence is intentionally best-effort: a bad payload or a
|
||||
# temporarily unavailable event table must never prevent the writer
|
||||
# from receiving this already-collected evidence.
|
||||
material_provider = StaticHarvestMaterialProvider(harvested)
|
||||
try:
|
||||
await events.emit(
|
||||
"source_added",
|
||||
"collection_completed",
|
||||
phase="collecting",
|
||||
payload={
|
||||
"sourceId": material.id,
|
||||
"title": material.title,
|
||||
"url": material.url,
|
||||
"sourceType": material.source_type,
|
||||
"source": material.to_persistence_dict(material.query),
|
||||
"source": "chat_thread",
|
||||
"materialCount": material_provider.material_count,
|
||||
"agentSummaryChars": len(agent_summary),
|
||||
},
|
||||
)
|
||||
except Exception: # noqa: BLE001 - progress telemetry must not lose evidence
|
||||
logger.warning("chat deep-research collection event failed; retaining harvested materials", exc_info=True)
|
||||
for material in harvested:
|
||||
try:
|
||||
await events.emit(
|
||||
"source_added",
|
||||
phase="collecting",
|
||||
payload={
|
||||
"sourceId": material.id,
|
||||
"title": material.title,
|
||||
"url": material.url,
|
||||
"sourceType": material.source_type,
|
||||
"source": material.to_persistence_dict(material.query),
|
||||
},
|
||||
)
|
||||
except Exception: # noqa: BLE001 - source rows are a projection, not the input
|
||||
logger.warning(
|
||||
"chat deep-research source event failed for %s; retaining harvested materials",
|
||||
material.id,
|
||||
exc_info=True,
|
||||
)
|
||||
if not harvested:
|
||||
await events.emit(
|
||||
"warning",
|
||||
@@ -1532,7 +1547,7 @@ class DeepResearchJobExecutor:
|
||||
"recoverable": True,
|
||||
},
|
||||
)
|
||||
return StaticHarvestMaterialProvider(harvested)
|
||||
return material_provider
|
||||
|
||||
async def _generate_report_summary(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user