Every SyncCatalog wrote agents' config files again with the same bytes:
a new mtime that wakes every watcher of the file (filememo, the Codex
daemon loop, the agent's own reload), and a temp-and-rename that swaps
the file under an agent reading it. #3870 named Kimi Code, Grok and
AtomCode; with every agent connected in a sandbox HOME, a second sync
rewrote 15 files: .claude/settings.json, Cline's providers.json,
CodeBuddy, Copilot BYOK, Factory, Qwen, Snow (both), WorkBuddy (both),
ZCode, Kimi Code, Grok, AtomCode and magpie's stash.json.
WriteAtomic, which every TOML, JSON, YAML and dotenv writer goes through,
now reads the target after the filter and BOM are applied and returns
when its bytes are the same. A real change is written as before.
Tests:
- internal/edit TestUnchangedWriteKeepsFile: TOML table/key/top, JSON,
YAML and .env; mtime and inode kept on the same bytes, a changed value
written. Red in all 6 with the check turned off by hand.
- internal/agent TestSecondSyncWritesNothing: every connectable agent
connected, second SyncCatalog + dshWiredOnce writes no file. Red with
the old WriteAtomic (15 files), green -count=3 with this one.
Run:
- At 68bbcc01c + this change: gofmt clean; go vet -tags nogui
internal/edit and internal/agent for linux, windows, darwin ok;
go test -timeout 45m over every importer of internal/edit (access,
agent, autostart, backup, cli, codexcat, daemon, davsync, edit,
gateway, library, mcpauth, plugin, profile, provider, settings,
update, usage): all ok but provider's TestFetchAsksASharedBaseOnce
and two siblings (red the same on unchanged origin/main ad3833512,
3 of 3: #3854) and update's TestRelaunchOpenTriedAgain (TempDir
cleanup under load ~90, passes 3 of 3 alone: #3881).
- At the pushed head (rebased on ad3833512): gofmt, 3-OS vet, all of
internal/edit, and internal/agent's new test plus Disconnect, Codex
hand-edit, Kimi, Grok and AtomCode tests: ok. internal/gui, which
imports internal/edit, was not run.
Not tried: the real Kimi Code / Grok / AtomCode apps watching the file.