Repository navigation
fix(openclaw-id): publish membership changes that arrive while a publication finishes - #195261
Conversation
…ication finishes OpenClaw-Publication: 3833d01c-9138-4390-b9e7-31eafeb3040b
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR republishes membership changes requested while a successful Discovery publication clears its pending flag. Example: Membership advances from seq 1 to seq 2 while publication of seq 1 clears pending.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR makes a focused repair to a publication failure still present on main; no introduced code defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway publication retry owner receives membership-change requests, invokes the existing signed Discovery publisher, and records publication progress through the durable membership authority. flowchart LR
Membership[Membership changes] --> Authority[Gateway authority]
Authority --> Retry[Publication retry owner]
Retry --> Publisher[Signed snapshot publisher]
Publisher --> Discovery[Discovery mirror]
Retry --> Store[Durable pending flag]
Discovery --> Enrollment[Enrollment clients]
Technical reviewBest possible solution: Keep the repair in the existing publication retry owner, restoring pending before publishing the latest authority after an overlapping request. Do we have a high-confidence way to reproduce the issue? The source exposes the missed-await window, and the body reports a red/green owner-level reproduction; the exact interleaving behind the original Gateway incident remains unrecorded, and this review executed no target code. Is this the best way to solve the issue? This is the smallest complete repair for the demonstrated window: reuse rerun and setPending in the existing owner, with one regression covering the previously missed settlement overlap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 61093f1d32cb. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +45, Other +2. Total +52 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 8, 2026, 10:04 AM ET / 15:04 UTC. |
What Problem This Solves
Discovery publication can stop one membership change behind. If a change arrives while the previous successful publication is finishing, the newer snapshot is never published, and the Gateway can record that nothing is pending. Nothing retries it until the next periodic re-sign or a restart.
This unblocks #193980. In a real Gateway run for that PR, authority seq 5 committed, but the published snapshot was still at seq 4 with
publish_pending: falseafter 90 seconds.User Impact
An approved device or node can be missing from Discovery until a later refresh. A stale mirror blocks kit enrollment, because a new device signs at the mirror's seq + 1, and it also blocks relay admission. After this change, a change that arrives while a publication is finishing is published by the same loop.
Why This Change Was Made
After a successful publish,
attemptOncecheckedrerunand then awaitedsetPending(false). Arequest()arriving during that await records pending and joins the running loop by settingrerun. The check had already run, so the loop exited without publishing the newer state. The clear could also land after the new request's pending write, which left the durable flag false.publication-retry.ts: after clearing pending, checkrerunagain. If a request arrived, mark pending again durably, so a crash cannot lose it, and run another attempt for the latest state. This is 5 lines, with no new retries, delays or state.adoptandpublishDirectnever clear pending.startandresumego through the fixed loop. The retryable-failure path keeps pending and schedules a retry of the latest state.publish_pendingfalse for that short window. The published seq still lags the authority, sopublicationPendingstill reports it andstartrepublishes on boot.Evidence
Red/green for the new regression,
republishes a request that arrives while a successful attempt clears pending:The test also asserts the order of durable pending writes: the stale clear
[false, seq 1]is followed by a re-mark[true, seq 1], and pending ends[false, seq 2]only after the latest state is published.The deterministic reproduction from the #193980 proof run, against the production
createPublicationRetry:node scripts/run-vitest.mjs runon the publication-retry, publisher and allservice.*tests insrc/gateway/openclaw-id/: 11 files, 79 tests passed.pnpm tsgo:coreand thegateway-othercore test typecheck shard pass.git diff --checkandcheck-test-lines-ratchet --base origin/main.publication-retry.test.tswith--maxWorkers=1took 66 s wall time, 98% of it cold transform.