Skip to content

fix: recover saved peer updates before admitting their turns - #174203

Merged
steipete merged 1 commit into
mainfrom
fix/gateway-peer-recovery-admission-174134
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/gateway-peer-recovery-admission-174134

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes accepted peer updates remaining undelivered after a Gateway restart when replay starts before the receiver's interrupted work has been reconciled.

User Impact

Saved sessions_send updates recover once, in order. Cancelled inputs stay cancelled, and reset or permission-revoked sources remain blocked. The original session and current authorization remain authoritative.

Why This Change Was Made

#174134 correctly waits for restored subagent authority before main-session recovery. That exposed an admission gap: peer replay can reach an orphaned receiver first, touch its row, then fail with SESSION_WORK_START_CHANGED because its old run has no recovery cycle.

Agent admission now uses the existing orphan-reconciliation owner before touching that receiver. The owner preserves its live-writer, exact-session, and worker-placement checks. The startup readiness change and strict command claim guard remain intact. There is no new queue, retry, timer, schema, configuration, or permission change.

Release-note context: saved peer updates now recover across this startup ordering without requiring a manual resend.

Evidence

  • Hourly 38894297213, job 116951161339: five accepted updates reached no provider. Current main 9215eace2fb2 reproduces the same failure. A temporary stack diagnostic pins all five failures to claimAgentCommandRecoveryOwner; the diagnostic was removed.
  • Adjacent culprit control: fix(sessions): wait for subagent restoration before restart recovery #174134's parent 8b0908f63429 passes the unchanged cold-restart test (90.35s Vitest). The PR's startup-order change is retained.
  • Fixed native proof: 66/66 passed across gateway.sessions-send-recovery.test.ts, session-send-recovery.test.ts, and agent-command-recovery-owner.test.ts, with --maxWorkers=1. Wrapper wall: 227.07s, including an 88.5s runtime rebuild. The real Gateway case took 40.20s and verifies five ordered deliveries, cancelled/reset/revoked exclusions, retained blocked-input notices, and no duplicates after a second restart. Every existing assertion is unchanged.
  • Core typecheck, targeted type-aware lint, formatting, and diff check passed. Fresh P2 autoreview found no actionable issues.

Broad proof belongs to this PR's CI. No CI dispatch or rerun was requested.

Reconcile orphaned receiver custody through the existing recovery owner before
agent admission touches the session row. Retain exact-session, live-writer,
worker-placement and command-claim checks, plus the restored registry gate.

Main 9215eac reproduces all five lost deliveries; the parent of #174134
passes the unchanged cold-restart regression. All 66 focused tests pass with
maxWorkers=1 (227.07s wrapper, including runtime build; native case 40.20s).
Core types, targeted lint/format and independent P2 review pass.

Release-note context: accepted peer updates recover across startup ordering
without manual resend; cancelled/reset/revoked sources remain blocked.
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 16, 2026 12:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T12:25:16.490387Z 5dd2b9e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@steipete
steipete merged commit fa191c5 into main Oct 16, 2026
199 of 201 checks passed
@steipete
steipete deleted the fix/gateway-peer-recovery-admission-174134 branch October 16, 2026 12:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…w#174203)

Reconcile orphaned receiver custody through the existing recovery owner before
agent admission touches the session row. Retain exact-session, live-writer,
worker-placement and command-claim checks, plus the restored registry gate.

Main 78c0e92 reproduces all five lost deliveries; the parent of openclaw#174134
passes the unchanged cold-restart regression. All 66 focused tests pass with
maxWorkers=1 (227.07s wrapper, including runtime build; native case 40.20s).
Core types, targeted lint/format and independent P2 review pass.

Release-note context: accepted peer updates recover across startup ordering
without manual resend; cancelled/reset/revoked sources remain blocked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant