Skip to content

feat(openclaw-id): add iroh Node binding crate - #191470

Merged
jalehman merged 5 commits into
mainfrom
openclaw-id/pr-iroh-binding
Nov 3, 2026
Merged

jalehman merged 5 commits into
mainfrom
openclaw-id/pr-iroh-binding

Conversation

@jalehman

@jalehman jalehman commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw ID reaches a Gateway over iroh (QUIC, with relay fallback). Node needs an iroh binding with Buffer-based I/O and a verified wire-compatible iroh version. The existing @number0/iroh package copies every read through Array<number>, which limits throughput and grows memory use. This draft adds the binding as a standalone crate so it can be reviewed and tested on its own.

User Impact

No user-visible change. Nothing in OpenClaw loads the binding, and nothing is published: the package is private, the crate is publish = false, and the workflow only uploads build artifacts that are kept for 7 days. A later PR in this stack loads it from the OpenClaw ID tunnel child, behind an OpenClaw ID Labs switch that is off by default. PACKAGING.md proposes how the binding could be distributed later; it is not implemented here.

Why This Change Was Made

  • crates/openclaw-iroh-node is a napi-rs binding for iroh endpoints, connections and bidirectional streams, pinned to iroh = "=1.4.1" to match the relay. It also exposes the home relay status, so callers can tell when a relay refuses the endpoint. It has its own Cargo workspace, so the iroh dependency tree (about 260 crates) stays out of the shared crates/ workspace build.
  • .github/workflows/iroh-node.yml builds and tests the binding on Linux x64 and arm64, macOS arm64 and Windows x64. It runs only when the crate or the workflow changes. It skips draft PRs and has contents: read permissions only. The x64 Linux lane also runs fmt and Clippy, checks that the generated loader and types are current, runs a wire-compatibility check against @number0/iroh through a local iroh-relay, and checks a throughput floor.
  • node-runtime-conformance.yml excludes this crate from its crates/** trigger, and oxfmt and oxlint ignore the generated index.js and index.d.ts.
  • A test-line allocation record covers the binding's *.test.cjs files (453 lines).

Because the workflow skips draft PRs, this PR has no hosted CI run for the binding until it is marked ready. The local results below cover the same steps for linux-x64.

Evidence

Local, linux-x64, Rust 1.99.0, Node 26.12.1, following the workflow's full lane:

  • cargo fmt --check: clean. cargo clippy --locked --release --all-targets -- -D warnings: clean.
  • napi build --platform --release --strip --target x86_64-unknown-linux-gnu, then git diff --exit-code -- index.js index.d.ts: the generated loader and types are current.
  • node --test test/binding.test.cjs: 6/6 passed. The API-surface assertion had not been updated for homeRelayStatus, watchHomeRelay and HomeRelayWatcher; this PR updates it.
  • node --test test/compat.test.cjs with iroh-relay 1.4.1 and @number0/iroh 1.2.0: 7 passed (1 optional case skipped because TUNNEL_TESTSERVER_BIN was not set).
  • IROH_NODE_BENCH=1 IROH_NODE_MIN_MBPS=50 node --test test/throughput.test.cjs: passed.
  • actionlint and zizmor (repo config, offline) on the workflows: clean.
  • pnpm check:test-lines-ratchet --base origin/main: OK.
  • pnpm check:changed --base origin/main: every check passed except lint. Lint fails only on max-lines in six files this PR does not touch; those files already exceed the limit on main. Duplicate-scan coverage failed at first because crates/ was not a scan target. This PR adds the crate as a target and ignores the generated loader. node scripts/check-duplicates.mjs now passes and finds no clones in the crate.
  • Local review: not run for this draft (maintainer decision); request review once marked ready.

@clawsweeper

clawsweeper Bot commented Nov 2, 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 scripts Repository scripts size: XL labels Nov 2, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds an unpublished Rust-to-Node iroh binding with Buffer-based streams, interoperability tests, and dedicated platform CI.

Example: A caller starts recv.read(16) against a silent peer, then calls recv.stop(7).

  • Before: The earlier implementation could leave stop waiting behind the pending read.
  • After: Cancellation interrupts the read, releases its lock, and allows STOP_SENDING to reach the peer.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused binding and cancellation repairs look sound; supplied behavior evidence remains at the transport-harness level.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored classification exempts ordinary proof gating; the body reports Linux native binding, real-relay interoperability, and throughput harness results, while the protected protocol PR’s broader browser evidence does not independently prove this exact binding revision.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Future OpenClaw ID tunnel transfers need wire-compatible Node transport without Array<number> marshalling overhead.
Reason: The supplied maintainer-authored direction authorizes this isolated foundation; publishing and application integration are explicitly deferred.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, maintainer-directed foundation for OpenClaw ID, and both prior cancellation findings are addressed; no new actionable defect was found.

Priority: P2
Reviewed head: a66ec81ce97112cd793794c591e8eb765b394a75

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied results cover native transport harnesses, without a shipped OpenClaw consumer flow or a recorded failing replay of the cancellation regressions on the earlier implementation.
Agent review details

How this fits together

The standalone native addon translates Node endpoint and stream calls into iroh QUIC operations; future OpenClaw ID tunnel code will consume it, but current application code does not load it.

flowchart LR
  A[Node caller] --> B[Generated addon loader]
  B --> C[Rust napi binding]
  C --> D[iroh endpoint and streams]
  D --> E[Direct QUIC peer]
  D --> F[iroh relay]
  F --> E
Loading

Technical review

Best possible solution:

Retain the isolated native binding as this stack’s transport foundation and complete its existing platform validation when the draft is ready.

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

This is a new standalone capability; source inspection confirms the cancellation repairs, but no target code was executed during this read-only review.

Is this the best way to solve the issue?

A narrow napi binding removes per-byte JavaScript array conversion while leaving transport decisions with iroh and keeping its dependency tree outside the shared Rust workspace.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5a9b04b2f072.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 1bad54b adds .github/workflows/node-runtime-conformance.yml:153 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 1bad54b1f888; files: .github/workflows/node-runtime-conformance.yml)

PR surface

Tests +1161, Docs +95, Config +185, Other +5411. Total +6852 across 28 files. Added test files: 9.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 9 1161 0 +1161
Docs 2 95 0 +95
Config 3 185 0 +185
Generated 0 0 0 0
Other 14 5411 0 +5411
Total 28 6852 0 +6852

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a useful transport foundation with limited immediate impact because no application code loads or distributes it.
  • 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.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-02T21:42:02.226Z sha 5ea753b :: needs changes before merge. :: [P2] Allow stop and reset to interrupt pending stream I/O
  • reviewed 2026-11-03T14:13:27.286Z sha 4d670f5 :: needs changes before merge. :: [P2] Avoid requiring immediate peer rejection after local stop

Reviewed November 3, 2026, 9:23 AM ET / 14:23 UTC (Revision 3).

@jalehman

jalehman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 3, 2026
@jalehman

jalehman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 3, 2026
@jalehman
jalehman marked this pull request as ready for review November 3, 2026 18:18
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph.

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

  • Current SHA: 7de959358b6a6bb57e1625f94b12f71a3549837f
  • Maintainer: @jalehman
  • Repository role: admin

These dependency graph changes were made:

  • crates/openclaw-iroh-node/package.json

Carefully review these changes before merging.

@jalehman
jalehman merged commit 104530d into main Nov 3, 2026
110 checks passed
@jalehman
jalehman deleted the openclaw-id/pr-iroh-binding branch November 3, 2026 19:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
* feat(openclaw-id): add iroh Node binding crate

* chore(ci): include the iroh binding in duplicate scans

* fix(iroh-node): let stop and reset interrupt pending stream I/O

* test(iroh-node): wait for the peer to observe STOP_SENDING

* test(iroh-node): exclude the binding's node:test suites from the vitest ownership audit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies-changed PR changes dependency-related files P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL 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