Coordinator: keep the first minted pending payload on concurrent next() - #152
Merged
Merged
Conversation
Two concurrent next() calls for the same role can both observe no pending payload and each mint a fresh one; the last store.update wins, so the losing caller holds a signing request over bytes the coordinator no longer stores. Any checkpoint signed from that stale request then fails artifact_signer on submit — deterministically, on every retry. Serialize the decision inside the update callback: if a pending payload is already stored, keep it and build the response signing request from the stored bytes. Covers proposal, acceptance, evidence, and the proposal-window renewal path. Also extend the checkpoint failure detail tags with the recovered signer address prefix and the pending bytes hash prefix (session-scoped public data) so a residual artifact_signer failure separates wrong-key from wrong-bytes in one log line.
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.
Summary
agent_handshake_next: two concurrent polls for the same role could both observe no pending payload and mint different proposals/acceptances/evidence; the laststore.updatewon, stranding signatures made over the loser's request bytes (artifact_signeronsubmit_checkpoint, deterministic on retry).store.updatecallback — an existing stored pending is kept, and the response's signing request is always built from the stored bytes. Applied to proposal, acceptance, evidence, and the proposal-window renewal path.artifact_signer.<recovered12>.<bytesHash8>,artifact_digest.<expected8>,checkpoint_signer.<recovered12>) in the server-sideagent_handshake_tool_failurelog only — public errors staycoordination_failed.Evidence
9eeb53e9showeddetail: "artifact_signer"on all three acceptancesubmit_checkpointretries.Test plan
npm run build(mcp-server)npm test— 550/550/nextto VERIFIED after deploy