You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix PersistenceCoordinator race: hasPending gap allows WatchNodes echo to clobber optimistic state #1314
When a persistence operation completes and there is a queued successor, there is a brief window where hasPending(nodeId) returns false. During this gap, a WatchNodes database-echo event can bypass the skip-while-editing guard in setNode() and clobber optimistic state written by the user.
Observed symptom: selecting 'Built-in model' in the AI chat provider picker has no visible effect — the provider property written optimistically gets overwritten by the stale database echo before the queued operation runs.
Root Cause
In PersistenceCoordinator.persist()'s finally block:
pendingOperations.delete(nodeId) — node removed from pending
Queued op found → setTimeout(() => persist(...)) scheduled
executingOperations.delete(nodeId) — node removed from executing
Between steps 2 and 3, and until the setTimeout callback fires and registers the queued op in pendingOperations, hasPending() returns false.
Fix
Re-register the queued op in pendingOperations as a placeholder before clearing executingOperations, so hasPending() stays true throughout the transition.
Activity
Fix PersistenceCoordinator race: hasPending gap allows WatchNodes ech…
Fix PersistenceCoordinator race: hasPending gap allows WatchNodes ech…