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
@@ -321,6 +321,39 @@ async def test_job_expired_lease_reclaimable():
|
||||
await repos["_engine"].dispose()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_dispatcher_drops_expired_running_job_instead_of_reclaiming():
|
||||
from app.gateway.deep_research_job_dispatcher import DeepResearchJobDispatcher
|
||||
|
||||
class _Executor:
|
||||
def __init__(self) -> None:
|
||||
self.started: list[str] = []
|
||||
|
||||
def start_job(self, snapshot: dict, *, job_id: str, lease_owner: str | None) -> bool: # noqa: ARG002
|
||||
self.started.append(job_id)
|
||||
return True
|
||||
|
||||
repos = await _make_repos()
|
||||
try:
|
||||
await repos["jobs"].try_create_or_get_active(
|
||||
id="drj_1",
|
||||
session_id="drs_1",
|
||||
user_id="u1",
|
||||
input_snapshot={"query": "测试报告"},
|
||||
)
|
||||
expired = datetime.now(UTC) - timedelta(seconds=10)
|
||||
await repos["jobs"].claim_job("drj_1", lease_owner="w1", lease_until=expired)
|
||||
dispatcher = DeepResearchJobDispatcher(repos["jobs"], _Executor(), worker_id="worker_2")
|
||||
|
||||
started = await dispatcher.dispatch_once()
|
||||
|
||||
assert started == 0
|
||||
row = await repos["jobs"].get_unscoped("drj_1")
|
||||
assert row["status"] == "cancelled"
|
||||
finally:
|
||||
await repos["_engine"].dispose()
|
||||
|
||||
|
||||
# ── jobs: two-phase cancel ──────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user