Fix config override bug by recreating LMs after load_state

This commit is contained in:
2026-01-31 12:24:18 -08:00
parent 3087006561
commit 64e375e960

View File

@@ -53,13 +53,23 @@ def write_file(path: str, content: str) -> str:
content: Content to write to the file
Returns:
'ok' on success
Status message with file stats
"""
print(f"{MAGENTA}⏺ Creating file: {path}{RESET}")
is_new = not os.path.exists(path)
action = "Creating" if is_new else "Overwriting"
# Auto-create parent directories
parent = os.path.dirname(path)
if parent:
os.makedirs(parent, exist_ok=True)
with open(path, "w") as f:
f.write(content)
return "ok"
lines = content.count("\n") + (1 if content and not content.endswith("\n") else 0)
tokens = len(content) // 4
print(f"{MAGENTA}{action} file: {path} ({lines} lines, ~{tokens:,} tokens){RESET}")
return f"ok: wrote {lines} lines ({tokens:,} tokens) to {path}"
def edit_file(path: str, old: str, new: str, replace_all: bool = False) -> str: