mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-18 13:23:33 +08:00
Desktop chat sessions can stream and reconnect concurrently, so shared in-process buffers must not be keyed only by process lifetime. This change scopes streaming delta buffers, task-tool refresh bookkeeping, and CLI task mutations to the session that produced the event. It also ignores stale client socket closes after a newer socket has replaced the active connection for the same session. Constraint: Desktop users can keep multiple sessions and tabs active at the same time. Rejected: Serialize all desktop streaming through one active session | would hide the race instead of preserving multi-session behavior. Confidence: high Scope-risk: moderate Directive: Do not reintroduce process-global chat/task pending state without session keys and multi-session regression tests. Tested: cd desktop && bun run test -- src/stores/chatStore.test.ts src/stores/cliTaskStore.test.ts Tested: bun test src/server/__tests__/websocket-handler.test.ts Tested: cd desktop && bun run lint Tested: bun run check:desktop Tested: bun run check:server Tested: bun run check:coverage | changed-lines 100%, fails only existing agent-utils baseline Tested: bun run verify | 8 passed, 1 failed on existing agent-utils coverage baseline, 2 skipped Not-tested: Real desktop dual-window manual smoke. Related: https://github.com/NanmiCoder/cc-haha/issues/302 Related: https://github.com/NanmiCoder/cc-haha/issues/303