mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-29 06:28:23 +02:00
reconcile() previously had no request-ordering protection, so a slow getActiveTasksForIssue response could land after a newer one and clobber the fresher state. Race scenario: task:queued fires reconcile A (response includes T but is delayed); task:completed fires next, optimistically removes T, and triggers reconcile B; B resolves empty and clears the banner; A finally resolves with the stale snapshot and re-adds T — permanent stale "is working" banner with no further events to clear it. Add a monotonic reconcileSeq ref. Each call captures its issued seq; the response only applies if mySeq === reconcileSeq.current (i.e. no newer call was issued after this one). Drop the response otherwise. Add a regression test covering the deferred-promise case plus a companion test for the WS reconnect self-heal path. Co-authored-by: multica-agent <github@multica.ai>