Skip to content

fix(web): pair and stay paired from plain-http LAN and Tailscale pages again (partial revert of #27540) - #29984

Merged
nwparker merged 1 commit into
mainfrom
nwparker/web-client-empty-catalog
Oct 17, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/web-client-empty-catalog

Conversation

@nwparker

@nwparker nwparker commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​101 $\color{#cf222e}{\Huge{\mathbf{−}}}$​114 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​93 $\color{#cf222e}{\Huge{\mathbf{−}}}$​142 $\color{#cf222e}{\Huge{\mathbf{−}}}$​49

ELI5

People who opened Orca's web client at their computer's LAN or Tailscale address (for example http://100.x.y.z:6768/web-index.html) could no longer pair after upgrading from 1.4.227. The page loaded with no projects, "0 hosts" and a "Session restore failed" toast. This PR lets those pages pair again and keeps them paired across reloads, new tabs and bookmarks, as in 1.4.227.

What Changed

Before: Orca refused the first pairing from a plain-http page on another machine unless the operator restarted Orca with ORCA_ALLOW_INSECURE_WEB_PAIRING=1. The web client still started with no catalog, so the user saw "No workspaces found", "Add a project to get started", "0 hosts", and a sticky "Session restore failed / Changes won't be saved until restart" toast. The real reason only appeared in the browser console. Even with the opt-in set, a plain-http page kept the pairing only in memory, so any reload or new tab went back to "Connect to Orca".

After: the same page pairs and lists the projects. A reload, a new tab, or opening the bookmarked URL keeps working.

Mechanism. This partially reverts #27540 (host) and the plain-http part of #27552 (browser):

  • Host (mobile-socket-wiring.ts, ws-transport.ts, runtime-rpc-lifecycle.ts, mobile-e2ee-auth-validation.ts, e2ee-channel.ts): removes the insecure_origin refusal, the per-socket Origin and marker bookkeeping it needed, and the ORCA_ALLOW_INSECURE_WEB_PAIRING opt-in. These files are back to their pre-feat(runtime): session-only browser keys and opt-in for pairing from plain-http pages (host) #27540 versions apart from the parts kept below.
  • Browser (web-device-key.ts, web-runtime-credentials.ts, web-runtime-environment.ts, web-pairing-security-guidance.ts): a plain-http page on another machine is now token-insecure-origin. It stores the pairing code in local storage and signs in with it, as in 1.4.227. The "This pairing lasts only while this tab is open" and "keeps a reusable pairing code" notices for that case are removed.
  • Kept from feat(runtime): session-only browser keys and opt-in for pairing from plain-http pages (host) #27540/feat(web): the browser signs in with a non-extractable device key, or pairs for this session only #27552: session-only browser keys (pairing.device-key-ephemeral.v1, the 12-hour idle sweep, device-key sign-in). They still apply to secure pages and to browsers without Ed25519. The web bundle still adds ?orca-client=web to its upgrade URL, and hosts ignore it. The browser still maps a sealed insecure_origin reply to its explanation, because hosts from v1.4.225 to v1.4.228 still send it.
  • Small fix: when the host refuses a web client's credentials for any reason (revoked, downgraded, or an older host's plain-http refusal), startup now shows "Orca refused this browser" with the host's reason (startup-web-pairing-refused.ts). It no longer shows the generic "Session restore failed" over an empty workspace.

Credit: #27540 and #27552 added the session-only browser keys that this PR keeps.

Why

The refusal broke a workflow that worked in 1.4.227: LAN and Tailscale web access. It broke on upgrade, with no warning from the share flow (Settings still handed out the http://<LAN/Tailscale IP> link it would then refuse), and with an error the user could not see. The plain-http hardening is being re-planned in the security tracker. Until then, behaving like 1.4.227 is the safe default. Alternatives considered:

  • Keep the refusal and withhold the plain-http link in Settings with an explanation. This still breaks existing users' bookmarks and Tailscale setups on upgrade.
  • Keep the refusal behind the opt-in and only fix the error message. The user would still be locked out, and the page would still forget the pairing on reload.

Linked Issue

N/A (user report from a release candidate; the re-plan is tracked in the security tracker).

Visual Proof

Same isolated build, web client opened at http://100.108.226.109:<port>/web-index.html in headless Chromium.

Before (origin/main):
main-ts.png

After (this PR):
final-ts.png

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Live on macOS, with an isolated --serve host from this branch (temporary profile and HOME, free port, two local git projects), driven by headless Chromium through Playwright:

  • From a plain-http page at the Tailscale IP: before, "No workspaces found", "0 hosts", "Session restore failed", and the console said "Orca refused to pair from this page". After: both projects listed, "1 host", no error. A reload, then a new tab opened from the bare bookmark URL /web-index.html, still listed the projects.
  • From a loopback page (http://127.0.0.1, a secure context that uses device keys): pairs, survives a reload, and works from a new tab.
  • The refused-credentials toast was checked live on the pre-revert host, where the plain-http refusal still happens: it shows "Orca refused this browser" with the host's reason.

Automated:

  • web-session-pairing.test.ts: a never-used code pairs over a direct socket, an already-paired browser keeps working, Relay pairing works, and the ephemeral-key registration, sweep and revoke tests still pass.
  • web-insecure-origin-pairing.test.ts (new): on a plain-http page, a reload (fresh module graph) stays paired, signs in with the stored code, and shows no notice.
  • startup-degraded-recovery.test.ts: a refused web client shows the host's reason, not "Session restore failed" (fails before the change).
  • cross-version-web-upgrade-marker.unit.test.ts: the released host and this host both accept the marked upgrade from a LAN page. cross-version-web-session-pairing.unit.test.ts passes unchanged.
  • Locally: pnpm tc, every step of the static-analysis job (including the max-lines and focus-read ratchets and the localization checks), and the unit folders around the changed files: src/main/runtime/{rpc,runtime-rpc*,device*,ephemeral*}, src/main/server, src/renderer/src/{web,startup}.

Mixed versions: no new opcodes or fields. An older web client against this host pairs as it did with 1.4.227. This web client against a v1.4.225 to v1.4.228 host still gets that host's refusal, and now sees it explained. Phones and desktop clients never hit the gate, so nothing changes for them.

AI Disclosure

Review

Codex (gpt-6.1-sol, high): no findings.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: this restores 1.4.227's plain-http behaviour on purpose. On such a page the reusable pairing code lives in the browser's local storage, as it did before #27540/#27552. Https and loopback pages keep non-extractable device keys. SSH: managed hosts serve and pair the same way. Windows and Linux: no platform-specific code is touched.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…s again

Partially reverts #27540 and the plain-http part of #27552, which broke web
pairing on upgrade for 1.4.227 users who open Orca at a LAN or Tailscale address:

- The host no longer refuses a first pairing from a plain-http page on another
  machine (insecure_origin, ORCA_ALLOW_INSECURE_WEB_PAIRING).
- Such a page keeps its pairing code in local storage and signs in with it, as
  in 1.4.227, so reloads, new tabs and bookmarks stay paired; no notice.
- Session-only browser keys (pairing.device-key-ephemeral.v1, the idle sweep)
  stay for browsers without Ed25519.
- A web client whose credentials are refused shows the host's reason instead
  of an empty workspace and "Session restore failed".
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d1f715b-b1f3-4b95-a1b6-3f1ee8cc1ee9
📥 Commits

Reviewing files that changed from the base of the PR and between a87aa4c and a5a1b8c.

📒 Files selected for processing: 25
  • src/main/runtime/rpc/e2ee-channel.ts
  • src/main/runtime/rpc/mobile-e2ee-auth-validation.ts
  • src/main/runtime/rpc/mobile-socket-wiring.ts
  • src/main/runtime/rpc/web-session-pairing.test.ts
  • src/main/runtime/rpc/ws-transport.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-lifecycle.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/startup/startup-degraded-recovery.test.ts
  • src/renderer/src/startup/startup-degraded-recovery.ts
  • src/renderer/src/startup/startup-web-pairing-refused.ts
  • src/renderer/src/web/preload-api/web-runtime-credentials.ts
  • src/renderer/src/web/web-device-key.test.ts
  • src/renderer/src/web/web-device-key.ts
  • src/renderer/src/web/web-insecure-origin-pairing.test.ts
  • src/renderer/src/web/web-pairing-security-guidance.ts
  • src/renderer/src/web/web-runtime-credential-source.ts
  • src/renderer/src/web/web-runtime-environment.ts
  • src/shared/web-origin-security.test.ts
  • src/shared/web-origin-security.ts
  • tests/e2e/cross-version-wire/cross-version-web-upgrade-marker.unit.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Insecure-origin browser pairing now uses token-only credentials that can persist in local storage. Runtime authentication no longer applies an origin-based refusal to pending device tokens. WebSocket transport no longer records web-client origin metadata. Startup recovery now displays a notification for web pairing refusals, with an action to relaunch the app. Pairing guidance, translations, and tests were updated.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a5a1b

This change restores pairing and persistent pairing from plain-HTTP LAN and Tailscale pages. No concrete merge-blocking risk was identified in the supplied changes. The author states that the reusable pairing code in local storage is an intentional tradeoff.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description is detailed and covers the user impact, implementation, rationale, visual proof, testing, security, compatibility, and checklist. However, the required Linked Issue section contains “N… Add a valid linked issue reference in the “Linked Issue” section. Keep the existing explanation only as supporting context.
Docstring Coverage Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 19 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the web pairing fix for plain-HTTP LAN and Tailscale pages and notes the partial revert.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, visual proof, testing, security, compatibility, and checklist. However, the required Linked Issue section contains “N/A” instead of an actual issue link.

Resolution

Add a valid linked issue reference in the “Linked Issue” section. Keep the existing explanation only as supporting context.

Full details: Docstring Coverage

Explanation

Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 19 files. (6 skipped: 6 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 76fc1e5 into main Oct 17, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant