sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -63,6 +63,9 @@ class StartJobRequest(BaseModel):
|
||||
# 外部任务 id(taskId 深链会商)。非空 = task 作业:按 task_id 共享、不按 user 分权,
|
||||
# 其 draft_id 指向独立的 roundtable_task_drafts 表(最终报告写回那里)。
|
||||
taskId: str | None = Field(default=None, max_length=128)
|
||||
# 当前页面这一次实时会商的隐藏标识。后台接管前用于续占同一个前台名额;
|
||||
# job 创建后由持久 job 行继续占位。
|
||||
roomSessionId: str | None = Field(default=None, max_length=128)
|
||||
intent: str = ""
|
||||
agents: list[JobAgent] = Field(default_factory=list)
|
||||
model: str | None = None
|
||||
@@ -236,6 +239,24 @@ async def start_job(
|
||||
|
||||
task_id = (body.taskId or "").strip() or None
|
||||
draft_id = (body.draftId or "").strip() or None
|
||||
# Handoff must own the already-admitted foreground room. It only renews
|
||||
# that lease and never creates capacity during the transition.
|
||||
from app.gateway.roundtable_room_gate import enforce_existing_roundtable_room
|
||||
|
||||
await enforce_existing_roundtable_room(
|
||||
request,
|
||||
draft_id=draft_id,
|
||||
task_id=task_id,
|
||||
room_session_id=(body.roomSessionId or "").strip() or None,
|
||||
)
|
||||
room_store = getattr(request.app.state, "roundtable_room_store", None)
|
||||
room_started_at = None
|
||||
read_started_at = getattr(room_store, "started_at", None)
|
||||
if read_started_at is not None:
|
||||
room_started_at = await read_started_at(
|
||||
room_session_id=(body.roomSessionId or "").strip() or None,
|
||||
holder_user_id=user_id,
|
||||
)
|
||||
agents = [SeatRef(a.agentId, a.name or a.agentId) for a in body.agents]
|
||||
seed_message = (body.seedMessage or body.intent or "").strip()
|
||||
|
||||
@@ -280,7 +301,20 @@ async def start_job(
|
||||
request_id=request_id,
|
||||
request_hash=_request_hash(body),
|
||||
input_snapshot=snapshot,
|
||||
room_started_at=room_started_at,
|
||||
)
|
||||
# The durable job row now owns occupancy. Drop the foreground lease so a
|
||||
# completed background job does not leave a one-minute phantom room.
|
||||
if room_store is not None:
|
||||
try:
|
||||
await room_store.release(
|
||||
draft_id=draft_id,
|
||||
user_id=user_id,
|
||||
task_id=task_id,
|
||||
room_session_id=(body.roomSessionId or "").strip() or None,
|
||||
)
|
||||
except Exception:
|
||||
logger.warning("failed to release foreground room after job handoff", exc_info=True)
|
||||
if created:
|
||||
# 新建(queued):交给 dispatcher 领取执行。
|
||||
response.status_code = 201
|
||||
|
||||
Reference in new issue
Block a user