feat: 岗位会商命令幂等与圆桌后台作业租约调度

岗位会商写操作引入 command_id 幂等与版本锁,前端支持同键重试;圆桌后台作业改为 DB 租约 dispatcher、去重与草稿 outbox 补偿,并持久化 intent turns。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-08-14 11:08:12 +08:00
1 parent 4f536d9b39
commit 75963c9ad9
51 files changed
+4449 -670

No files matched your search

@@ -38,7 +38,10 @@ async def store(tmp_path):
import deerflow.persistence.position_roundtable.model # noqa: F401
await conn.run_sync(Base.metadata.create_all)
return PositionRoundtableRepository(async_sessionmaker(engine, expire_on_commit=False))
try:
yield PositionRoundtableRepository(async_sessionmaker(engine, expire_on_commit=False))
finally:
await engine.dispose()
def test_reject_node_request_allows_an_optional_reason():
@@ -1206,6 +1209,8 @@ async def test_builtin_summary_and_action_plan_snapshots_are_invalidated_by_reje
def test_rejected_or_stale_node_requires_a_new_markdown_delivery() -> None:
from deerflow.persistence.position_roundtable.delivery import markdown_delivery_changed
old = [
{
"name": "report.md",
@@ -1214,8 +1219,8 @@ def test_rejected_or_stale_node_requires_a_new_markdown_delivery() -> None:
"size_bytes": 100,
}
]
assert not position_roundtable_router._markdown_delivery_changed(old, old)
assert position_roundtable_router._markdown_delivery_changed(
assert not markdown_delivery_changed(old, old)
assert markdown_delivery_changed(
old,
[{**old[0], "modified_at": "2026-07-21T00:05:00+00:00", "size_bytes": 120}],
)
@@ -1358,6 +1363,17 @@ async def test_locked_node_cannot_bind_a_thread_before_its_stage_is_ready():
"thread_id": None,
}
async def apply_node_command(
self, session_id, node_key, user_id, *, command_id, command_type, payload=None,
expected_session_version=None,
):
# Mirrors the in-lock rejection a locked node produces in the real store.
return {
"ok": False,
"http_status": 409,
"detail": "上游节点尚未完成,当前节点未解锁",
}
request = SimpleNamespace(
app=SimpleNamespace(state=SimpleNamespace(position_roundtable_store=LockedStore())),
state=SimpleNamespace(user=SimpleNamespace(id="user-a")),