fix: Add debug logging to patch endpoints
This commit is contained in:
@@ -289,17 +289,27 @@ class HookHandler(BaseHTTPRequestHandler):
|
||||
self.send_response(504)
|
||||
self.end_headers()
|
||||
elif self.path == "/api/patch/trigger":
|
||||
sys.stderr.write(f"[DEBUG] /api/patch/trigger called with data: {data}\n")
|
||||
sys.stderr.flush()
|
||||
patch_text = data.get("patch_text", "")
|
||||
file_paths = data.get("file_paths", [])
|
||||
sys.stderr.write(f"[DEBUG] patch_text length: {len(patch_text)}, files: {file_paths}\n")
|
||||
sys.stderr.flush()
|
||||
event = threading.Event()
|
||||
result = {"status": "queued"}
|
||||
def trigger_patch():
|
||||
try:
|
||||
sys.stderr.write(f"[DEBUG] trigger_patch callback executing...\n")
|
||||
sys.stderr.flush()
|
||||
app._pending_patch_text = patch_text
|
||||
app._pending_patch_files = file_paths
|
||||
app._show_patch_modal = True
|
||||
sys.stderr.write(f"[DEBUG] Set patch modal: show={app._show_patch_modal}, text={'yes' if app._pending_patch_text else 'no'}\n")
|
||||
sys.stderr.flush()
|
||||
result["status"] = "ok"
|
||||
except Exception as e:
|
||||
sys.stderr.write(f"[DEBUG] trigger_patch error: {e}\n")
|
||||
sys.stderr.flush()
|
||||
result["status"] = "error"
|
||||
result["error"] = str(e)
|
||||
finally:
|
||||
@@ -368,9 +378,13 @@ class HookHandler(BaseHTTPRequestHandler):
|
||||
self.send_response(504)
|
||||
self.end_headers()
|
||||
elif self.path == "/api/patch/status":
|
||||
sys.stderr.write(f"[DEBUG] /api/patch/status called\n")
|
||||
sys.stderr.flush()
|
||||
show_modal = _get_app_attr(app, "_show_patch_modal", False)
|
||||
patch_text = _get_app_attr(app, "_pending_patch_text", None)
|
||||
patch_files = _get_app_attr(app, "_pending_patch_files", [])
|
||||
sys.stderr.write(f"[DEBUG] patch status: show_modal={show_modal}, patch_text={patch_text is not None}, files={patch_files}\n")
|
||||
sys.stderr.flush()
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
|
||||
Reference in New Issue
Block a user