fix: MCP null args hang, repair infinite recursion, OOM on large files
Three critical bugfixes: 1. MCP server hangs on null arguments (#394) — `params.get("arguments", {})` returns None when JSON has `"arguments": null`. Changed to `or {}`. 2. cmd_repair infinite recursion (#395) — trailing slash on palace_path caused backup_path to be inside the source dir. Strip trailing sep. 3. OOM on large transcript files (#396) — split_mega_files.py and normalize.py load entire files into memory. Added 500MB safety limit with clear skip/error messages. Closes #394, #395, #396.
This commit is contained in:
@@ -26,6 +26,9 @@ def normalize(filepath: str) -> str:
|
||||
Plain text files pass through unchanged.
|
||||
"""
|
||||
try:
|
||||
file_size = os.path.getsize(filepath)
|
||||
if file_size > 500 * 1024 * 1024: # 500 MB safety limit
|
||||
raise IOError(f"File too large ({file_size // (1024*1024)} MB): {filepath}")
|
||||
with open(filepath, "r", encoding="utf-8", errors="replace") as f:
|
||||
content = f.read()
|
||||
except OSError as e:
|
||||
|
||||
Reference in New Issue
Block a user