fix: decide a reclaimed delivery on the wake outcome alone - #30
Merged
Merged
Conversation
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.
Follow-up to #29, from an adversarial review of a defect six rounds of targeted fixes failed to converge on.
The defect
The post-wake decision — is this delivery deferred (what the agent did) or reclaimed for restart (what the runtime did) — keyed on
this.stopping || result.status === "stopped". Only the second is a wake outcome; the first is a host-lifecycle flag.So a wake that completed had its evidence discarded because the dispatcher happened to be halting, and the delivery was recorded
accepted, deferred: false, execution_id retained, no code— a record byte-identical to "never ran" and to "ran but forgotten".Production tolerates this because a restart re-delivers and the agent redoes the work. A one-shot trial cannot, and the ambiguity is why six rounds of naming causes could not converge.
dispatcher.halt()runs beforehost.stop(), so the only case the flag uniquely covered was a wake that resolved on its own merits during the halt — precisely the evidence being lost.The change
Remove
this.stoppingfrom the post-wake condition; the wake result alone decides. The pre-wake guard is untouched. This is a removal, not a mechanism.A test added in the previous round asserted the defective behaviour and has been inverted: a completed wake under a halting dispatcher now records
deferred: true.Verification
Suite 878 pass / 0 fail. Verified by executing the shipped dispatcher in both images: the previous build records
deferred: falsewith the execution id retained, this one recordsdeferred: truewith it cleared. A wake that returnsstoppedis still reclaimed with its code recorded.🤖 Generated with Claude Code