fix: prevent status --watch from dropping concurrent dispatches - #134
Draft
cursor[bot] wants to merge 3 commits into
Draft
fix: prevent status --watch from dropping concurrent dispatches#134cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 commits into
Conversation
status --watch kept a long-lived StateStore and saved the full file from stale memory, so a concurrent dispatch could be overwritten on the next tick. Reload from disk before merging upserts, and refresh at the start of each status poll. Co-authored-by: Parvez Kose <koseparvez@gmail.com>
Update the status-command mock for load/upsertMany and format the new StateStore concurrency regression tests. Co-authored-by: Parvez Kose <koseparvez@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
`[].every()` is vacuously true, so an empty sessions payload stopped the
3s refresh. GET /api/sessions also returns `{ sessions: [] }` on list
failures, which made a transient error permanently freeze the dashboard.
Co-authored-by: Parvez Kose <koseparvez@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
polyagent status --watchcould delete sessions from~/.polyagent/state.jsonwhen another CLI process dispatched at the same time. The new session vanished from local state on the next watch tick.Root cause
StateStorekept a long-lived in-memory session list andsave()rewrote the entire file from that snapshot.upsert/upsertManynever reloaded disk first, so a concurrentdispatchwrite was overwritten.Fix
upsert/upsertManystatuspoll so--watchalso sees newly dispatched sessionsValidation
npx vitest run test/state.test.ts test/status-command.test.ts test/status.test.ts— all passing