Skip to content

fix(nodes): preserve pairing errors during workspace setup - #173209

Merged
steipete merged 1 commit into
mainfrom
ci/fix7-native-discovery
Oct 15, 2026
Merged

steipete merged 1 commit into
mainfrom
ci/fix7-native-discovery

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #171208, #126961.

What Problem This Solves

When a paired node rejects an invocation just after duplex readiness, remote workspace setup can receive a generic closed-channel error instead of the retryable pairing-change error. The existing read recovery then cannot classify the failure, so a first agent turn can fail before inference.

User Impact

Workspace reads retain the invocation's original failure metadata during listener and start-message setup. Existing bounded recovery can recognize a pairing change. Closed channels stay closed; revoked authority, non-retryable failures and writes retain their existing behavior. No configuration or migration is needed.

Why This Change Was Made

The shared duplex owner already exposes the original rejection on closed, but final cleanup replaced its lifetime reason with a generic closure. Preserve that rejection before cleanup, and surface the current lifetime reason when a send fails. All live authority checks remain, including the per-frame effect fence. No retry limit, timeout, framing limit, SDK surface or invocation owner changes.

The generic finalizer dates to d17bbfc (#126961). This preserves its terminal/no-resume contract while allowing #171208's existing read-only recovery to see the error it already handles.

Evidence

  • Controlled service-owned in-process dispatch regression: canonical UNAVAILABLE / retryable PAIRING_CHANGED arrives after framed readiness and before caller setup. Both cases fail on unchanged production: listener setup sees Node duplex command has closed., and send sees node duplex channel is closed. The same two cases pass after the repair, retaining the error fields and proving no input was sent after rejection.
  • 89 service-node, service-retention and duplex-framing tests passed locally with --maxWorkers=1 (34.74s wrapper). The service-node file has 21 tests, 5.20s Vitest / about 1.2s test execution.
  • Core types, canonical plugin test types, focused type-aware lint, boundary lint, formatting, diff check and independent P2 review passed. One initially mistyped graph selector was rejected before compilation; the corrected canonical graph passed.
  • Unchanged current-main native same-session E2E passed all four pairs/eight requests (45.54s test, 93.70s Vitest; genuine private QA build included). Post-change native E2E also passed all four pairs/eight requests (38.69s test, 52.75s Vitest, 422.47s wrapper including actual runtime rebuild).

The four hourly sightings share first-turn Remote workspace skill discovery failed, preceded by pairing churn and capability approval. Their wrapped errors omit the nested discovery cause. This regression proves the production metadata-loss defect, but does not establish that every hourly failure took this exact branch. Passing replays alone are not claimed as flake attribution. No leases were acquired.

Keep the invocation rejection as the terminal channel reason so listener and start-send setup preserve typed pairing failures. Existing bounded workspace read recovery can then classify the original rejection; channels remain terminal and authority fences remain intact.

Add deterministic service-owned dispatch regressions for both setup operations. The original rejection already survived on closed, but setup previously received generic closure errors.
@clawsweeper

clawsweeper Bot commented Oct 15, 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 15, 2026 14:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-15T14:46:31.002053Z b448772 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 15, 2026
@steipete
steipete enabled auto-merge (squash) October 15, 2026 14:49
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves the original node invocation error during duplex listener setup and failed sends.

Example: A workspace.skills invocation rejects after readiness with UNAVAILABLE, retryable: true, and details.code: PAIRING_CHANGED.

  • Before: Listener setup or the first send receives a generic closed-channel error, preventing existing read recovery from recognizing the pairing change.
  • After: Setup receives the original pairing-change metadata, allowing the existing bounded read retry to classify it.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with meaningful boundary regressions and no identified defect; direct evidence for the changed branch stops at the in-process fixture.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored classification exempts this PR from the ordinary contributor proof gate; branch-specific evidence uses real service dispatch and framing with mocked node dispatch, while reported native E2E runs provide broader regression coverage.
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 agent turn can fail during remote workspace preparation because a retryable node pairing rejection becomes a generic closure error.
Reason: The existing duplex feature owner authored this narrow repair, which restores information already available on closed without changing retry policy or channel lifetime.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a concrete metadata-loss defect still present on current main, preserves terminal channel behavior, and introduces no identified correctness or security defect.

Priority: P2
Reviewed head: b44877276fe29b879b0236bce10559d6fc980351

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-entry-point trace forces rejection between readiness and setup; the native E2E passes do not establish that this branch ran.
Agent review details

How this fits together

The Gateway duplex owner connects plugin and service callers to canonical node invocation, translating binary messages into transport frames and returning results or terminal errors.

flowchart LR
A[Workspace Skills read] --> B[File transfer adapter]
B --> C[Service node invoker]
C --> D[Shared duplex owner]
D --> E[Canonical node invocation]
E --> F[Paired node]
E --> D
D --> B
Loading

Technical review

Best possible solution:

Preserve the original rejection in the shared duplex owner while retaining terminal closure, existing authority fences, and adapter-owned read retries.

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

Source establishes the post-readiness rejection path and generic error replacement, and the body records both added cases failing before the repair and passing afterward; this read-only review executed no target code.

Is this the best way to solve the issue?

The repair belongs in the shared owner that loses the metadata, serves both plugin and service callers, and requires no duplicate recovery policy or new API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2e250667fa20.

Provenance checked

  • Duplex rejection and terminal cleanup keeps the original intent (d17bbfc: The original feature made channels terminal on invocation completion or failure and rejected retained methods after closure.)
  • Shared service-owned duplex framing keeps the original intent (fd46f38: Service file transfer reused the existing binary channel while retaining pairing, command, approval, and service lifetime checks.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d17bbfc adds src/gateway/server-plugins-node-runtime.ts:81 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d17bbfc31a8f; files: src/gateway/server-plugins-node-runtime.ts)
  • Kimi Yu: Raw commit fd46f38 adds src/gateway/server-plugins-node-runtime.ts:81 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fd46f38cf0f9; files: src/gateway/server-plugins-node-runtime.ts)

PR surface

Source +12, Tests +26. Total +38 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 13 1 +12
Tests 1 26 0 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 39 1 +38

Labels

Label changes:

  • add P2: Lost error metadata can interrupt agent preparation on paired-node workspaces, with a limited affected surface and a focused repair.
  • 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: Lost error metadata can interrupt agent preparation on paired-node workspaces, with a limited affected surface and a focused repair.
  • 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally capture a real Gateway/node run that rejects after readiness and shows the original pairing metadata reaching setup.

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 15, 2026, 10:59 AM ET / 14:59 UTC.

@steipete
steipete merged commit ebccf57 into main Oct 15, 2026
194 of 195 checks passed
@steipete
steipete deleted the ci/fix7-native-discovery branch October 15, 2026 15:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Oct 15, 2026
A settled node invoke can disappear before its pairing-change response
reaches the duplex caller. A concurrent start-frame send then replaces
that response with a generic missing-invocation error, preventing existing
read recovery from classifying the failure.

Mark definitely retired input and join the original invocation result
before framing handles the send failure. Join the raw promise, avoiding
a dependency on output-listener draining. Live transport failures retain
their immediate path; no retry, timeout or authority policy changes.

Follow up #173209. The new ordering case fails on original production
under Node and Bun and passes after the fix. All 228 focused owner,
retention, registry, policy, framing and workspace tests pass on Node.
The fifth hourly still lacks its nested cause, so exact CI attribution
remains unproven; the unchanged native E2E passes locally.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
)

Keep the invocation rejection as the terminal channel reason so listener and start-send setup preserve typed pairing failures. Existing bounded workspace read recovery can then classify the original rejection; channels remain terminal and authority fences remain intact.

Add deterministic service-owned dispatch regressions for both setup operations. The original rejection already survived on closed, but setup previously received generic closure errors.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…aw#173393)

A settled node invoke can disappear before its pairing-change response
reaches the duplex caller. A concurrent start-frame send then replaces
that response with a generic missing-invocation error, preventing existing
read recovery from classifying the failure.

Mark definitely retired input and join the original invocation result
before framing handles the send failure. Join the raw promise, avoiding
a dependency on output-listener draining. Live transport failures retain
their immediate path; no retry, timeout or authority policy changes.

Follow up openclaw#173209. The new ordering case fails on original production
under Node and Bun and passes after the fix. All 228 focused owner,
retention, registry, policy, framing and workspace tests pass on Node.
The fifth hourly still lacks its nested cause, so exact CI attribution
remains unproven; the unchanged native E2E passes locally.
hilsbos pushed a commit to hilsbos/openclaw that referenced this pull request Oct 22, 2026
)

Keep the invocation rejection as the terminal channel reason so listener and start-send setup preserve typed pairing failures. Existing bounded workspace read recovery can then classify the original rejection; channels remain terminal and authority fences remain intact.

Add deterministic service-owned dispatch regressions for both setup operations. The original rejection already survived on closed, but setup previously received generic closure errors.

(cherry picked from commit ebccf57)
Co-authored-by: RomneyDa <[email protected]>
ben-milanko added a commit to ben-milanko/openclaw that referenced this pull request Oct 23, 2026
Backport upstream openclaw#173209
(ebccf57) and openclaw#173393
(281a6bb).

Retain typed invocation failures through listener and start-send setup,
including a send concurrent with retired input. The existing bounded
workspace read recovery can then classify pairing changes. Preserve
live authority checks, retry limits, timeouts and framing bounds.

Three final file blobs match the upstream follow-up. Formatting and
scoped P2 independent review pass. The local baseline never reached
assertions before the unchanged no-output import guard stopped it;
targeted lint lacks an installed eslint-plugin-solid prerequisite.
Repair-head CI remains required. The original native CI log omitted its
nested cause, so this is not claimed as exact sighting attribution.

Co-authored-by: ben-milanko <[email protected]>
tideclaw-bot added a commit that referenced this pull request Nov 4, 2026
Adapt 21 audited fixes to release-native ownership and recovery.
Retain strict temporary environment isolation and provider-only cooldowns.

Original-source provenance and contributor credit:
#179144 5a97c90 — Peter Steinberger <[email protected]>
#180280 442c2f7 — Jason (Json) <[email protected]>
#178596 63f386b — Braden Guliano <[email protected]>
#181804 d75915e — Peter Steinberger <[email protected]>
#181140 b4031b2 — Peter Steinberger <[email protected]>
#182207 b8fae65 — Peter Steinberger <[email protected]>
#180792 d2c70dd — Peter Steinberger <[email protected]>
#179205 c08aa6d — Peter Steinberger <[email protected]>
#179997 f178dd9 — mali <[email protected]>
#181270 e204484 — Peter Steinberger <[email protected]>
#179031 855b0aa — Peter Steinberger <[email protected]>
#179726 3d51d00 — Peter Steinberger <[email protected]>
#179249 b617d97 — Josh Avant <[email protected]>
#182385 bb13bcd — Peter Steinberger <[email protected]>
#182615 411bac2 — Peter Steinberger <[email protected]>
#181300 765c2f1 — Peter Steinberger <[email protected]>
#179549 09ba994 — Peter Steinberger <[email protected]>
#179445 ac5587b — Peter Steinberger <[email protected]>
#181127 25dde25 — Josh Lehman <[email protected]>
#173209 ebccf57 — Peter Steinberger <[email protected]>
#175289 e579f09 — Peter Steinberger <[email protected]>

Proof: targeted owner/regression tests; Qwen15 and catalog pool13 pass.
Final integrated lint/type/format pass remains pending under user direction.

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

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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