fix: add debug log file locking, improve error logging, validate cloud API key
- Add portalocker file locking to debug_log() to prevent interleaved entries - Add exc_info=True to curator _call_llm error logging for stack traces - Add debug log message on JSON parse fallback in _parse_json_response - Warn when cloud is enabled but API key env var is not set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import json
|
||||
import re
|
||||
import logging
|
||||
import os
|
||||
import portalocker
|
||||
from pathlib import Path
|
||||
from .config import config
|
||||
from .singleton import get_qdrant_service
|
||||
@@ -66,7 +67,9 @@ def debug_log(category: str, message: str, data: dict = None):
|
||||
entry["data"] = data
|
||||
|
||||
with open(log_path, "a") as f:
|
||||
portalocker.lock(f, portalocker.LOCK_EX)
|
||||
f.write(json.dumps(entry) + "\n")
|
||||
portalocker.unlock(f)
|
||||
|
||||
|
||||
async def handle_chat_non_streaming(body: dict):
|
||||
|
||||
Reference in New Issue
Block a user