DIVE-3809: serialise the pending drain across processes, and stop calling collection delivery - #47
Merged
Merged
Conversation
…ling collection delivery The `draining`/`rerun` pair is module state — it serialises the three callers inside one process and is blind to a second one. Two plugin processes for the same agent each fetch the SAME pending rows and push every message twice, because the ack lands only after the notifications are sent. DIVE-3806 REFUTED this as the cause of the loss it observed (lifecycle.log showed exactly one live process across that window). It is still a real race and it is scope 3 of DIVE-3809. - an O_EXCL lock file at $STATE_DIR/pending-drain.lock, TIME-BOUNDED at 2min so a drain killed mid-flight cannot wedge the collect path permanently — which would turn an intermittent loss into a total one. - a filesystem that cannot support the lock degrades to today's per-process guard rather than blocking the collect. - log wording: the ack attests COLLECTION, never display. The SDK's send() has no reject path and a client with nothing subscribed drops the notification silently, so 'healed N undelivered' was a claim this code cannot make. test/dive3809-drain-lock.test.ts runs TWO real server.ts processes against one stub control plane and one shared state dir; dashboard-collect-now.test.ts runs a single process and stays green with the lock deleted, so it could not grade this. Graded by mutation: with acquireDrainLock stubbed to `return true`, both arms go red. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts: # plugins/dashboard/server.ts
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.
Delivers DIVE-3809.
Opened by
5dive push --open-pr(DIVE-2605): the branch and this pull request went out on the same root-side rail, as 5dive-bot. The authoring agent holds no GitHub credential.