perf(webui): batch startup recovery and authenticate before React (#6708)
This commit is contained in:
1 parent
9652302324
commit
273582916b
26 files changed
+537
-330
No files matched your search
@@ -152,17 +152,13 @@ class SubagentSessions:
|
||||
|
||||
async def interrupt_pending(self) -> None:
|
||||
"""Seal abandoned work after the gateway acquires execution ownership."""
|
||||
for row in self.sessions.list_sessions():
|
||||
key = row["key"]
|
||||
payload = self.sessions.read_session_metadata(key)
|
||||
metadata = (payload or {}).get("metadata", {})
|
||||
if metadata.get(SESSION_TYPE_KEY) != SUBAGENT.name:
|
||||
continue
|
||||
for key, metadata in await self.sessions.state.typed_session_headers(SUBAGENT.name):
|
||||
task_id = key.removeprefix("subagent:")
|
||||
owner = metadata.get(PARENT_SESSION_KEY)
|
||||
if not isinstance(owner, str):
|
||||
if key != self.key(task_id) or not isinstance(owner, str):
|
||||
continue
|
||||
try:
|
||||
status = self.status(key.removeprefix("subagent:"), owner)
|
||||
status = self._status_from_metadata(task_id, owner, metadata)
|
||||
if status is None or status.state not in _ACTIVE_STATES:
|
||||
continue
|
||||
status.state = status.phase = "interrupted"
|
||||
|
||||
Reference in new issue
Block a user