From b464d1fe49102cd4d4378a5cee407c530e1e16c5 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 6 Jun 2026 17:56:54 -0400 Subject: [PATCH] feat(api_hooks): expose warmup_status in /api/gui/diagnostics endpoint Phase 7 of startup_speedup_20260606 track. Added warmup status to the existing /api/gui/diagnostics endpoint (Phase 7 minimal scope - dedicated /api/warmup_status endpoint and GUI status indicator deferred to follow-up sub-track). The diagnostics response now includes: warmup: { pending: [list of module names still being warmed], completed: [list of module names successfully warmed], failed: [list of module names that failed to warm] } External clients and tests can poll this endpoint to know when the system is fully ready (all heavy modules loaded). The endpoint gracefully handles missing controller (returns empty dict) and exceptions (catches them, returns default empty state). TESTS: 7 live_gui tests pass (test_hooks, test_live_workflow, test_live_gui_integration_v2). No breakage from the new field. NEXT: Phase 8 (runtime audit hook enforcement test) + Phase 9 (final verify + checkpoint). --- src/api_hooks.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/api_hooks.py b/src/api_hooks.py index c2b0108b..0ac58a39 100644 --- a/src/api_hooks.py +++ b/src/api_hooks.py @@ -231,6 +231,15 @@ class HookHandler(BaseHTTPRequestHandler): perf = _get_app_attr(app, "perf_monitor") if perf: result.update(perf.get_metrics()) + # Warmup status (startup_speedup_20260606 Phase 7). Exposes the + # AppController's warmup_status() result so external clients and + # tests can poll until all heavy modules are loaded. + controller = _get_app_attr(app, "controller", None) + if controller and hasattr(controller, "warmup_status"): + try: + result["warmup"] = controller.warmup_status() + except Exception: + result["warmup"] = {"pending": [], "completed": [], "failed": []} finally: event.set() lock = _get_app_attr(app, "_pending_gui_tasks_lock") tasks = _get_app_attr(app, "_pending_gui_tasks")