Private
Public Access
0
0

fix(api_hooks): wrap session_logger in _require_warmed on POST handler

Sub-track 2C refactor at commit 372b0681 missed line 409 (was line 412 before the Unused Scripts Cleanup agent reorganized api_hooks.py). Result: every POST to the hook server raised 'NameError: name session_logger is not defined' at src/api_hooks.py:409, returning 500 to all live_gui tests that POSTed (test_ai_settings_layout, test_auto_switch_sim, test_command_palette_sim, test_gui2_parity, test_gui_context_presets, test_gui_dag_beads, test_gui_events_v2, etc.).

Verified: tests/test_ai_settings_layout.py 2/2 now pass (previously failing with provider-not-updated 500 error).
This commit is contained in:
2026-06-07 12:30:23 -04:00
parent 114c385b07
commit b95935bf9b
+1 -1
View File
@@ -406,7 +406,7 @@ class HookHandler(BaseHTTPRequestHandler):
content_length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(content_length)
body_str = body.decode("utf-8") if body else ""
session_logger.log_api_hook("POST", self.path, body_str)
_require_warmed("src.session_logger").log_api_hook("POST", self.path, body_str)
data = json.loads(body_str) if body_str else {}
print(f'[HOOKS] POST {self.path} data length: {len(data)}')
if self.path == "/api/project":