feat(deep-research): 强化任务链路可靠性并接入 agentfx 报告助手种子
功能说明:\n- 重构 Deep Research 调度与执行链,补齐 dispatcher、executor、live hub 与依赖注入入口,提升任务下发、执行、回调的稳定性\n- 增强运行时持久化与恢复能力,接入业务映射、任务来源与任务事件日志模型,覆盖持久化与执行可靠性关键路径测试\n- 新增 agentfx 报告助手 seed 与任务报告导入脚本配置,支持离线环境快速初始化与任务流模板回填\n- 完善 deep-research 与 thread_runs 路由参数编排,兼容不同业务映射与运行入口的前后端联动\n- 补充前端 agentfx deep-link 解析,保证 deep-research 场景下的登录跳转与任务上下文一致
This commit is contained in:
1 parent
438772f0b7
commit
5c75e1af16
36 files changed
+3163
-312
No files matched your search
@@ -61,6 +61,10 @@ class DeepResearchJobDispatcher:
|
||||
await self._task
|
||||
self._task = None
|
||||
|
||||
def cancel_running(self, job_id: str) -> bool:
|
||||
"""Stop an in-process executor task. Safe if the job is not on this worker."""
|
||||
return self._executor.cancel(job_id)
|
||||
|
||||
def nudge(self) -> None:
|
||||
"""Wake the loop immediately (called after start/resume to cut latency)."""
|
||||
self._wake.set()
|
||||
@@ -103,6 +107,24 @@ class DeepResearchJobDispatcher:
|
||||
started = 0
|
||||
lease_until = now + timedelta(seconds=_LEASE_TTL_SECONDS)
|
||||
for job_id in candidate_ids:
|
||||
try:
|
||||
peek = await self._store.get_unscoped(job_id)
|
||||
except Exception: # noqa: BLE001
|
||||
peek = None
|
||||
# Expired-lease ``running`` rows used to be reclaimed and resumed.
|
||||
# After a full Gateway restart that re-occupied the per-user 429
|
||||
# latch. Drop them instead of auto-resuming; queued jobs still start.
|
||||
if peek is not None and peek.get("status") == "running":
|
||||
owner = str(peek.get("user_id") or "")
|
||||
with suppress(Exception):
|
||||
if owner:
|
||||
await self._store.request_cancel(job_id, user_id=owner)
|
||||
else:
|
||||
await self._store.request_cancel(job_id)
|
||||
with suppress(Exception):
|
||||
await self._store.finalize_cancel(job_id)
|
||||
logger.info("[deep-research] dropped stale running job %s instead of reclaiming", job_id)
|
||||
continue
|
||||
try:
|
||||
row = await self._store.claim_job(
|
||||
job_id, lease_owner=self._worker_id, lease_until=lease_until
|
||||
|
||||
Reference in new issue
Block a user