fix(gateway): use atomic writes for config.yaml to prevent data loss (#3800)

Replace all 5 plain open(config_path, 'w') calls in gateway command
handlers with atomic_yaml_write() from utils.py. This uses the
established tempfile + fsync + os.replace pattern to ensure config.yaml
is never left half-written if the process is killed mid-write.

Affected handlers: /personality (clear + set), /sethome, /reasoning
(_save_config_key helper), /verbose (tool_progress cycling).

Also fixes missing encoding='utf-8' on the /personality clear write.

Salvaged from PR #1211 by albatrosjj.
This commit is contained in:
Teknium
2026-03-29 15:32:46 -07:00
committed by GitHub
parent 83cbf7b5bb
commit 612321631f

Diff Content Not Available