mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Concurrent writes to the same settings file could interleave and leave user preferences in a partially updated state, and a restarted conversation session could still be torn down by an older process exit callback. This serializes per-file settings writes, hardens temp-file handling, adds regression coverage for both service behaviors, and drops an unused sidecar external from the build exclude list. Constraint: Settings writes must remain atomic while allowing multiple service entry points to update the same JSON file Rejected: Keep fire-and-forget writes with unique temp names only | still allows stale reads and last-writer races between callers Confidence: high Scope-risk: moderate Reversibility: clean Directive: Preserve the per-file write lock when adding new settings mutation paths so concurrent writes keep one serialization point Tested: bun test src/server/__tests__/settings.test.ts src/server/__tests__/conversations.test.ts (new settings/conversation cases passed) Not-tested: Root lint script is unavailable; Models API tests in src/server/__tests__/settings.test.ts still fail in this checkout with changed default model/effort expectations