Skip to content

feat(node): enroll with owner-approved OpenClaw ID invitations - #193993

Merged
jalehman merged 5 commits into
mainfrom
openclaw-517/node-join
Nov 9, 2026
Merged

jalehman merged 5 commits into
mainfrom
openclaw-517/node-join

Conversation

@jalehman

@jalehman jalehman commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #193982 (node transport, merged), #194001 (Gateway node admission, merged), #194007 (Access node invites, merged), #195507 (one automatic node pairing per approved listing, merged; found by this PR's live proof)

What Problem This Solves

Headless nodes need an owner-approved way to join an OpenClaw ID claw without a user account or a Gateway token.

User Impact

Adds openclaw node join <openclaw-node-link> and sends the same link through openclaw connect. The node shows a six-digit code and its signed command list. The owner compares the code and approves on the Access page. After approval, the node checks that it was admitted, then connects in the foreground, or installs a user service with --service.

  • Discovery origin. Set it with --discovery-url or reuse the one saved with the node's target; there is no production default. The origin is never derived from the claw hostname or relay URL.
  • Re-joining. node join now refuses a node that is still admitted, and leaves the new invitation unused. To change a node's commands, the owner removes it on the Access page and sends a new link. Plain reconnects use openclaw node run or the installed service.
  • Supervision. A foreground node join now runs under the packaged node supervisor, the same as connect. Supervisor restarts use node run, never the one-time link.
  • Labs preview limits. Unix hosts and native-process workers only. Node is the qualified runtime; Bun streaming qualification is still pending.

Why This Change Was Made

The node signs the command manifest it actually prepared, with its own local key, and Discovery only ever sees the redemption proof. Before the runner saves the target, the node checks the root, claw and hostname pins, the highest same-claw binding sequence it has seen, signed snapshot freshness, and its own listing. The first connection reuses that prepared runtime. The service is installed only after a successful first hello and a clean shutdown.

ClawSweeper's re-enrollment finding (P2). A membership snapshot lists node keys only; it says nothing about which invitation or description the owner approved. A node that is already admitted would therefore look approved before the owner had decided on the new invitation. The node now checks Discovery before mailing the redemption, and refuses if it is already listed. It doesn't wait on the new invitation, and it doesn't spend it.

Accepted edge (named in code). Suppose an earlier invitation for the same node key is still pending and the owner approves it later. That approval can also complete a newer join that is waiting. Binding completion to one specific invitation needs a signed per-invitation outcome, which doesn't exist yet and is tracked as openclaw-607; this PR adds no protocol statement. The Gateway pairs only the commands from the description the owner approved (approveOpenClawIdNodePairing), so this edge can't widen what the node may run. A Discovery that lies about pending state can, at most, cause the same mismatch; it can't grant access.

Authority at admission and execution. Gateway #194001 owns this. Admission resolves the tunnel peer against the Gateway's current authority, not Discovery's snapshot. resolveGatewayConnectPolicyFailure and request dispatch then re-check isOpenClawIdTunnelPrincipalCurrent before any work runs. A new real-Gateway test covers both cases. A node key the Gateway doesn't list (pending, or removed after the node fetched its descriptor) is refused before pairing. A live node session is closed with code 4001 on its next request once its listing is removed. Existing coverage includes authority.nodes.test.ts, where pending nodes don't resolve and removal closes connections, and the pairing suite's stale-principal case.

Stored data. This PR adds no new store, field or migration. Node config stays in SQLite nodeHost.config v1, as in 2026.11.2. The openclaw-id target shape already shipped in #193982. Existing Gateway-mode targets keep loading unchanged; only an explicit node join replaces the saved target. See Evidence for the upgrade check.

Test lines. The allocation is 542, exactly this PR's net test-line delta. Against current main the ratchet reports 32 lines of slack; that headroom was already on main and isn't allocated by this PR.

Evidence

  • Re-enrollment regression. refuses re-enrollment while old membership still lists W, before spending the invite is red against the previous enrollment source and green with the fix.
  • Focused suites. 172 passed, 7 native-binding tests skipped, across enrollment, join, runner, connect/register CLI, node daemon, the Gateway node-pairing suite and the native node-host suite. The node launcher suite passed 15/15, including the new ["node","join"] supervised-restart case.
  • Static checks. pnpm tsgo:core, scoped oxlint and oxfmt, and pnpm deadcode:exports all passed with 0 entries. loadNodeTunnelKey is exported again because openclaw-id-join.ts uses it; fix(ci): remove unused OpenClaw ID node exports #195338 had made it private. The mock-isolation ratchet passes; each orchestration mock in the join suite states why it is isolated.
  • Independent Astra review. It found two P2s. The supervisor bypass is fixed. The pending-earlier-invitation edge is accepted as described above, pending openclaw-607. Neither finding bypasses Gateway enforcement.
  • Stored-data upgrade (isolated profiles, env cleared of live-Gateway variables). 2026.10.10 configured a node host in plain Gateway mode against an isolated 2026.11.2 Gateway: it saved SQLite nodeHost.config v1 and paired. The PR head's node run with no flags then loaded that config and connected with the existing pairing (0 pending requests). The config bytes were unchanged (same hash). A failed node join (Discovery unreachable) left the config unchanged apart from creating the node's 0600 endpoint key, and node run connected again afterwards. Note: main is versioned 2026.11.1, so a 2026.11.2 → PR head run is a version downgrade and stops at the newer-config check; that is why the upgrade was seeded from 2026.10.10.
  • Exact-head CI on 7cf477a8e9e5: 73 passed, 52 skipped, 0 failed. Current head eac8b7f06c2f: CI is running.
  • Follow-up eac8b7f (ClawSweeper P3, after the live run): failed descriptor or membership verification now names a recovery step. A stale membership snapshot asks the operator to have the claw owner check that the Gateway is online and connected to OpenClaw ID, then join with a new link; an invalid descriptor asks them to check --discovery-url with the owner. Only error strings and the stale-snapshot test assertion changed; enrollment logic didn't. The live proof below ran on 7cf477a, and the enrollment, join and connect suites pass 46/46 at eac8b7f.
  • Rebase onto main (with fix(openclaw-id): allow one automatic node pairing per approved listing #195507): git range-diff ac26a0d7f1f8..70d8109b8a56 origin/main..7cf477a8e9e5 shows all 4 commits unchanged (=).

Live proof on the staging testnet (build 7cf477a, this PR's head)

Setup:

  • Gateway: an isolated Gateway on a Mac Studio, built from 7cf477a8e9e5 with its own profile, port and state, and linked as the throwaway staging claw ocid517proof2-e61zr.crabd.xyz. The Studio's own Gateway wasn't touched.
  • Owner: used real Chromium against the real staging OpenClaw ID, Discovery, loader and relay. They signed in, enrolled with the recovery kit, and opened Access over the tunnel. This Gateway has no model configured, so the default landing goes to model setup; the harness opens the app with ?session=main. Node admission doesn't depend on this.
  • Nodes: ran this PR's shipped CLI on a Linux host, each in an isolated profile, with environment variables from the host's own Gateway cleared.

All 9 checks passed in one run:

# Check Result
1 Owner signs in and opens Access, then Nodes, over the tunnel pass
2 Denied invite Codes matched (794-600) and the owner selected Deny node. The invite reads denied and no node is listed. The waiting node never connected and, when cancelled, reported "no target was saved".
3 Approved invite Codes matched (865-003) and the owner approved. The Gateway logged admission allowed … path=relay and then repeated admissions with path=direct. The node reported connected … via OpenClaw ID (direct), and its device was auto-paired as openclaw-id-node.
4 A node command runs node.invoke system.which over the tunnel returned {"bins":{"sh":"/usr/bin/sh"}}
5 Re-enrolling the admitted node with a fresh invite and more commands Refused (exit 1) with "This node is already admitted … ask the owner to remove it on the Access page, then join with a new link". The fresh invite stays open, unused.
6 A pending node (code shown, not approved), given the admitted node's saved target Never connected. For 90 seconds it got only socket hang up / 1006. The Gateway logged no admission for its key: it was refused at relay/tunnel admission, before any Gateway stream.
7 Owner removes a live node after it has retrieved its descriptor The live session ended: the node exited 1 with "OpenClaw ID node access was removed or is not admitted; re-join this node". Restarting node run from the saved target never connected (socket hang up), and the Gateway logged no admission for that key between removal and the new approval.
8 Re-joining after removal with a new invite and more commands (system.which,system.run) The node waited and connected only after the owner compared the code (061-592) and approved. The Gateway then auto-paired the same device (approvedVia: openclaw-id-node, 0 pending Devices approvals). node.list shows system.run and system.which. system.which worked, and system.run echo returned exit 0 with stdout: "ocid517-ok".
9 --service Approved (code 379-356). The join installed the isolated user unit openclaw-node-ocid517svc.service, which became active. After systemctl --user restart, the journal shows a new node host gateway connected … (direct) and node.list shows the node connected again.

Path: every node was admitted over the relay first and then moved to a direct path, according to both the node diagnostics and the Gateway's tunnel log.

Before #195507: an earlier run on build 70d8109, against a claw since retired, passed steps 1–7. Step 8 then failed: after removal and a new approval, the Gateway answered device pairing required and left a non-repair pending node request. #195507 fixed that in the Gateway; step 8 above is the after.

Cleanup:

  • The service unit is uninstalled, and the user unit list matches the list recorded before the run.
  • The local node profiles and secrets are removed.
  • The claw is retired in Discovery staging; queries show 0 claw, member and relay-key rows.
  • The isolated Gateway is stopped. Its profile was backed up, then removed.
  • The staging lock was taken for the run and released afterwards.

Remaining limits:

  • The proof used Linux nodes with Node as the runtime. macOS, Windows and Bun weren't exercised (see the Labs preview limits above).
  • Steps 6 and 7 show refusal at relay/tunnel admission. The Gateway's own refusal of unlisted and removed keys is covered by the real-Gateway test in this PR.

@clawsweeper

clawsweeper Bot commented Nov 6, 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 cli CLI command changes size: L labels Nov 6, 2026
@jalehman
jalehman force-pushed the openclaw-517/node-host branch from d27d1a0 to bc9b6b9 Compare November 6, 2026 06:24
@jalehman
jalehman force-pushed the openclaw-517/node-join branch 2 times, most recently from 4f09040 to 40096b0 Compare November 6, 2026 06:33
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds owner-approved OpenClaw ID node enrollment through node join and connect, with foreground execution or service installation.

Example: A Linux build node joins with only system.which enabled.

  • Before: The existing tunnel transport can resume a saved target but cannot redeem an owner’s node invitation.
  • After: The node displays code 865-003, waits for owner approval, connects, and system.which returns /usr/bin/sh.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A useful, focused feature with supplied end-to-end authority evidence, resolved prior findings, and no identified correctness blocker; current-head CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied staging logs and CLI results on 7cf477a exercise Linux/Node invitation denial, approval, unauthorized-key refusal, live revocation, command execution, re-enrollment, and service restart; the real-Gateway regression covers rejection before pairing and dispatch after removal, and the final commit changes recovery text only.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A headless node needs to join an OpenClaw ID claw without an account or shared Gateway token.
Reason: The maintainer-authored direction completes the existing stack’s missing enrollment stage, with explicit Labs limits and accepted invitation-outcome semantics.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR completes a useful, owner-approved enrollment path missing from main; prior findings are addressed, and no new actionable defect was found.

Priority: P2
Reviewed head: eac8b7f06c2f929a29e483ad960f50b807ac5fa8

Before merge

None.

Findings

None.

Agent review details

How this fits together

The CLI prepares the node’s command manifest, redeems an invitation through Discovery, verifies signed membership, and passes the target to the existing node runner; Gateway authority controls pairing and execution.

flowchart LR
  A[Node CLI] --> B[Prepared command manifest]
  B --> C[Signed enrollment]
  C --> D[Discovery mailbox]
  D --> E[Owner approval]
  E --> F[Verified node target]
  F --> G[Existing node runner]
  G --> H[Gateway live authority]
Loading

Technical review

Best possible solution:

Land the shared enrollment flow with existing Gateway authority and persistence owners once current-head CI passes.

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

This is a new capability; source inspection confirms main has tunnel transport and Gateway admission but lacks the invitation-enrollment CLI path.

Is this the best way to solve the issue?

The implementation is a coherent enrollment stage that reuses protocol verification, node runtime preparation, Gateway authorization, SQLite configuration, supervision, and service installation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 99b8d7070664.

Provenance checked

  • Discovery-origin validation keeps the original intent (21c0288: Keep deployment-selected Discovery routing independent from claw identity and relay routing.)
  • Node tunnel key export changes intended behavior with a stated reason (564264c: Remove an unused internal export; enrollment now supplies a concrete production consumer of the same key owner.)
  • First-hello service installation keeps the original intent (ade3456: Connect and establish durable pairing before installing the node service.)
  • Foreground node supervision keeps the original intent (3c4c111: Preserve node identity and launch options across managed runtime updates.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 21c0288 adds src/node-host/openclaw-id-target.ts:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 21c02885fb1a; files: src/node-host/openclaw-id-target.ts)
  • Peter Steinberger: Raw commit ade3456 adds src/node-host/runner.ts:514 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ade3456dd48f; files: src/node-host/runner.ts)

PR surface

Source +438, Tests +542, Docs +80, Other +5. Total +1065 across 19 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 7 471 33 +438
Tests 8 566 24 +542
Docs 2 91 11 +80
Config 0 0 0 0
Generated 0 0 0 0
Other 2 7 2 +5
Total 19 1135 70 +1065

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Discovery routing option 1 new flag across 2 CLI entry points Both node join and connect expose --discovery-url through one enrollment owner, without adding a production default or persisted field.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Useful, bounded Labs enrollment capability with demonstrated Linux/Node behavior and no established urgent regression.
  • 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.
  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-06T06:48:38.056Z sha 40096b0 :: needs real behavior proof before merge. :: [P2] Require approval of the current invitation when re-enrolling
  • reviewed 2026-11-09T02:30:12.921Z sha 7cf477a :: needs changes before merge. :: [P3] Add a recovery action when membership verification fails

Reviewed November 8, 2026, 9:43 PM ET / November 9, 2026, 02:43 UTC (Revision 3).

@jalehman
jalehman force-pushed the openclaw-517/node-host branch from d01a6fb to 3dae3d4 Compare November 6, 2026 14:10
@jalehman
jalehman force-pushed the openclaw-517/node-join branch from 40096b0 to b7abc8d Compare November 6, 2026 14:11
@jalehman
jalehman force-pushed the openclaw-517/node-host branch from 3dae3d4 to f99ba0c Compare November 7, 2026 19:51
@jalehman
jalehman force-pushed the openclaw-517/node-join branch from b7abc8d to 1b404a8 Compare November 7, 2026 19:51
@jalehman
jalehman force-pushed the openclaw-517/node-join branch 2 times, most recently from a032fd8 to 52fc558 Compare November 7, 2026 20:46
@jalehman
jalehman force-pushed the openclaw-517/node-host branch from 5771dc0 to be89be8 Compare November 8, 2026 16:59
Base automatically changed from openclaw-517/node-host to main November 8, 2026 17:18
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL and removed size: L labels Nov 8, 2026
@jalehman
jalehman force-pushed the openclaw-517/node-join branch from 52fc558 to 4c1be1f Compare November 8, 2026 17:23
@jalehman
jalehman force-pushed the openclaw-517/node-join branch from 70d8109 to 7cf477a Compare November 9, 2026 02:08
@jalehman

jalehman commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 9, 2026
@jalehman

jalehman commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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 9, 2026
@jalehman
jalehman merged commit d88a384 into main Nov 9, 2026
141 of 146 checks passed
@jalehman
jalehman deleted the openclaw-517/node-join branch November 9, 2026 13:08
@jalehman

jalehman commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

@jalehman

jalehman commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Landed despite one inherited CI failure

The test-line ratchet was the only failure in CI run 42551795330 (checks-fast-baseline-ratchets plus the aggregate openclaw/ci-gate). It failed on main's lines, not this PR's:

Every other check passed, including security-fast. This was landed through the native pre-existing-failure route, with that evidence retained.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…law#193993)

* feat(node): enroll with owner-approved OpenClaw ID invitations

Refs openclaw-517.5

* fix(node): refuse re-enrollment while the node is still admitted

Restore the loadNodeTunnelKey export the join flow uses, and cover Gateway
refusal of unlisted and removed node principals.

* fix(node): supervise foreground node join like connect

* test(node): explain join orchestration mock isolation

* fix(node): name recovery steps when enrollment verification fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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