perf(subagent): read saved task history by loaded turns (#6634)
This commit is contained in:
1 parent
1196698ecb
commit
eb8546c321
20 files changed
+893
-97
No files matched your search
@@ -920,8 +920,22 @@ class GatewayHTTPHandler:
|
||||
return _http_error(404, "session not found")
|
||||
if self.subagent_manager is None:
|
||||
return _http_error(503, "subagent manager unavailable")
|
||||
query = _parse_query(request.path)
|
||||
scope = query.get("scope")
|
||||
if scope is not None and scope != ["window"]:
|
||||
return _http_error(400, "invalid task scope")
|
||||
turns = query.get("turn_id", [])
|
||||
tracked = query.get("track", [])
|
||||
if scope == ["window"] and (len(turns) + len(tracked) > 512
|
||||
or any(not value or len(value) > 512 for value in (*turns, *tracked))):
|
||||
return _http_error(400, "invalid task window")
|
||||
try:
|
||||
statuses = await self.subagent_manager.read_statuses_for_session(session_key)
|
||||
if scope == ["window"]:
|
||||
statuses = await self.subagent_manager.read_statuses_for_session(
|
||||
session_key, turns=turns, tracked=tracked,
|
||||
)
|
||||
else:
|
||||
statuses = await self.subagent_manager.read_statuses_for_session(session_key)
|
||||
except (OSError, SubagentSessionError):
|
||||
return _http_error(503, "task history unavailable")
|
||||
return _http_json_response({
|
||||
|
||||
Reference in new issue
Block a user