acpmux: each chat settings save has its own temp file
What
ChatSettings::save wrote every save through the same chat-settings.json.tmp and renamed it into place. Two _acpmux/chat_settings pushes at once (an off push still ending agents and an unset push right after it) could share that temp file: one renamed it away, and the other's rename failed with No such file or directory, so that push answered save the chat settings: No such file or directory (os error 2). It showed up as a flaky case in #26034's full_access_managed test ("an off push ends every full-access agent, also when an unset push follows"), about one run in eight.
Now each save writes its own temp file (chat-settings.json.<pid>.<n>.tmp) and removes it if the write or rename fails. The file is still written 0600 and replaced by a rename.
Test (lib chats::settings::tests::saves_at_once_all_succeed: 8 threads save 100 times each; every save succeeds, the file holds one whole, and no temp file is left).
- Red at 8aa0a7ecbb, run 40492279123: fails 3 of 3 (
No such file or directory). - Green at 36fa0f9f3b, run 40492279037: fmt, clippy, 3 of 3, and
full_access_managedpasses.
Found while splitting #25539 (see #26034).
Risk: low. One function, and the file it writes is the same. Size: about 55 changed lines, 35 of them the test.
No capture: no UI changes.
Agent session: agent session
š¤ Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.