My config sync script kept undoing my fixes
Two machines push my agent config to one repo, and the last one to push wins. Over a month that quietly reverted a GPU reboot fix, a cron cleanup and a tool migration. I only found one of them by reading a diff for this post.

My terminal agent keeps its configuration in a folder in my home directory: extensions, model settings, scheduled job scripts, prompts. I run it on my laptop and on a container on the home cluster, and I want both to have the same setup. So the folder is mirrored into a private git repo, and there's a script called sync.sh that copies the live files into the repo and pushes.
The heart of it is one small function:
copy_if_differs() {
local r="$1" src="$LIVE/$1" dst="$REPO_DIR/$1"
if [ -e "$dst" ] && cmp -s "$src" "$dst"; then
return
fi
if [ "$DRY" -eq 1 ]; then
echo " drift: $r"
else
mkdir -p "$(dirname "$dst")"
cp "$src" "$dst"
echo " synced: $r"
fi
changed=$((changed + 1))
}
If the live file and the repo's copy differ, the live file wins. That's the whole design. The script doesn't know which one is newer, only which one is local. So a machine with an old copy of a file, running a sync, pushes the old copy over the new one, and the commit looks like any other sync.
The GPU fix that disappeared
I look after a handful of machines that encode video on NVIDIA GPUs. A scheduled job checks them, and one of its jobs is to recover a box where the GPU driver and its library have drifted apart, which leaves the GPU unusable until a reboot. Before it reboots a box, it checks that the reboot will come up consistent: that whatever kernel the machine boots into carries a driver module that matches the library on disk.
On September 26 one box died that way and waited for a human. It had two problems. It wasn't allowed to reboot itself, and even after I flipped that switch, the pre-reboot check still blocked it, because the check only understood one way of installing the driver and this box used the other. That morning the check learned to read the module version from every installed kernel, the box got permission to reboot, and it rebooted itself at 08:22 and came back healthy. The self-test grew two cases for it, and 64 of 64 passed.
On September 27 a commit in the same repo noted, in passing, that four files on the live side had drifted "in the reverting direction". Live had older content than the repo, and a sync would push it back. The commit left them alone and reported it.
On October 7 at 13:55 I committed a change to how OpenRouter picks providers. The commit is titled as exactly that. It also changed eight files, among them the GPU healer (43 lines) and its self-test (32 lines). The lines it removed were the reboot check and the permission switch from September 26. The old copies from the stale machine were committed along with my real change.
Two minutes later, at 13:57, a commit restored the agent notes and the model config that the same sync had reverted. Those were the files I noticed, because they changed how the agent behaved right away. Nobody noticed the healer. As of today the repo has no per-kernel module check, and that box is back to waiting for a human. I found that while reading the history for this post.
The same thing, three more times
- October 19. I'd asked an agent to merge two scheduled jobs into one, to make them easier to follow. A sync from the other machine pushed a tree from before that work. It kept the new prompt file and reverted the scripts it depended on, and brought back a deleted prompt for good measure. The fix commit has a line I keep thinking about: "a rebase alone silently dropped it." Git saw no conflict, because the stale push was a perfectly valid newer commit.
- October 22. The chat bridge's tools had moved behind the model gateway on October 19. A stale sync restored the old direct connection, so the agent had both and saw every chat tool twice. That cleanup added regression tests that fail if the direct entry comes back.
- November 11. A commit titled "docs" moved the gateway URL to its new public hostname, which was the point. It also changed the default model and raised the thinking level. Maybe that was on purpose. Nothing in the commit says so either way.
What the script needs
Some of the protection already exists. The script has a secret scan that runs before anything is committed, and since September 21 a --check mode that fails when live and repo disagree in either direction. But --check only reports that the files differ. It can't say which side is newer.
The real fix is for the sync to know where each file came from. Each machine should record the commit it last installed, and a sync should refuse to push a file that changed in the repo since then, the way a git push refuses when the remote has moved. Until that exists, the file list of a sync commit tells me more than its title. A commit titled for OpenRouter routing that changes a GPU healer has stale files in it.