docs: Add session debrief about test fixes and MCP tool lesson
This commit is contained in:
26
debug_api_hooks.py
Normal file
26
debug_api_hooks.py
Normal file
@@ -0,0 +1,26 @@
|
||||
with open("src/api_hooks.py", "r", encoding="utf-8", newline="") as f:
|
||||
content = f.read()
|
||||
|
||||
# Add debug when receiving /api/gui
|
||||
old = """elif self.path == "/api/gui":
|
||||
lock = _get_app_attr(app, "_pending_gui_tasks_lock")
|
||||
tasks = _get_app_attr(app, "_pending_gui_tasks")
|
||||
if lock and tasks is not None:
|
||||
with lock: tasks.append(data)"""
|
||||
|
||||
new = """elif self.path == "/api/gui":
|
||||
sys.stderr.write(f"[DEBUG api_hooks] /api/gui received: {data}\\n")
|
||||
sys.stderr.flush()
|
||||
lock = _get_app_attr(app, "_pending_gui_tasks_lock")
|
||||
tasks = _get_app_attr(app, "_pending_gui_tasks")
|
||||
if lock and tasks is not None:
|
||||
with lock: tasks.append(data)
|
||||
sys.stderr.write(f"[DEBUG api_hooks] Added task, total: {len(tasks)}\\n")
|
||||
sys.stderr.flush()"""
|
||||
|
||||
content = content.replace(old, new)
|
||||
|
||||
with open("src/api_hooks.py", "w", encoding="utf-8", newline="") as f:
|
||||
f.write(content)
|
||||
|
||||
print("Added debug to api_hooks")
|
||||
Reference in New Issue
Block a user