Skip to content

feat(android): enroll OpenClaw ID nodes with opt-in native transport - #194194

Draft
jalehman wants to merge 7 commits into
mainfrom
openclaw-517/node-android
Draft

jalehman wants to merge 7 commits into
mainfrom
openclaw-517/node-android

Conversation

@jalehman

@jalehman jalehman commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Storage contract approved (Josh)

Josh approved the proposed Android durable storage contract on November 8, 2026, at 16:28 PST ("Approve: 1", relayed by the coordinator): one encrypted SecurePrefs record keyed node.openclaw-id.$stableId, where stableId is openclaw-id|${clawId}|${rootFingerprint.substringAfter(':')}. Approved fields are claw, root, host, discovery, relay, admitted, seed (W), and trust containing binding, seq, issued, and snapshotBinding.

The approved behavior advances durable high-water state for a newer signed removal snapshot and never exposes a dial target after storage failure. Node keys are separate from device-auth keys across platforms. The existing OpenClawIdNodeStore.kt / NodeRuntime.kt implementation matches this storage shape; no source change is needed.

Keep this PR draft: storage approval does not waive device/emulator proof, a real enrollment-to-Gateway connection, UI screenshots, or the license-notice distribution gate; these remain open.

Related: #194174 (native crate base). Coordinated work: openclaw-517; Android lane openclaw-517.9.

What Problem This Solves

Android needs an explicit, owner-approved way to enroll as an OpenClaw ID node and reach its Gateway through the native tunnel without acquiring operator or chat credentials.

User Impact

Opt-in builds provide an experimental paste-or-scan node invitation flow with a separate Discovery HTTPS origin, a six-digit verification code, and owner approval of the declared capabilities. This is node-only access, not an operator/chat login.

Native packaging is opt-in with -PopenclawIrohNative=true. Existing default build lanes remain unchanged: they do not require Rust/NDK or package this native transport. Generated Kotlin still compiles unconditionally; attempting an OpenClaw ID node connection without native packaging fails closed with a clear “native transport not packaged” error. Ordinary Gateway connections retain their existing path.

Why This Change Was Made

The Android adapter uses the OpenClaw-owned UniFFI crate from native commit 92c25067451b1a105b1e83615da641e352c51e7c, with matching checked-in Kotlin bindings. Enrollment verifies pinned signed trust evidence before dialing the verified server key over openclaw/tunnel/1; no TCP proxy, default relay, hostname dial, or direct WebSocket fallback is added.

Native suspend calls drain under NonCancellable, explicit cancellation signals terminate the underlying work, and returned resources are disposed if cancellation wins the handoff. Cancelling admission may retire this node's single connection; reconnect recreates it. Endpoint initialization is lazy and seed buffers are erased.

The dedicated path-filtered android-iroh-native.yml owns its NDK/Rust provisioning and verifies a pinned rustup-init checksum before execution. Shared Android actions, CodeQL, and the native owner's iroh-ffi.yml are unchanged relative to the base.

Scope/simplification: this is the Android consumer stage stacked on the separately owned native crate, not a second transport owner. The earlier shared CI provisioning and obsolete guard allocation were removed in favor of one opt-in packaging lane. Necessary growth is enrollment/trust verification, framing, the transport adapter, explicit UI intent, and distinct replay/cancellation/EOF regressions; the checked-in protocol fixture accounts for 1,127 lines. Against the native base: 39 files, 4,737 insertions and 19 deletions. No native crate changes are included in this consumer diff.

Enrollment handoff repair

9894edf0d4a3dfabe52923f2e4123dd9bd64ce26 saves approved enrollment without activating the target, then uses the existing quick-switch owner to recheck composer and microphone work at the handoff. Cancelled or retired enrollment cannot resume a stopped service. A busy user keeps the current Gateway and can select the saved node later.

Seven production-controller regression cases cover import, send and audio beginning during approval, idle handoff, cancellation, ViewModel retirement, and service Stop. HTTP I/O and the native endpoint are fixtures; Discovery decoding, signed trust, durable enrollment and UI/runtime admission are production paths. Independent Astra source review found no verified P0–P2 findings. The one changed UI string has its regenerated native i18n inventory; native:i18n:verify and git diff --check passed.

Compilation, unit tests and debug native packaging passed on exact head 9894edf0d4a3dfabe52923f2e4123dd9bd64ce26 in both the push run and PR run. Terminal PR-run logs confirm testPlayDebugUnitTest and testThirdPartyDebugUnitTest executed successfully; the workflow verifies the default APK excludes iroh and both opt-in debug variants contain all four native ABIs. No local Gradle execution or screenshot/device proof is claimed. Keep this PR draft; device/runtime, upgrade and distribution qualification remain open. Rebind/J5 is a separate stacked follow-up in #196442.

Evidence

Passed:

  • 24 focused JVM tests, compiling the production OpenClaw ID sources with the generated Kotlin bindings, covering enrollment, tunnel framing, WebSocket behavior, durable replay protection after refusal, and native cancellation/cleanup.
  • Real host JVM → generated Kotlin/JNA → Rust loopback at native commit 92c25067451b1a105b1e83615da641e352c51e7c: framed HEAD status 101, FIN, maximum 62-bit numeric application-close code, explicit connect cancellation token, and a typed pre-cancelled dial. Built from the exact archived source with locked Rust 1.99.0 inputs; Linux x86_64 only, not Android JNI proof. Native library SHA-256: 5075327bfbed3e3cf89ab261b24648917d2781c03b37cc09b28bdb7bb1d66a0b (13,185,944 bytes).
  • Kotlin formatting, native i18n inventory checks/regeneration, actionlint 1.7.12, and git diff --check.
  • Default protocol checks, without a protocol-base override.
  • Independent cancellation follow-up resolved both prior P1 findings; the opt-in correction review found no new verified P0–P2 issues. Coordinator also inspected the opt-in rework.

Packaging passed at head b3959bc24da3d965326483351b68cdae9ba213b3: PR run and push run, verifying the default APK excludes iroh and the opt-in Android variants build and pass their tests; this is build/packaging evidence, not device-runtime proof.

The unmodified generated binding builds in :openclaw-iroh with compiler warnings allowed, while the app retains its unchanged allWarningsAsErrors(true) gate; no native-generator-owner action is required.

Unverified / required before completion:

  • Device loading for all four ABIs; release builds/shrinking/R8, release APK size and ZIP alignment. The debug Gradle packaging/test tasks above passed; they do not qualify these release/runtime checks.
  • Device/emulator execution, including a 16 KiB-page device; real enrollment-to-Gateway connection.
  • Before/after screenshots of the new UI (not yet captured).
  • Android Keystore behavior and foreground-service/lifecycle behavior.
  • Distribution license-notice gate: the openclaw-517 P2 task remains open. The inventory covers 285 crates; 20 archives lack notices. Complete transitive notices and MPL source-availability obligations for UniFFI and attohttpc are not complete. The current iroh/Tailscale notice is partial, not clearance to distribute.

No host SDK/NDK installation or app distribution was performed. Storage approval is recorded above; this draft does not waive remaining device/runtime proof, screenshots, or the distribution gate.

@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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 real behavior proof before merge.

What this changes

This PR adds Android OpenClaw ID node enrollment and an opt-in native tunnel transport.

Example: An Android user scans a node invitation and enters https://discovery.example.test.

  • Before: Android cannot enroll and connect through the OpenClaw ID native transport.
  • After: The app requests owner approval with a six-digit verification code and connects a node-only session when native transport is packaged.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The draft has useful transport and trust coverage, but a concrete handoff regression and incomplete authority qualification prevent readiness.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Android users cannot enroll as OpenClaw ID nodes and reach their Gateway through the native tunnel without operator credentials.
Reason: The maintainer-authored direction establishes feature value, while the PR expressly reserves approval of its durable storage contract.

Merge readiness

⛔ Blocked before merge - 9 items remain

Keep this maintainer-authored draft open; the enrollment handoff bypasses existing gateway-switch safeguards, and the explicitly deferred storage decision remains unresolved.

Priority: P2
Reviewed head: b3959bc24da3d965326483351b68cdae9ba213b3
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Does Josh Avant approve the new encrypted node identity, target-pin, and trust high-water persistence contract and its preference keys?
  • Recommendation: Approve the proposed contract: Approve the documented fields and keys after reviewing their ownership and cleanup lifecycle.
  • Why: The PR explicitly requests this decision and prohibits marking the draft ready before it is approved.

Before merge

  • Add real behavior proof - Authority-chain proof required: exercise Android enrollment through the shipped app into a real Gateway, demonstrate permitted node behavior and denied operator behavior, then remove the node and show rejection before further effects on retained or reconnecting sessions; the supplied host JVM/native loopback covers transport primitives only, and the captured body explicitly leaves Android execution and UI captures outstanding. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Apply gateway-switch safeguards when enrollment is admitted (P1) - An existing user can open Add Gateway while recording, importing media, or sending a message, then confirm a node invitation. When the owner approves it, this callback calls raw runtime connect() without canBeginQuickGatewayConnection or beginQuickGatewayConnectionOperation. The resulting gateway replacement reaches prepareDisconnect(), which retires chat scope and stops voice activity even though ordinary Add Gateway switching would reject the operation. Route this final handoff through the existing quick-switch admission owner and recheck its guards when approval arrives.
  • Resolve security concern: Qualify the persisted node credential at Gateway effects - The supplied Linux loopback and JVM tests do not demonstrate that an admitted Android node is denied operator access or that removal prevents subsequent effects over an existing connection; this is an unresolved authority qualification, not a demonstrated bypass.
  • Resolve merge risk - The PR author must establish that persisted node identity cannot obtain operator access and that removal invalidates retained connections before subsequent Gateway effects.
  • Resolve merge risk - The PR author must complete the acknowledged transitive license notices and MPL source-availability obligations before this transport is distributable.
  • Await maintainer action - Josh Avant must approve or revise the documented durable node storage contract before this draft is marked ready.
  • Improve patch quality - Prove that a node cannot obtain operator access and that removal invalidates retained authority before further Gateway I/O.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of Gateway switching admission - 8f589ba: The saved-gateway switching feature preserves recording, imports, and active sends through existing admission guards.

Findings

  • [P1] Apply gateway-switch safeguards when enrollment is admitted — apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt:937-939
  • [medium] Qualify the persisted node credential at Gateway effects — apps/android/app/src/main/java/ai/openclaw/app/gateway/OpenClawIdNodeController.kt:127

Provenance

  • Gateway switching admission changes intended behavior without addressing why it exists (8f589ba: The saved-gateway switching feature preserves recording, imports, and active sends through existing admission guards.)

Tests

  • Missing end-to-end proof: Provide Android enrollment-to-Gateway and revocation evidence, inspected before/after UI captures, and a latest-stable upgrade preserving existing settings and identity data.
Agent review details

How this fits together

Android onboarding passes invitations to a runtime enrollment controller, which persists identity and verified trust through SecurePrefs and supplies a native tunnel-backed WebSocket to the existing GatewaySession.

flowchart LR
  A[Android setup UI] --> B[Enrollment controller]
  B --> C[Discovery HTTPS]
  B --> D[SecurePrefs identity and trust]
  D --> E[Native tunnel adapter]
  E --> F[GatewaySession node connection]
  F --> G[Gateway]
Loading

Technical review

Best possible solution:

Keep enrollment and transport in their existing owners, route the admitted target through guarded gateway-switch admission, and retain the draft until its explicit approval and qualification gates are satisfied.

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

Source tracing establishes the handoff bypass: an admitted invitation calls raw connect(), whereas ordinary Add Gateway admission checks pending composer work and active audio; no target code was executed.

Is this the best way to solve the issue?

The native adapter and node-only session reuse are coherent, but the smallest complete implementation must reuse the existing guarded switching owner when enrollment finishes.

Full review comments:

  • [P1] Apply gateway-switch safeguards when enrollment is admitted — apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt:937-939
    An existing user can open Add Gateway while recording, importing media, or sending a message, then confirm a node invitation. When the owner approves it, this callback calls raw runtime connect() without canBeginQuickGatewayConnection or beginQuickGatewayConnectionOperation. The resulting gateway replacement reaches prepareDisconnect(), which retires chat scope and stops voice activity even though ordinary Add Gateway switching would reject the operation. Route this final handoff through the existing quick-switch admission owner and recheck its guards when approval arrives.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 21cd90050fb6.

Merge-risk options

Maintainer options:

  1. Complete authority and distribution qualification (recommended)
    The PR author should demonstrate allowed and forbidden node behavior at Gateway effects and complete the dependency notice obligations before readiness.
  2. Retain the draft
    Keep native transport work staged while the storage decision and distribution gate remain unresolved.

Provenance checked

  • Remote endpoint and credential isolation keeps the original intent (acd5734: Remote mobile connections fail closed on insecure endpoints and retain distinct authentication boundaries.)
  • Android runtime and session ownership keeps the original intent (6031d67: Process connection ownership and retired-request handling belong to the existing runtime lifecycle.)
  • Generated Kotlin warning handling changes intended behavior with a stated reason (0ef6702: The app uses strict compiler gates; this PR explains isolating UniFFI-generated sources in a separate library while retaining the app gate.)

Testing

Proof path: in-process harness.

Security

Needs attention: Node-only credential separation is visible in source, but final-effect role and revocation enforcement remains unproven.

Evidence

Security concerns:

  • [medium] Qualify the persisted node credential at Gateway effects — apps/android/app/src/main/java/ai/openclaw/app/gateway/OpenClawIdNodeController.kt:127
    The supplied Linux loopback and JVM tests do not demonstrate that an admitted Android node is denied operator access or that removal prevents subsequent effects over an existing connection; this is an unresolved authority qualification, not a demonstrated bypass.
    Confidence: 0.96

What I checked:

Likely related people:

  • Josh Avant: Raw commit d5b9c6b adds apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5b9c6bf3a9d; files: apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt)
  • RoboClaw: Raw commit 8f589ba adds apps/android/app/src/main/java/ai/openclaw/app/MainViewModel.kt:1346 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8f589bac90d4; files: apps/android/app/src/main/java/ai/openclaw/app/MainViewModel.kt)

PR surface

Source +2454, Tests +2136, Docs +65, Config +103. Total +4758 across 42 files. Added test files: 6.

View PR surface stats
Area Files Added Removed Net
Source 31 2473 19 +2454
Tests 9 2136 0 +2136
Docs 1 65 0 +65
Config 1 103 0 +103
Generated 0 0 0 0
Other 0 0 0 0
Total 42 4777 19 +4758

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
New build option 1 Gradle property openclawIrohNative defaults to false and controls JNI packaging.

Labels

Label changes:

  • add P2: This experimental feature has limited current exposure but contains a concrete gateway-handoff regression.
  • add merge-risk: 🚨 session-state: Owner approval can replace the active gateway without the existing recording, import, and send safeguards.
  • add merge-risk: 🚨 security-boundary: A durable node credential introduces a new admission path whose role ceiling and revocation behavior need final-effect evidence.
  • add merge-risk: 🚨 other: The native transport's acknowledged license-notice and source-availability obligations remain incomplete.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: This experimental feature has limited current exposure but contains a concrete gateway-handoff regression.
  • merge-risk: 🚨 session-state: Owner approval can replace the active gateway without the existing recording, import, and send safeguards.
  • merge-risk: 🚨 security-boundary: A durable node credential introduces a new admission path whose role ceiling and revocation behavior need final-effect evidence.
  • merge-risk: 🚨 other: The native transport's acknowledged license-notice and source-availability obligations remain incomplete.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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 November 6, 2026, 11:07 AM ET / 16:07 UTC.

@jalehman
jalehman force-pushed the openclaw-517/node-ffi branch from 031aad5 to 69e19a5 Compare November 7, 2026 19:52
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from b3959bc to 22ea74b Compare November 7, 2026 19:52
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling plugin: openclaw-id-access labels Nov 7, 2026
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from 22ea74b to ec707e2 Compare November 7, 2026 19:55
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling labels Nov 7, 2026
@jalehman
jalehman force-pushed the openclaw-517/node-ffi branch from 69e19a5 to 7f9243b Compare November 7, 2026 20:24
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from ec707e2 to f05b1ad Compare November 7, 2026 20:24
@jalehman
jalehman force-pushed the openclaw-517/node-ffi branch from 7f9243b to b6765ac Compare November 7, 2026 20:46
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from f05b1ad to 15a773f Compare November 7, 2026 20:46
@jalehman
jalehman force-pushed the openclaw-517/node-ffi branch from b6765ac to 76878bb Compare November 8, 2026 17:23
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from 15a773f to 62742ee Compare November 8, 2026 17:23
@jalehman
jalehman force-pushed the openclaw-517/node-ffi branch from 76878bb to f1adbdd Compare November 9, 2026 13:12
@jalehman
jalehman force-pushed the openclaw-517/node-android branch from 62742ee to d5f9459 Compare November 9, 2026 13:14
Base automatically changed from openclaw-517/node-ffi to main November 9, 2026 15:07
Integrate the shared UniFFI binding, retain native results across cancellation, and provision JNI build prerequisites through shared Android CI setup.

Refs: openclaw-517.9. Android build/device proof and complete distribution license notices remain outstanding.
Exercise the existing durable trust owner with a signed node-removal snapshot, failed persistence, and older membership replay after reopening the store. Production already persists advanced state on refusal; no storage contract changes.
Keep shared Android CI and native-owner workflows unchanged. Gate Rust packaging behind openclawIrohNative and fail closed without a native factory. Add one filtered opt-in packaging proof workflow with a pinned checksummed rustup installer.

Current-pin Kotlin/JNA/Rust loopback and 24 JVM regressions pass. Android SDK/device proof remains unverified; upstream generated Kotlin currently fails the unchanged warnings-as-errors gate.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant