Skip to content

fix(gateway): keep reapproved node connections alive - #187461

Merged
RomneyDa merged 1 commit into
release/2026.10.9from
repair/2026-10-9-node-pairing
Oct 29, 2026
Merged

RomneyDa merged 1 commit into
release/2026.10.9from
repair/2026-10-9-node-pairing

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes connected nodes being disconnected when their capabilities are reapproved while command dispatch is being prepared.

User Impact

Reapproval preserves the authenticated connection while still refusing commands admitted under its previous pairing generation. Replaced devices, revoked tokens, and stale generations remain rejected. No public configuration, database schema, or permission-policy changes.

Why This Change Was Made

Backports Peter Steinberger’s 94f180d9ab19d969d59298312cff8ed019e18b58 to release/2026.10.9. The worker publishes committed identity, generation, and surface together before connection reconciliation can invalidate the old live generation. The current release dispatcher’s post-operation database read is preserved.

The failure was observed in source CI 40833415360, job 123312855002, at exact source 8358419696a54cc1843d35686ea6c669cbe1276a: the reapproval case in server.node-pairing-publication.test.ts disconnected with device-pairing-changed.

Evidence

  • New deterministic regression uses the real pairing worker and forces connection reconciliation after commit but before the RPC resumes: red on 8358419 (1 failed, 13 passed), green with the repair (14 passed).
  • Original server-level failing suite: 6 passed, including reapproval, revoke, rotation, unpair, and unrelated-publication cases.
  • Pairing owner/lifecycle siblings: 87 passed across 3 files.
  • All local checks used rootless, network-disabled, credential-free Podman. Existing cached dependencies supported these behavior checks; they are not exact release dependency qualification. Hosted exact-head CI is still required.
  • Scoped TypeScript check (changed entrypoints plus repository ambient declarations) passed. Scoped type-aware lint: 9 files, 0 warnings/errors. Formatting, repository precommit content/format checks in isolated Git metadata, and git diff --check passed.
  • Independent nine-file review: no P0–P2 findings; no retries, timeout changes, or weakened assertions.

No release validation was dispatched and nothing was merged or released by this repair lane.

Backport committed node approval publication so connection reconciliation
sees the approved generation and capability surface before the RPC resumes.
Keep the release dispatcher post-operation database snapshot behavior.

(cherry picked from commit 94f180d)

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 29, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Oct 29, 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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR publishes committed node approval facts before reconciliation can disconnect the authenticated connection.

Example: A connected node is reapproved while a canvas.snapshot command is being prepared.

  • Before: Reconciliation can disconnect the node with device-pairing-changed.
  • After: The connection remains usable, while the command prepared under the previous generation is refused.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused repair with meaningful owner and WebSocket boundary coverage; proof remains harness-based, with execution results reported rather than raw logs inspected.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (none): The maintainer-authored backport reports passing production-server WebSocket scenarios for preserved reapproval connectivity and zero delivery under retired authority, supported by the inspected harness and exact-head CI; raw CI logs were inaccessible.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An established node connection can disconnect when an operator reapproves its capabilities.
Reason: Maintainer direction is established, and the backport repairs a concrete connection-lifecycle failure without adding configuration or changing permission policy.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a useful maintainer-authored release backport, and review found no introduced correctness defect. Main already contains the repair, and exact-head CI passed.

Priority: P2
Reviewed head: 8cf6344574e6542f492eb177aa5cb1c0af9a4322

Before merge

None.

Findings

None.

Agent review details

How this fits together

The pairing worker commits approved node capabilities in SQLite, publishes identity and generation facts, and updates the Gateway registry that authorizes transport dispatch.

flowchart LR
  A[Approval RPC] --> B[Pairing worker]
  B --> C[SQLite commit]
  C --> D[Commit publication]
  D --> E[Live node registry]
  E --> F[Generation fenced dispatch]
Loading

Technical review

Best possible solution:

Retain the focused release backport with committed publication owning live promotion and existing generation fences protecting dispatch.

Do we have a high-confidence way to reproduce the issue?

The base publishes the new durable generation before the RPC updates the live session, allowing intervening reconciliation to invalidate it; the PR reports a deterministic red-before/green-after regression.

Is this the best way to solve the issue?

The change repairs publication ordering at the existing pairing owner, removes obsolete rereads, and preserves the release branch's database snapshot behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 00125bb5bbc0.

Provenance checked

  • Pairing identity and generation fencing keeps the original intent (186c25f: Keep retired transports and work from inheriting authority after pairing transitions.)
  • Worker commit publication keeps the original intent (05117d9: Move database work off the Gateway thread and publish committed bindings before caller continuation.)
  • Live approved surface keeps the original intent (5a9168f: Apply runtime policy without widening pairing approval or interrupting healthy sessions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +51, Tests +46. Total +97 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 104 53 +51
Tests 1 96 50 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 200 103 +97

Labels

Label changes:

  • add P2: Capability reapproval can interrupt an established node connection, with impact limited to the pairing transition.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Capability reapproval can interrupt an established node connection, with impact limited to the pairing transition.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 29, 2026, 3:49 AM ET / 07:49 UTC.

@RomneyDa
RomneyDa merged commit 1300a3c into release/2026.10.9 Oct 29, 2026
149 checks passed
@RomneyDa
RomneyDa deleted the repair/2026-10-9-node-pairing branch October 29, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants