diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index 6b7520c..aa121e8 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -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( diff --git a/tests/test_spawner_compact.py b/tests/test_spawner_compact.py index 28b38aa..85c6bb1 100644 --- a/tests/test_spawner_compact.py +++ b/tests/test_spawner_compact.py @@ -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