feat: 岗位会商命令幂等与圆桌后台作业租约调度
岗位会商写操作引入 command_id 幂等与版本锁,前端支持同键重试;圆桌后台作业改为 DB 租约 dispatcher、去重与草稿 outbox 补偿,并持久化 intent turns。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4f536d9b39
commit
75963c9ad9
51 files changed
+4449
-670
No files matched your search
+9
-1
@@ -54,6 +54,7 @@ class JobProgressWriter:
|
||||
event_sink: EventSink = None,
|
||||
on_dialogue: Any | None = None,
|
||||
recorder: Any | None = None,
|
||||
lease_owner: str | None = None,
|
||||
) -> None:
|
||||
self._store = store
|
||||
self._job_id = job_id
|
||||
@@ -65,6 +66,9 @@ class JobProgressWriter:
|
||||
# 每轮 leader/seat 模型返回后回调(dialogues, consensus)—— 执行器据此把对话
|
||||
# 写进草稿(和手动跑同一存取路径)。
|
||||
self._on_dialogue = on_dialogue
|
||||
# Phase 3 租约持有者:进度落库随 ``update_progress(lease_owner=...)`` 下发,store 的
|
||||
# 租约门只放行持租者的写(一致性来自 DB 条件 UPDATE)。None = 兼容旧路径(不走租约门)。
|
||||
self._lease_owner = lease_owner
|
||||
self._state: dict[str, str] = {a.agent_id: _PENDING for a in agents}
|
||||
self._spoke_cycle: dict[str, int] = {}
|
||||
self._consensus = 0
|
||||
@@ -100,7 +104,11 @@ class JobProgressWriter:
|
||||
fields.setdefault("dialogues", self._dialogues)
|
||||
if self._store is not None:
|
||||
try:
|
||||
await self._store.update_progress(self._job_id, **fields)
|
||||
# 带租约持有者时走 store 的租约门(原子条件 UPDATE);返回 None 表示写被拒
|
||||
# (非持租者 / 已取消)——进度落库 best-effort,不据此中断编排。
|
||||
await self._store.update_progress(
|
||||
self._job_id, lease_owner=self._lease_owner, **fields
|
||||
)
|
||||
except Exception: # noqa: BLE001 — 进度落库失败不能打断编排
|
||||
logger.warning("roundtable job progress persist failed", exc_info=True)
|
||||
if self._event_sink is not None:
|
||||
|
||||
Reference in new issue
Block a user