feat: validate real-bench seat orchestration and self-repair
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
@@ -162,6 +163,17 @@ class NativeCanIntegrationTests(unittest.TestCase):
|
||||
self.assertEqual(info["data"]["bitrate"], 2_000_000)
|
||||
self.assertEqual(info["data"]["sample_point_percent"], 80)
|
||||
|
||||
def test_enabling_seat_hardware_does_not_implicitly_enable_vehicle_can(self) -> None:
|
||||
with patch.dict(
|
||||
os.environ,
|
||||
{"COGNITIVE_AGENT_HARDWARE_EXECUTION_ENABLED": "true"},
|
||||
clear=False,
|
||||
):
|
||||
os.environ.pop("COGNITIVE_AGENT_VEHICLE_CAN_ENABLED", None)
|
||||
settings = VehicleCanSettings.from_env(Path(REPOSITORY_ROOT))
|
||||
|
||||
self.assertFalse(settings.enabled)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from cognitive_agent.application.self_repair.healing_model import (
|
||||
@@ -81,3 +83,24 @@ def test_bridge_manager_does_not_arm_visible_tooling_by_default(tmp_path: Path)
|
||||
assert snapshot["state"] == "IDLE"
|
||||
assert snapshot["retry_armed"] is False
|
||||
assert snapshot["attempts"] == 0
|
||||
|
||||
|
||||
def test_bridge_manager_does_not_restart_a_live_busy_request(tmp_path: Path) -> None:
|
||||
status_path = tmp_path / "bridge.json"
|
||||
status_path.write_text(
|
||||
json.dumps({
|
||||
"heartbeat_epoch": time.time() - 5.0,
|
||||
"bridge_state": "RUNNING",
|
||||
"current_request_id": "SELF_HEAL_BENCH_1",
|
||||
}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
manager = ZcanBridgeManager(
|
||||
status_path,
|
||||
tmp_path / "bridge.py",
|
||||
heartbeat_stale_s=3.0,
|
||||
busy_heartbeat_grace_s=45.0,
|
||||
)
|
||||
|
||||
assert manager._heartbeat_online() is False
|
||||
assert manager._bridge_busy_within_grace() is True
|
||||
|
||||
Reference in New Issue
Block a user