fix(spawner): §24 v4 仲达review M1(双staticmethod) + S1(TC11)
CI / lint (pull_request) Successful in 7s
CI / test (pull_request) Successful in 9s
CI / notify-on-failure (pull_request) Successful in 0s

This commit is contained in:
cfdaily
2026-06-12 00:04:10 +08:00
parent ddc1c7285a
commit fe541f6c89
2 changed files with 11 additions and 2 deletions
-2
View File
@@ -1297,7 +1297,6 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_
logger.exception("Failed to revive %s", agent_id)
return False
@staticmethod
# deprecated: §24 v3, 保留供方案 B 备选
@staticmethod
def _get_recent_gateway_logs() -> list:
@@ -1318,7 +1317,6 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_
paths.append(p)
return paths
@staticmethod
# deprecated: §24 v3, 保留供方案 B 备选
@staticmethod
def _check_compact_in_progress_gateway(
+11
View File
@@ -171,3 +171,14 @@ class TestCheckCompactInProgressTrajectory:
def test_tc10_none_session_file_returns_false(self):
"""TC10: session_file 为 None → False"""
assert AgentSpawner._check_compact_in_progress_trajectory(None) is False
def test_tc11_events_without_ts_returns_true(self, tmp_path):
"""TC11: 事件有 type 但无 ts 字段 → 无法判断超时 → True(skip)"""
turns = [[
_make_trajectory_event("session.started"), # 无 ts
_make_trajectory_event("context.compiled"), # 无 ts
_make_trajectory_event("model.completed"), # 无 ts
]]
_write_trajectory(tmp_path, _SESSION_ID, turns)
session_file = str(tmp_path / _SESSION_ID)
assert AgentSpawner._check_compact_in_progress_trajectory(session_file) is True