Skip to content

fix: keep concurrent node turns available during capacity updates - #164087

Merged
steipete merged 1 commit into
mainfrom
codex/node-parity-r3-soak
Oct 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/node-parity-r3-soak

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes node-hosted turns failing reconciliation or stalling when another turn publishes worker-capacity updates.

User Impact

Concurrent node sessions keep their pairing authority while capacity, host statistics, and skill-bin metadata are updated. Update the Gateway; no node configuration, stored-pairing migration, or protocol change is required.

Why This Change Was Made

Pairing publication blocked every connected node while any pairing-store mutation was pending. Runner inventory writes session-host metadata on capacity updates, so ordinary concurrent turns could temporarily appear disconnected. The pairing owner now preserves usable authority only for the three metadata operations that cannot change pairing identity or generation. Revocation, approval, prior failed reads, epoch checks, and precommit ownership checks retain their existing fences.

The focused repair adds 5 production lines (+8/-3), using the campaign's small bug-fix allowance. Deleting unrelated code to offset this authority distinction would dilute the fix.

Evidence

  • Live AWS proof used one isolated Gateway and two loopback node hosts on the same lease. Before: one of four concurrent turns failed with device worker node is not connected with the supervisor dialect; another had a 28,878 ms tail. After: 12/12 turns across four sessions completed with ordered transcripts and no missing or duplicate inputs.
  • The deterministic regression fails on the original production code for exactly the three metadata operations. Token-revocation and already-failed-publication controls pass before and after. All 145 tests across five affected/sibling files pass.
  • Changed-file standalone cost: pnpm test src/infra/device-pairing-publication.test.ts --maxWorkers=1: 13 passed, 4.43 s Vitest duration / 11.74 s total wall time. Hosted CI 37102981145 passed on exact head 3ba04387fc5552f9e1c3ed288da8d7a4a472968d: 437 s total run wall time, 44 successful jobs, no failures or reruns. The hosted figure is whole-run time, not isolated test-file time.
  • pnpm tsgo:core, the selected infra test typecheck, targeted oxlint, lease oxfmt --check on all four files, and the qaRuntime build passed. Independent Codex autoreview found no actionable findings.
  • Scoped call-index fixture search found no changed call counts or ordering to repair.

Warm-turn medians (five warm turns, same lease; milliseconds):

Placement Before TTFT / final / tail After TTFT / final / tail
Gateway local 1282 / 1575 / 255 1697 / 1852 / 233
Node 1637 / 2246 / 559 1482 / 2145 / 635

These small samples do not establish a tail-latency improvement. The node tail remains higher than local; this PR repairs the concurrency failure.

Additional live soak coverage and limits
Scenario Observed result
23-turn node session with exec/read/write/apply_patch Passed; ordered transcript and no pending inputs
Creation/deletion/rename, deep paths, symlink, 1 MiB binary and 2.2 MB text Gateway-side bytes, hashes, sizes, and symlink target verified
Manual compaction followed by node tool use Passed; session read the expected final journal entry
Cancel mid-stream and during a confirmed-running command Aborted, follow-up passed; no surviving Python child or late-write file
Queue and steer during a tool call Follow-up inputs drained exactly once; steering used queued fallback
Node-host kill during a running command Visible terminal error, then successful next turn
Gateway kill during a running command Startup recovery completed under a new run ID; persisted status and next turn verified. The old-run-only harness listener timed out and was not counted as a product hang
Worker idle expiry No worker remained in that workspace after expiry; next turn succeeded
Gateway-side edit conflicting with node edit Gateway version preserved, uncontested file applied, node conflict ref recorded
Node → Gateway → other node Workspace and transcript continued successfully
Codex remote exec Unavailable: test nodes did not advertise the required Codex plugin command; actionable install/enable/restart guidance returned

The lab kit required two isolated harness corrections before useful proof: startup script names and waiting for onHelloOk before RPCs. Neither is part of the product diff. No timing instrumentation is committed.

Capacity, host-stat, and skill-bin publications no longer temporarily block
unchanged pairing authority across connected nodes. Revocation, approval,
failed-read blocks, and precommit ownership checks retain their fences.

Add a deferred-worker regression and document Gateway-only update behavior.
The owner fix adds five production lines under the bug-fix allowance.

Validated on an isolated AWS lease: 145 focused/sibling tests, core and infra
test typechecks, runtime build, targeted lint, and live concurrency/soak.
Commit uses --no-verify because this sparse worktree has no dependencies;
lease pnpm exec oxfmt --check passed for every changed file before commit.
@clawsweeper

clawsweeper Bot commented Oct 3, 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 docs Improvements or additions to documentation size: S labels Oct 3, 2026
@steipete
steipete marked this pull request as ready for review October 3, 2026 06:25
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 3ba04387fc5552f9e1c3ed288da8d7a4a472968d
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/device-pairing-publication.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-worker.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 2:41 AM ET / 06:41 UTC (Revision 2).

ClawSweeper review

What this changes

The PR keeps node-hosted sessions available during capacity, host-statistics, and skill-bin updates, adds regression coverage, and documents Gateway-only upgrade behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this focused repair remains necessary on current main and has no actionable correctness findings. The reported concurrency proof supports the intended outcome, and source inspection preserves the existing revocation fences.

Priority: P1
Reviewed head: 3ba04387fc5552f9e1c3ed288da8d7a4a472968d

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A small owner-level repair combines relevant real concurrency evidence, targeted regression controls, and explicit upgrade documentation.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured AWS run exercises concurrent node-hosted turns through the Gateway owner affected by metadata publication: the reported failure changes to 12/12 completed turns with ordered transcripts. Source inspection confirms no stored-data contract changes or migration requirement.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured AWS run exercises concurrent node-hosted turns through the Gateway owner affected by metadata publication: the reported failure changes to 12/12 completed turns with ordered transcripts. Source inspection confirms no stored-data contract changes or migration requirement.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head delta changes only pairing publication, its worker adapter, regression coverage, and session-hosting documentation. The verified test merge has the same production result as the reviewed head for both production files.
Still necessary on main and released baseline: Fetched main still calls beginMutation without distinguishing metadata operations. The latest release's publication implementation likewise unconditionally sets blocked=true, so neither inspected baseline contains this repair.
Release source check: v2026.9.8 retains unconditional publication blocking during mutations.
Findings None None.
Security None None.

How this fits together

The Gateway publishes pairing facts from its database worker so connected-node dispatch can check current authority without database access on the main thread. Node metadata updates pass through this same owner and affect session availability.

flowchart TD
  A[Node metadata updates] --> C[Pairing mutation owner]
  B[Approval and revocation] --> C
  C --> D{Authority can change?}
  D -->|Yes| E[Block published authority]
  D -->|No| F[Preserve usable authority]
  E --> G[Publish committed pairing facts]
  F --> G
  G --> H[Check authority before node dispatch]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +94, Docs +4. Total +103 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 3 +5
Tests 1 94 0 +94
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 106 3 +103

Review metrics

Metric Value Why it matters
Authority regression coverage 3 metadata scenarios and 2 blocking controls Coverage distinguishes the availability repair from revocation and failed-read behavior that must remain fenced.

Technical review

Best possible solution:

Keep the repair in the pairing publication owner, preserving current authority through metadata writes while retaining revocation and stale-publication fences.

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

Yes: current source blocks all published node authority while a metadata mutation awaits its worker, and the PR records a matching real concurrency failure. This read-only review did not execute the scenario.

Is this the best way to solve the issue?

Yes: distinguishing identity-preserving operations at the existing publication owner fixes the interruption without adding another authority source or changing stored pairings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 88b1a534773a.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: Reported concurrent node-hosted turns fail or stall during routine capacity publication, breaking an active agent workflow.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured AWS run exercises concurrent node-hosted turns through the Gateway owner affected by metadata publication: the reported failure changes to 12/12 completed turns with ordered transcripts. Source inspection confirms no stored-data contract changes or migration requirement.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured AWS run exercises concurrent node-hosted turns through the Gateway owner affected by metadata publication: the reported failure changes to 12/12 completed turns with ordered transcripts. Source inspection confirms no stored-data contract changes or migration requirement.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head delta changes only pairing publication, its worker adapter, regression coverage, and session-hosting documentation. The verified test merge has the same production result as the reviewed head for both production files. (src/infra/device-pairing-worker.ts:147, 3ba04387fc55)
  • Still necessary on main and released baseline: Fetched main still calls beginMutation without distinguishing metadata operations. The latest release's publication implementation likewise unconditionally sets blocked=true, so neither inspected baseline contains this repair. (src/infra/device-pairing-worker.ts:146, 88b1a534773a)
  • Release source check: v2026.9.8 retains unconditional publication blocking during mutations. (src/infra/device-pairing-publication.ts:131, fc23bc864e45)
  • Authority distinction and final dispatch fence: Only three metadata operations preserve publication availability; their worker handlers update fields excluded from pairing identity and generation. Existing blocked state remains blocked, epochs still prevent stale read publication, and transaction/commit admission rechecks current ownership. Node event transport checks published pairing immediately before sending. (src/infra/device-pairing-publication.ts:129, 3ba04387fc55)
  • Meaningful regression controls: The new deferred-worker test exercises the real mutation owner for three metadata operations and separately checks token revocation and an existing failed-read block. Existing sibling tests reject replaced connection ownership and retired pairing generations. The PR reports baseline failure for the three intended regression cases and 145 passing focused/sibling tests. (src/infra/device-pairing-publication.test.ts:82, 3ba04387fc55)
  • Captured production behavior proof: The supplied complete PR body reports an isolated AWS Gateway with two loopback node hosts: before the fix, one of four concurrent turns failed and another had a 28,878 ms tail; afterward, 12/12 turns across four sessions completed with ordered transcripts and no missing or duplicate inputs. This exercises the concurrent node path affected by pairing publication. These are contributor-recorded observations, not execution performed by this review. (3ba04387fc55)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-03T06:30:43.846Z sha 3ba0438 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 3, 2026
@steipete
steipete merged commit 7a452b0 into main Oct 3, 2026
211 checks passed
@steipete
steipete deleted the codex/node-parity-r3-soak branch October 3, 2026 06:58
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Capacity, host-stat, and skill-bin publications no longer temporarily block
unchanged pairing authority across connected nodes. Revocation, approval,
failed-read blocks, and precommit ownership checks retain their fences.

Add a deferred-worker regression and document Gateway-only update behavior.
The owner fix adds five production lines under the bug-fix allowance.

Validated on an isolated AWS lease: 145 focused/sibling tests, core and infra
test typechecks, runtime build, targeted lint, and live concurrency/soak.
Commit uses --no-verify because this sparse worktree has no dependencies;
lease pnpm exec oxfmt --check passed for every changed file before commit.
yozakura-ava pushed a commit to yozakura-ava/openclaw that referenced this pull request Oct 4, 2026
Capacity, host-stat, and skill-bin publications no longer temporarily block
unchanged pairing authority across connected nodes. Revocation, approval,
failed-read blocks, and precommit ownership checks retain their fences.

Add a deferred-worker regression and document Gateway-only update behavior.
The owner fix adds five production lines under the bug-fix allowance.

Validated on an isolated AWS lease: 145 focused/sibling tests, core and infra
test typechecks, runtime build, targeted lint, and live concurrency/soak.
Commit uses --no-verify because this sparse worktree has no dependencies;
lease pnpm exec oxfmt --check passed for every changed file before commit.

(cherry picked from commit 7a452b0)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: S 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.

1 participant