You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(relay): run your own relay: custom server setting, sign-in service and Compose example - #46239
Orca's phone relay only works through Orca's hosted sign-in. This lets you run your own sign-in service and relay, and point the desktop at them from Settings. Only the desktop signs in; the phone still pairs by scanning the desktop's QR code, which tells it which relay to use, so current phone app builds work without an update.
What Changed
A third Connection option: Your own relay. In Settings → Mobile → Pair a phone, the Connection choice is now Orca Relay / Your own relay / LAN. Picking Your own relay opens its fields inline (auth server URL, client ID, relay director URL, each with a hint), with Test connection and one apply button. Nothing switches until you press it ("Use this server", or "Apply changes" when editing the active server). The radio is the on/off switch, so there's no separate toggle or reset button. The relay status, cell and sign-in panel sit on whichever relay row is active. On the Mobile page the option shows the active server's host and links to Settings. Before this there was no setting; the desktop always used the hosted servers. That's still the default, and env vars ORCA_CLOUD_API_URL, ORCA_CLOUD_CLIENT_ID, ORCA_RELAY_URL still work and win over the saved setting.
Switching between Orca Relay and your own relay asks first, then cleans up: signs you out, stops the relay connection, revokes relay-based phone pairings, clears the paired-phones list, and starts fresh against the new server. Local-network pairings are kept. A custom server never receives Orca's production tokens (artifact, skills and connector services are untouched), and if only part of the env triple is set, the whole triple comes from the environment.
cloud/apps/relay-auth, a sign-in service you can run yourself. A small Hono/SQLite service with a Dockerfile. It implements the /v1/desktop/auth/* API the desktop already uses, serves /.well-known/jwks.json, and issues the short-lived ES256 tokens the relay already verifies. PKCE only, strict loopback redirects, single-use codes, rotating refresh tokens (60 s replay window), failure-only rate limits, constant-time secret compares. Default mode is a single admin secret.
Optional upstream OIDC (ORCA_AUTH_UPSTREAM_*): the browser goes to your identity provider (Zitadel, Keycloak, Authentik...) with authorization code + PKCE. It refuses to start without an email/domain allowlist unless you explicitly opt out.
cloud/self-hosted, a Docker Compose example.cp .env.example .env, fill in a domain and two secrets, docker compose up -d --build, and you get the relay, relay-auth and Caddy (automatic Let's Encrypt) on one HTTPS origin. Caddy sends the auth API to relay-auth, everything else (WebSockets included) to the relay, and blocks /v1/admin. Identity-provider login is a few commented-out lines; the provider itself isn't bundled.
Phone: relay fallback after pairing. Testing on a real iPhone over mobile data, the first attempt after pairing only tried the LAN address. Two phone-side defects that can cause that are fixed (each with a test that fails without the fix): a failed relay dial's retry was dropped while the LAN dial was still connecting (it waited for the 12 s LAN timeout), and a host-list read during a pairing save could return the host without its relay routing. The connection log now says at host open whether relay fallback is ready.
Small bug fix: after the relay connection dropped, the status said "Reconnecting" with nothing connected. It now reports offline when no control connection is live.
The phone doesn't sign in, here or with the hosted relay: it pairs from the desktop's QR code, which already carries the relay address and a one-time invite. So the mobile app and wire contract are unchanged, and current App Store and Play Store builds work with a self-hosted relay (relay origins are still HTTPS-only for phones).
Why
Self-hosting the relay is a repeated request, and the relay server was already MIT in cloud/ but unusable without a token issuer and a way to point the desktop at it. Considered and rejected: making the relay accept arbitrary JWKS only (still no issuer), and patching the hosted URL via env only (no GUI, no safe switch/revoke behaviour).
This is the "Phase 1" shape proposed in #10577 (combined relay container, relay URL in Settings, docs) plus the operator-owned auth issuer from its "Phase 3". Also related:
New option, so there's no before. Taken from the e2e harness against a local relay; in that unpackaged build Orca's hosted relay is unavailable, which is why some shots show Orca Relay as "Unavailable".
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
pnpm check:changed passes (53 checks) after rebasing on main; the cloud/ build and relay-auth tests pass.
pnpm test:e2e:custom-relay: starts a relay and relay-auth locally, drives the real Settings screen in a hidden Orca window, signs in, pairs a simulated phone, runs an encrypted request through the relay, kills and restarts the relay and checks recovery, then switches to a second server and checks the old pairing and session are gone.
Both Docker images built and run with Podman on Debian; a token from relay-auth is accepted by the relay and a tampered one is rejected.
Compose example: run with Docker Compose v5.8.0 against rootless Podman 5.7 (not Docker Engine), using Caddy's internal CA since a private test box can't get a Let's Encrypt certificate. A script checked sign-in, a relay token accepted by /v1/assign, a tampered token rejected, the host control WebSocket upgrading through Caddy, /v1/admin blocked, a spoofed X-Forwarded-For still rate-limited, and the signing key and relay database surviving down/up. Automatic HTTPS and a desktop or phone against the compose stack weren't tested.
Whole stack run for real (relay, relay-auth, Zitadel behind nginx with TLS): real Zitadel sign-in from the desktop with an allowlisted email, wrong password rejected, then an Android emulator paired over the relay and read worktrees, recovered ~24 s after a relay outage, and showed "Pairing invalid" after the desktop switched servers.
Windows 10 (Russian locale): the custom relay e2e passes (2 passed), including the self-signed cert, relay kill/restart and server switch. It first failed only because the app followed the OS language while the spec asserts English copy, so the last commit pins the shared e2e profile to English. That helps every desktop e2e spec on non-English machines. The relay-auth tests and the desktop tests for the touched areas (253) pass on Windows too. One existing relay test, relay.blackbox.test.ts "typed 4503 on unplanned SIGTERM", fails on Windows because kill('SIGTERM') is a hard terminate there; this PR doesn't touch it.
iOS simulator (iPhone 17 Pro, iOS 27.2, Release build of the current app) against the same live stack: real Zitadel sign-in on the desktop, then the phone paired from a pairing link whose only reachable path was the relay (its LAN endpoint was an unroutable address; the relay logs show the phone joining with the invite and later resuming). On the phone it opened a terminal and ran echo ios-relay-ok; the output showed on the phone and in the desktop terminal. Relay stopped for ~40 s: the phone showed Disconnected and was back about 30 s after restart. Switching the desktop back to the default server left zero paired devices and the phone showing "Sign-in required". This run used the branch from before the CodeRabbit review fixes; the custom relay e2e and the compose check were rerun after them.
Platforms: macOS and Windows desktop, Android emulator, iOS simulator. Not tested: Linux desktop (CI covers it), a physical iPhone.
Only the relay and sign-in are configurable; artifact, skills and connector services keep their settings.
Known and not changed here: the desktop pairing panel keeps showing "Unavailable" after the relay recovers until a new pairing code is generated. That's in existing code.
Performance
None, because the new code runs only when the settings page opens, on server switch, and at startup (one config read). The relay itself is unchanged apart from the status label.
Risk
Level: Medium
Riskiest part: switchCloudServer and the relay startup/teardown paths. If it went wrong, a user who switched servers could see a relay that doesn't reconnect or a phone pairing that lingers; they'd re-pair. It's opt-in, so users who never touch the setting stay on the hosted servers with unchanged behaviour. Saved data: one new optional setting (customCloudServer). Older paired phones are unaffected. Back out with a plain revert; a revert leaves the saved setting key in settings.json, which is ignored.
AI Disclosure
Written with Claude Code (Claude) and Codex (GPT models). A second, different model reviewed the code for security and lifecycle bugs, and the findings were fixed before this PR (see commit messages). The end-to-end runs were agent-driven; their logs and screenshots were checked against the results claimed here.
Review
It's seventeen commits, meant to be read in order: auth service, OIDC mode, settings and switching logic, status fix, e2e test, installer regression test, paired-phones refresh, e2e English pin, compose example, field hints, phone relay fallback, review fixes, Connection redesign. The settings commit is the one I'd read most carefully. cloud/apps/relay-auth is self-contained. The diff is large (mostly the new package, its tests and docs, plus the Connection UI); I can split the auth service and the compose example into their own PR if you'd rather review it separately.
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.
Checklist
This PR is small and focused
I explained what changed and why
I stated the risk
Screenshots attached for UI changes
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Walkthrough
The change adds configurable cloud authentication and relay endpoints, desktop controls to test and switch servers, and relay pairing behavior scoped to a relay director URL. It also adds a relay-auth service with optional upstream OIDC and a Docker Compose deployment for running the service and relay behind HTTPS. Mobile relay recovery, diagnostics, and paired-host snapshot handling are updated. Unit and end-to-end tests cover authentication, server switching, pairing, and relay recovery.
Merge Risk: Low · previous review 98d43
Two narrow edge cases remain. Saving unchanged server settings while a cloud profile is being created can discard that profile locally. A host-list read that races a re-pairing can briefly return stale routing. Neither is likely to disrupt common workflows, so the change is mergeable with follow-up.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a custom relay server setting, a sign-in service (relay-auth), and a Compose example. The raw summary confirms all three are in the changeset. The title uses the conve…
Linked Issues check
[#10577, #2471] Both direct issues request a relay path that works without a shared local or tailnet network and with a configurable or self-hosted relay endpoint. The whole-PR summary (mergeBase d3fe…
Out of Scope Changes check
Most changed files serve the custom relay feature. These include the settings UI and IPC handlers, validation, switch and revoke logic, the relay-auth service and Compose example, and the production-t…
Description check
The description follows the repository template closely. It covers ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, the agent skill boundary, and…
Full details: Title check
Explanation
The title names the main change: a custom relay server setting, a sign-in service (relay-auth), and a Compose example. The raw summary confirms all three are in the changeset. The title uses the conventional feat(relay) prefix and is specific enough for a teammate scanning history. Its length (91 characters) is long but acceptable.
Full details: Linked Issues check
Explanation
[#10577, #2471] Both direct issues request a relay path that works without a shared local or tailnet network and with a configurable or self-hosted relay endpoint. The whole-PR summary (mergeBase d3fe2b9 to currentHead 98d43ba) shows the implementation:
#10577 (configurable relay endpoint, self-hosting): CustomRelayServerSettings.tsx and profile-cloud-server-settings.ts let the user set the auth URL, client ID, and relay director URL. profile-cloud-auth-config.ts applies saved settings when no environment override is present. cloud/self-hosted/compose.yaml runs relay, relay-auth, and Caddy on one HTTPS origin. Region-aware cell assignment, an alternative named in the issue, is not implemented. The issue offers it as an alternative, so its absence does not fail the self-hosting requirement.
#2471 (relay-based mobile-to-desktop connection): the desktop signs in to the configured auth server. The phone pairs from the desktop QR code, which carries the relay address and a one-time invite. The e2e spec tests/e2e/remote/relay/custom-relay-stack.spec.ts covers pairing a simulated phone through the relay, encrypted requests, and recovery after relay restart. The mobile relay fallback changes (host-store, pairing-publication fence, endpoint supervisor, direct-grace timer) support relay-only connection behavior.
Coding tests are listed in the summary for the settings, config precedence, switch cleanup, relay-auth service, upstream OIDC, installer stop, mobile host-store race, and supervisor relay race. Automatic Let's Encrypt HTTPS and desktop or phone use against the Compose stack are not verified. These are verification limits and do not block the coding requirements. No source file was read directly in this pass, so this verdict relies on the whole-PR summary and the e2e spec summary.
Full details: Out of Scope Changes check
Explanation
Most changed files serve the custom relay feature. These include the settings UI and IPC handlers, validation, switch and revoke logic, the relay-auth service and Compose example, and the production-token guards in artifact, skill, and connector paths. Test environment stubs for ORCA_RELAY_URL follow from the rule that the environment triple applies as a whole.
Secondary changes connect to the feature or to the relay path for #2471:
relay-origin-pool.ts status label fix: matches the offline status fix in the PR description.
DesktopRelayServiceInstaller stop() and relay-host-install.ts: support server switching.
mobile/src host-store, pairing-publication fence, endpoint supervisor, and direct-grace timer: these change how the mobile app falls back to relay after a direct-dial head start. They fit the relay connection objective of #2471. The PR description does not describe them in the body and states the mobile app is unchanged. That statement does not match the diff. This is a description gap, not an unrelated change.
Windows-locale e2e English pin (electron-fixtures): supports the new e2e spec and affects other desktop e2e specs. The PR states this.
i18n strings and protected-copy keys: cover the new UI.
relay-demand-ledger, revoke-outbox, and runtime-rpc-mobile-devices director URL scoping: support safe revocation on server switch.
No change appears unrelated to the custom relay, self-hosting, or mobile relay connection objectives. Splitting the auth service and Compose example into separate pull requests is a review preference, not a scope failure.
Full details: Description check
Explanation
The description follows the repository template closely. It covers ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, the agent skill boundary, and the checklist. The What Changed section explains the before and after and the mechanism. The Risk section names the riskiest part and gives a back-out path. Testing lists platforms and checks. Visual Proof includes before/after images for the new option. The Performance section has a concrete reason. Minor gaps: the Linked Issue section lists issues, but the 'Fixes' lines are explicit. The checklist has one unchecked item ('small and focused'), which the author acknowledges. The description is detailed and mostly complete.
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.
Files skipped from review as they are similar to previous changes: 10
src/renderer/src/i18n/locales/de.json
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/pt.json
src/renderer/src/i18n/locales/ru.json
src/renderer/src/i18n/locales/tr.json
src/renderer/src/i18n/locales/zh-Hant.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
@Jinwoo-H@brennanb2025 hello, bosses, will this PR be merged? I really need this. I've recommended Orca to a lot of friends. It's a great piece of software, but we've noticed that the official login and relay services often time out and reconnect in mainland China. It could be that China's cross-border firewall (the GFW) is blocking or interfering with Orca's official services, or it could just be a poor network connection.
Add a single-tenant auth service with PKCE login, rotating refresh sessions, and bound relay tokens. Register its tests and support deployment of the isolated workspace package.
Delegate login to a validated upstream provider with PKCE, nonce and verified-email admission. Keep durable identities, bounded callbacks and session-policy enforcement.
Persist validated auth and relay endpoints, expose desktop settings and connection checks, and retire old relay pairings before switching. Fence late provisioning and keep custom-cloud credentials isolated from default services.
Exercise hidden desktop settings, authentication, encrypted mobile RPC, outage recovery and server retirement against a local HTTPS auth and relay stack. Verify environment overrides retain the effective server session.
Cover a pending network-ready install and later auth-change and ensure requests after permanent stop. Assert installation stays refused without timers or work counts.
…ervers
Switching revokes relay pairings in main, but the renderer kept showing its cached device list, so a revoked phone still appeared under paired devices. Found by the live desktop plus Android emulator run.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The completed-onboarding profile left uiLanguage on its default, which
follows the OS locale. Specs assert English copy, so they failed on a
non-English machine (seen on a Russian-locale Windows 10 host running
the custom relay spec). Pinning English makes them locale-independent
and matches what English-locale machines and CI already get.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
cloud/self-hosted runs the relay (combined mode, SQLite), relay-auth and
Caddy on one HTTPS origin: Let's Encrypt by default, Caddy's internal CA
for trying it without a public name. Caddy routes the desktop auth API,
JWKS and /healthz to relay-auth, returns 404 for /v1/admin, and sends
everything else, WebSockets included, to the relay, which reads JWKS
from relay-auth inside the stack. A one-shot service hands the relay's
data volume to the image's node user, since a fresh volume is
root-owned. Secrets are required variables; upstream OIDC is shown
commented out.
Checked with Docker Compose v5.8.0 on rootless Podman 5.7 using the
internal CA: sign-in, relay token accepted by /v1/assign, tampered token
rejected, host control WebSocket upgraded through Caddy, /v1/admin
blocked, spoofed X-Forwarded-For still rate-limited, and the signing key
and relay database kept across down/up.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gate cloud services with effective auth configuration, fence cloud-linked profile creation across server switches, and require auth server origins.
Co-Authored-By: Codex <[email protected]>
… the DOM
Fixes CodeRabbit findings [11] (ORCA_RELAY_URL missing from three fixtures that set the
auth override) and [15] (custom relay env-override test now asserts the signed-in relay
state and pairing availability through the DOM).
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The cloud override is now all three of ORCA_CLOUD_API_URL,
ORCA_CLOUD_CLIENT_ID and ORCA_RELAY_URL or none, so the dev-tools hint
and the relay benchmark's launch command name the third variable too.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The auth URL is easy to mistake for the identity provider and the client
ID for a per-device name. Add a hint under each field and say what the
auth test actually failed to find.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l fails or its save is read mid-write
Two ways a relay-paired host could sit on the LAN address without reaching the relay:
- A failed relay dial was retried on its backoff timer, but unforced recovery
waits out a connecting direct dial, so the retry was dropped until the LAN
dial gave up (12 s connect deadline, then growing redial delays). Once the
direct head start is spent for an outage, relay retries now run on their own
backoff; a LAN that connects still wins and aborts the dial.
- savePairedHost writes host metadata, the device token and the relay routing
in turn, so a host list read during the save returned a usable host with no
relay (for a re-pair, the old cached token with no relay). Such a profile
opens the direct-only upgrade controller, which never dials the relay. Host
list reads now wait for a pending pairing save (bounded at 5 s so a hung
keychain cannot freeze them), and a load that overlaps a completed durable
write is read again.
Also log at host open whether relay fallback is ready (and what the direct
dial and credentials look like) or the host has no relay routing, so a host
that never dials the relay explains itself in the connection log.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- A server "switch" that keeps the effective server (env overrides win)
no longer fences an in-flight cloud profile creation; only a real
server change does.
- A host-list read rechecks for a pending pairing save in the same step
that captures the revision, so a save that starts while the read waits
on queued mutations is waited out too. The read loop moves to
host-list-settled-load.ts to keep host-store under the line limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The custom relay server lived in its own Settings group above the Pair a
phone Connection choice, so users had to turn it on, then go back and pick
Orca Relay. It is now a radio beside Orca Relay and LAN.
- Selecting Your own relay reveals the server fields inline; nothing
switches until Use this server / Apply changes, after the existing
confirmation dialog. Choosing Orca Relay while a custom server is active
uses the same dialog and keeps the saved URLs; LAN never switches servers.
- Relay status, sign-in and cell lines show on whichever relay is active.
- After a switch signs the desktop out, the chosen relay stays selected
instead of falling back to LAN.
- The signed-out LAN default no longer overrides a live Relay pick, which
made Relay unselectable for users whose saved mode was LAN.
- The Mobile page shows the same three options; its own-relay row links to
Settings for the server form.
- Settings search for the custom server lands on the Connection section.
- Retire the unused toggle and reset keys from every locale catalog.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Jinwoo-H@brennanb2025 friendly ping: this is rebased onto the latest main again and has no conflicts. The checks pass locally, and so does the custom relay end-to-end test. The fork's CI just needs your approval to run. Could you take a look and merge it if it looks good? It's the setup I use every day, and as the comment above shows, people whose connection to the hosted relay is unreliable need it too. Happy to change anything you'd like.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca's phone relay only works through Orca's hosted sign-in. This lets you run your own sign-in service and relay, and point the desktop at them from Settings. Only the desktop signs in; the phone still pairs by scanning the desktop's QR code, which tells it which relay to use, so current phone app builds work without an update.
What Changed
A third Connection option: Your own relay. In Settings → Mobile → Pair a phone, the Connection choice is now Orca Relay / Your own relay / LAN. Picking Your own relay opens its fields inline (auth server URL, client ID, relay director URL, each with a hint), with Test connection and one apply button. Nothing switches until you press it ("Use this server", or "Apply changes" when editing the active server). The radio is the on/off switch, so there's no separate toggle or reset button. The relay status, cell and sign-in panel sit on whichever relay row is active. On the Mobile page the option shows the active server's host and links to Settings. Before this there was no setting; the desktop always used the hosted servers. That's still the default, and env vars
ORCA_CLOUD_API_URL,ORCA_CLOUD_CLIENT_ID,ORCA_RELAY_URLstill work and win over the saved setting.Switching between Orca Relay and your own relay asks first, then cleans up: signs you out, stops the relay connection, revokes relay-based phone pairings, clears the paired-phones list, and starts fresh against the new server. Local-network pairings are kept. A custom server never receives Orca's production tokens (artifact, skills and connector services are untouched), and if only part of the env triple is set, the whole triple comes from the environment.
cloud/apps/relay-auth, a sign-in service you can run yourself. A small Hono/SQLite service with a Dockerfile. It implements the/v1/desktop/auth/*API the desktop already uses, serves/.well-known/jwks.json, and issues the short-lived ES256 tokens the relay already verifies. PKCE only, strict loopback redirects, single-use codes, rotating refresh tokens (60 s replay window), failure-only rate limits, constant-time secret compares. Default mode is a single admin secret.Optional upstream OIDC (
ORCA_AUTH_UPSTREAM_*): the browser goes to your identity provider (Zitadel, Keycloak, Authentik...) with authorization code + PKCE. It refuses to start without an email/domain allowlist unless you explicitly opt out.cloud/self-hosted, a Docker Compose example.cp .env.example .env, fill in a domain and two secrets,docker compose up -d --build, and you get the relay,relay-authand Caddy (automatic Let's Encrypt) on one HTTPS origin. Caddy sends the auth API torelay-auth, everything else (WebSockets included) to the relay, and blocks/v1/admin. Identity-provider login is a few commented-out lines; the provider itself isn't bundled.Phone: relay fallback after pairing. Testing on a real iPhone over mobile data, the first attempt after pairing only tried the LAN address. Two phone-side defects that can cause that are fixed (each with a test that fails without the fix): a failed relay dial's retry was dropped while the LAN dial was still connecting (it waited for the 12 s LAN timeout), and a host-list read during a pairing save could return the host without its relay routing. The connection log now says at host open whether relay fallback is ready.
Small bug fix: after the relay connection dropped, the status said "Reconnecting" with nothing connected. It now reports offline when no control connection is live.
The phone doesn't sign in, here or with the hosted relay: it pairs from the desktop's QR code, which already carries the relay address and a one-time invite. So the mobile app and wire contract are unchanged, and current App Store and Play Store builds work with a self-hosted relay (relay origins are still HTTPS-only for phones).
Why
Self-hosting the relay is a repeated request, and the relay server was already MIT in
cloud/but unusable without a token issuer and a way to point the desktop at it. Considered and rejected: making the relay accept arbitrary JWKS only (still no issuer), and patching the hosted URL via env only (no GUI, no safe switch/revoke behaviour).Linked Issue
Fixes #10577
Fixes #2471
This is the "Phase 1" shape proposed in #10577 (combined relay container, relay URL in Settings, docs) plus the operator-owned auth issuer from its "Phase 3". Also related:
Visual Proof
New option, so there's no before. Taken from the e2e harness against a local relay; in that unpackaged build Orca's hosted relay is unavailable, which is why some shots show Orca Relay as "Unavailable".
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
pnpm check:changedpasses (53 checks) after rebasing onmain; thecloud/build andrelay-authtests pass.pnpm test:e2e:custom-relay: starts a relay andrelay-authlocally, drives the real Settings screen in a hidden Orca window, signs in, pairs a simulated phone, runs an encrypted request through the relay, kills and restarts the relay and checks recovery, then switches to a second server and checks the old pairing and session are gone.Both Docker images built and run with Podman on Debian; a token from
relay-authis accepted by the relay and a tampered one is rejected.Compose example: run with Docker Compose v5.8.0 against rootless Podman 5.7 (not Docker Engine), using Caddy's internal CA since a private test box can't get a Let's Encrypt certificate. A script checked sign-in, a relay token accepted by
/v1/assign, a tampered token rejected, the host control WebSocket upgrading through Caddy,/v1/adminblocked, a spoofedX-Forwarded-Forstill rate-limited, and the signing key and relay database survivingdown/up. Automatic HTTPS and a desktop or phone against the compose stack weren't tested.Whole stack run for real (relay,
relay-auth, Zitadel behind nginx with TLS): real Zitadel sign-in from the desktop with an allowlisted email, wrong password rejected, then an Android emulator paired over the relay and read worktrees, recovered ~24 s after a relay outage, and showed "Pairing invalid" after the desktop switched servers.Windows 10 (Russian locale): the custom relay e2e passes (
2 passed), including the self-signed cert, relay kill/restart and server switch. It first failed only because the app followed the OS language while the spec asserts English copy, so the last commit pins the shared e2e profile to English. That helps every desktop e2e spec on non-English machines. Therelay-authtests and the desktop tests for the touched areas (253) pass on Windows too. One existing relay test,relay.blackbox.test.ts"typed 4503 on unplanned SIGTERM", fails on Windows becausekill('SIGTERM')is a hard terminate there; this PR doesn't touch it.iOS simulator (iPhone 17 Pro, iOS 27.2, Release build of the current app) against the same live stack: real Zitadel sign-in on the desktop, then the phone paired from a pairing link whose only reachable path was the relay (its LAN endpoint was an unroutable address; the relay logs show the phone joining with the invite and later resuming). On the phone it opened a terminal and ran
echo ios-relay-ok; the output showed on the phone and in the desktop terminal. Relay stopped for ~40 s: the phone showed Disconnected and was back about 30 s after restart. Switching the desktop back to the default server left zero paired devices and the phone showing "Sign-in required". This run used the branch from before the CodeRabbit review fixes; the custom relay e2e and the compose check were rerun after them.Platforms: macOS and Windows desktop, Android emulator, iOS simulator. Not tested: Linux desktop (CI covers it), a physical iPhone.
Only the relay and sign-in are configurable; artifact, skills and connector services keep their settings.
Known and not changed here: the desktop pairing panel keeps showing "Unavailable" after the relay recovers until a new pairing code is generated. That's in existing code.
Performance
None, because the new code runs only when the settings page opens, on server switch, and at startup (one config read). The relay itself is unchanged apart from the status label.
Risk
Level: Medium
Riskiest part:
switchCloudServerand the relay startup/teardown paths. If it went wrong, a user who switched servers could see a relay that doesn't reconnect or a phone pairing that lingers; they'd re-pair. It's opt-in, so users who never touch the setting stay on the hosted servers with unchanged behaviour. Saved data: one new optional setting (customCloudServer). Older paired phones are unaffected. Back out with a plain revert; a revert leaves the saved setting key insettings.json, which is ignored.AI Disclosure
Written with Claude Code (Claude) and Codex (GPT models). A second, different model reviewed the code for security and lifecycle bugs, and the findings were fixed before this PR (see commit messages). The end-to-end runs were agent-driven; their logs and screenshots were checked against the results claimed here.
Review
It's seventeen commits, meant to be read in order: auth service, OIDC mode, settings and switching logic, status fix, e2e test, installer regression test, paired-phones refresh, e2e English pin, compose example, field hints, phone relay fallback, review fixes, Connection redesign. The settings commit is the one I'd read most carefully.
cloud/apps/relay-authis self-contained. The diff is large (mostly the new package, its tests and docs, plus the Connection UI); I can split the auth service and the compose example into their own PR if you'd rather review it separately.Agent skill upstream boundary
Checklist
pnpm check:changedpasses (CI covers the rest)🤖 Generated with Claude Code