"""
Live GUI smoke tests for ai_loop_regressions_20260614.

Track: ai_loop_regressions_20260614
Spec: conductor/tracks/ai_loop_regressions_20260614/spec.md (Phase 2.2)

The full end-to-end live_gui test for FR1 would require mock injection
into the live_gui subprocess (the patches in this test process do NOT
propagate to the subprocess). The mock-based FR1 regression coverage
is at the controller level in test_live_gui_integration_v2.py::
test_user_request_error_handling (mock_app fixture) and at the unit
level in test_ai_loop_regressions_20260614.py::test_fr1_*.

This file is a placeholder that verifies the live_gui's basic hook
plumbing is intact, so we know the integration path exists when
follow-up work adds subprocess mock injection.
"""
import time
from src.api_hook_client import ApiHookClient


def test_live_gui_hooks_respond_for_fr1_substrate(live_gui) -> None:
 """
 Smoke test: the live_gui's ai_status field is readable via the Hook
 API. This is the substrate the FR1 fix writes to on error; verifying
 it is reachable establishes the integration exists.
 """
 client = ApiHookClient()
 deadline = time.time() + 10.0
 status = ""
 while time.time() < deadline:
  status = client.get_value("ai_status") or ""
  if status:
   break
  time.sleep(0.5)
 assert status, f"ai_status was not readable via the Hook API. Last seen: {status!r}"
