Repository navigation
feat(openclaw-id): add iroh Node binding crate - #191470
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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).
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe 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
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +1161, Docs +95, Config +185, Other +5411. Total +6852 across 28 files. Added test files: 9. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed November 3, 2026, 9:23 AM ET / 14:23 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
…st ownership audit
* 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
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/irohpackage copies every read throughArray<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 ispublish = 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.mdproposes how the binding could be distributed later; it is not implemented here.Why This Change Was Made
crates/openclaw-iroh-nodeis a napi-rs binding for iroh endpoints, connections and bidirectional streams, pinned toiroh = "=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 sharedcrates/workspace build..github/workflows/iroh-node.ymlbuilds 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 hascontents: readpermissions 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/irohthrough a localiroh-relay, and checks a throughput floor.node-runtime-conformance.ymlexcludes this crate from itscrates/**trigger, and oxfmt and oxlint ignore the generatedindex.jsandindex.d.ts.*.test.cjsfiles (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, thengit 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 forhomeRelayStatus,watchHomeRelayandHomeRelayWatcher; this PR updates it.node --test test/compat.test.cjswithiroh-relay1.4.1 and@number0/iroh1.2.0: 7 passed (1 optional case skipped becauseTUNNEL_TESTSERVER_BINwas not set).IROH_NODE_BENCH=1 IROH_NODE_MIN_MBPS=50 node --test test/throughput.test.cjs: passed.actionlintandzizmor(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 onmax-linesin six files this PR does not touch; those files already exceed the limit onmain. Duplicate-scan coverage failed at first becausecrates/was not a scan target. This PR adds the crate as a target and ignores the generated loader.node scripts/check-duplicates.mjsnow passes and finds no clones in the crate.