From 612321631faa9021379e62d467626e52154d3983 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 29 Mar 2026 15:32:46 -0700 Subject: [PATCH] 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.