Skip to content

feat(macos): OpenClaw ID primary connection + dashboard proxy - #197585

Merged
jalehman merged 6 commits into
mainfrom
feat/ocid-mac-ocid-connection
Nov 13, 2026
Merged

jalehman merged 6 commits into
mainfrom
feat/ocid-mac-ocid-connection

Conversation

@jalehman

@jalehman jalehman commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Lets the macOS app use OpenClaw ID as its primary connection to a claw, with the dashboard served through an app-owned loopback proxy. This is the base for the sign-in-first Mac enrollment PRs. It extracts the reusable parts of draft #197421 and keys them to a generic in-process OpenClaw ID human peer key, owner or member, plus a claw hostname. A future enrollment owner supplies both through MacOpenClawIDOperatorRoute.shared.enrollment. Nothing on this branch sets it yet, so the route stays inert until the stacked enrollment PR lands.

Stacking

Stacked on #196759 (openclaw-e3b/macos-live-ocid, head d7ca1ae95d11), which sits on #196445 and #194201. This PR's base branch is openclaw-e3b/macos-live-ocid, so the diff shows only these four commits. main has no Swift OpenClaw ID code; the tunnel, WebSocket session, worker bridge and node-invite path all come from that stack. #196759's node-invite path is kept unchanged as the headless path.

Why This Change Was Made

Josh approved sign-in-first Mac enrollment. A Mac signs in with OpenClaw ID and becomes an owner or member device, so it doesn't join as a node with a separate operator key (W_op). #197421 built the connection, proxy and onboarding fixes on top of the superseded node-invite plus W_op flow. This PR keeps those fixes and drops the enrollment they were tied to.

Changes

  • MacOpenClawIDOperatorRoute: tunnel over a supplied human key, plus the dashboard proxy. It re-verifies the claw before each dial, and a relay move invalidates the route.
  • Primary Gateway over the tunnel: GatewayEndpointStore publishes the OpenClaw ID session with a nil token and password, so saved Gateway secrets never reach the claw.
  • MacOpenClawIDDashboardProxy, the loopback proxy, enforces:
    • an exact Host check
    • a per-launch HttpOnly SameSite=Strict cookie, held in a nonpersistent WKWebsiteDataStore
    • an exact-origin cookie content rule
    • Origin and Sec-Fetch-Site checks
  • WebSocket upgrades:
    • The proxy upgrades only the root /, and the Control UI always dials the Gateway root.
    • The worker bridge stays /__openclaw__/worker.
    • The codec takes a path parameter.
  • The conversation WebView and the reading tabs both stay on the operator store.
  • Dashboard ingress auth: a remote-ingress hello signs the dashboard challenge with no credential. Ingress never issues a reusable device token, so this case used to throw.
  • Dashboard resolution: a joined claw resolves through the endpoint store instead of the saved-config shortcut, so the dashboard route matches the tunnel route.
  • MacOpenClawIDJoinCompletion sets the order: mark setup complete, close onboarding, switch the primary, refresh the endpoint, then open the dashboard.
  • Joined-claw onboarding: no AI setup page, an unfinished first run finishes into the dashboard, and the handoff opens the normal dashboard.
  • Scope gates via GatewayConnection.grantsScope:
    • Pairing polls need operator.pairing.
    • The post-update system-event wake needs operator.admin.
  • Error copy: a superseded dashboard open (CancellationError) reads "Reconnecting to the Gateway", with OpenClaw ID guidance for a joined claw.

Dropped from #197421

These parts are superseded by sign-in-first enrollment:

  • the W_op operator key (OpenClawIDNodeIdentityKeychainStore(operatorKey:)) and operator_peer_key redemption
  • the trust target's nodePeerKeys
  • the node-invite chat opt-in
  • the "Add this Mac to a claw…" Settings entry
  • the openclaw-node://join URL scheme and deep link
  • the node-invite onboarding sheet

Because the OpenClaw ID onboarding sheet isn't on main, the onboarding-view guard that ignored a mode change after a finished join isn't carried either. Completion now closes onboarding before it switches the primary, so that guard isn't needed.

Evidence

All runs were on a macOS Studio in a separate checkout, with OPENCLAW_IROH_NATIVE=1:

  • swift build --package-path apps/macos --build-tests
  • swift build --package-path apps/shared/OpenClawKit --build-tests

Focused tests at the rebased head 92649f3a2ba8 ran in the sandboxed runner (sandbox-exec, network denied except Unix sockets):

  • App (327 tests in 32 suites): every OpenClaw ID, node-invite, onboarding, control-UI auth, bridge and proxy suite passed. That includes the new tests:
    • joined-claw first run
    • join ordering
    • page order
    • failure copy
    • remote-ingress dashboard signing
    • root-only upgrade
    • cookie rules
  • App failures are pre-existing:
  • Shared (139 tests): only GatewayNodeSessionDashboardAuthTests failed, on sandbox EPERM.
  • scripts/format-swift.sh macos and scripts/lint-swift.sh macos are clean.

Native i18n baseline regenerated with pnpm native:i18n:baseline.

Gaps:

  • There's no end-to-end proof against a live claw. Nothing on this branch supplies an enrollment, so the route is unreachable until the sign-in PR lands; that PR owns the live proof.
  • The endpoint store's nil-secret publication and the immediateDashboardEndpoint exclusion have no unit test. Both need a live route or isolated config.

@clawsweeper

clawsweeper Bot commented Nov 12, 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 app: macos App: macos scripts Repository scripts size: XL labels Nov 12, 2026
@jalehman
jalehman force-pushed the feat/ocid-mac-ocid-connection branch from b9889c5 to 92649f3 Compare November 12, 2026 06:12
@jalehman
jalehman changed the base branch from main to openclaw-e3b/macos-live-ocid November 12, 2026 06:12
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed docs Improvements or additions to documentation scripts Repository scripts size: XL labels Nov 12, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 92649f3a2ba8282e5c2eccf45b10992c6181afe0, but the PR head is now b64a0addd1adec7983e2aff386bec0d0ef8a4315. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (1 earlier review cycle)
  • reviewed 2026-11-12T06:33:21.105Z sha 92649f3 :: needs real behavior proof before merge. :: [P2] Handle tokenless trusted-proxy tunnel authentication | [P2] Preserve the operator session during dashboard endpoint refresh | [P2] Scope proxy URL conversion to the operator endpoint | [P2] Open the newly joined primary explicitly

@jalehman
jalehman force-pushed the openclaw-e3b/macos-live-ocid branch from 1ac9f29 to d7ca1ae Compare November 12, 2026 08:13
@jalehman
jalehman force-pushed the feat/ocid-mac-ocid-connection branch from 92649f3 to b64a0ad Compare November 12, 2026 08:14
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Nov 12, 2026
@jalehman
jalehman force-pushed the openclaw-e3b/macos-live-ocid branch from d7ca1ae to 4c31d47 Compare November 12, 2026 09:17
@jalehman
jalehman force-pushed the feat/ocid-mac-ocid-connection branch from b64a0ad to 989fb2e Compare November 12, 2026 10:01
@jalehman
jalehman force-pushed the openclaw-e3b/macos-live-ocid branch from 4c31d47 to 08cb4a1 Compare November 12, 2026 11:45
@jalehman
jalehman force-pushed the feat/ocid-mac-ocid-connection branch 5 times, most recently from 44f9a99 to cdd5423 Compare November 12, 2026 13:45
Base automatically changed from openclaw-e3b/macos-live-ocid to main November 12, 2026 14:14
…d dashboard proxy

The primary Gateway connection to a claw named by this Mac's OpenClaw ID enrollment now runs over that enrollment's in-process owner or member key, and never carries saved Gateway tokens or passwords. The dashboard reaches the claw through a loopback proxy gated by exact Host, Origin and a per-launch cookie kept in its own nonpersistent store. Join completion closes setup before switching the primary, a joined claw skips AI setup, pairing polls and the post-update wake follow advertised scopes, and a superseded dashboard open reads as reconnecting.
…ingress auth

Dashboard construction resolved a joined claw through the saved config shortcut, so its route never matched the tunnel endpoint. Ingress issues no device token, so the dashboard's signed challenge now carries no credential for remote-ingress, and the proxied Control UI always dials the Gateway root.
@jalehman
jalehman force-pushed the feat/ocid-mac-ocid-connection branch from cdd5423 to 8ea6a69 Compare November 12, 2026 14:29
@jalehman
jalehman marked this pull request as ready for review November 13, 2026 20:48
Resolve the published proxy for ready-state notifications, which omit the native session marker. Keep its URL and cookie together and await installation in the isolated WebKit store before navigation.

Refs: openclaw-cba.1
@jalehman
jalehman enabled auto-merge (squash) November 13, 2026 21:27
@jalehman
jalehman merged commit 126e63b into main Nov 13, 2026
72 checks passed
@jalehman
jalehman deleted the feat/ocid-mac-ocid-connection branch November 13, 2026 21:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 14, 2026
…aw#197585)

* feat(macos): connect to an OpenClaw ID claw over a human-key route and dashboard proxy

The primary Gateway connection to a claw named by this Mac's OpenClaw ID enrollment now runs over that enrollment's in-process owner or member key, and never carries saved Gateway tokens or passwords. The dashboard reaches the claw through a loopback proxy gated by exact Host, Origin and a per-launch cookie kept in its own nonpersistent store. Join completion closes setup before switching the primary, a joined claw skips AI setup, pairing polls and the post-update wake follow advertised scopes, and a superseded dashboard open reads as reconnecting.

* fix(macos): open the OpenClaw ID dashboard on the tunnel's route and ingress auth

Dashboard construction resolved a joined claw through the saved config shortcut, so its route never matched the tunnel endpoint. Ingress issues no device token, so the dashboard's signed challenge now carries no credential for remote-ingress, and the proxied Control UI always dials the Gateway root.

* style(macos): keep the OpenClaw ID route within Swift lint limits

* style(macos): keep the dashboard manager within the file length limit

* fix(macos): drop the OpenClaw ID dashboard proxy's unused logger

* fix(macos): prepare operator cookies on dashboard reconnect

Resolve the published proxy for ready-state notifications, which omit the native session marker. Keep its URL and cookie together and await installation in the isolated WebKit store before navigation.

Refs: openclaw-cba.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos P2 Normal backlog priority with limited blast radius. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant