Skip to content

Pair remote Quest relays with a code shown in the viewer - #795

Open
jmccaffrey-nv wants to merge 4 commits into
NVIDIA:mainfrom
jmccaffrey-nv:dev/jmccaffrey/quest-remote-pairing
Open

jmccaffrey-nv wants to merge 4 commits into
NVIDIA:mainfrom
jmccaffrey-nv:dev/jmccaffrey/quest-remote-pairing

Conversation

@jmccaffrey-nv

@jmccaffrey-nv jmccaffrey-nv commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #794 (Require pairing for WebRTC browser viewers). Review only the last two commits; this PR will be rebased once that one merges.

Summary

A remote Quest relay authenticated with a shared token, and that token stayed valid across viewer and session changes. With this PR, the laptop relay pairs with a short code that the operator shows in the paired viewer.

  • Pairing. Press P in the viewer to show a 6-symbol code (for example K7M-4QX) on its HUD. The code is never written to a file or printed on the server console.
    • A code works once. It expires after 5 minutes unclaimed and is voided after 5 wrong entries.
    • Entering it in remote-vr (or passing --code) returns a reconnect key over the pinned TLS channel. The key lives only in the laptop's memory.
    • SSH still delivers the TLS pin and the static token that decides who may try a code. It no longer grants control, so the pairing file and FLASHDREAMS_CONTROLLER_PAIRING are removed.
  • Staying paired. The laptop stays paired across scene changes, viewer reloads in a paired browser, and network drops. While no viewer is connected, input pauses, including poses already buffered for the model, without ending the pairing. A dropped reconnect is retried with the key.
  • Handoff. One relay is served at a time. Any of these ends the pairing: R, a new code, a different viewer, or shutdown. A previous laptop's key is then refused, and remote-vr asks for the next code instead of exiting.
  • Fencing. Epoch checks guard the receiver and window queues, retained input and model action preparation. Queued poses from an ended pairing or a previous scene are dropped, including replies to a pull that was in flight when the scene changed. Revocation completes even if a viewer callback raises.
  • Docs. The HandDreams guide and READMEs give the operator flow: open the viewer link, press P, run remote-vr, type the code.

Pairing decides which laptop may drive the session. It does not verify that a paired laptop's poses are genuine, and the guide says so.

Validation

All checks ran on CPU, at this branch's head.

  • pytest -m ci_cpu:
    • flashdreams/test_v2: 466 passed.
    • HandDreams app, controller input and launcher tests: 1,820 passed, 3 skipped. As on main in this environment, test_mode_is_registered_as_a_v2_client_window_plugin fails because the controller-input entry point isn't installed.
    • Renderer and app input tests: 318 passed.
  • Regression tests cover these cases:
    • after a switch from laptop A to laptop B, A's key is refused and B reconnects without a restart;
    • a used code cannot be reused;
    • wrong entries are limited;
    • a scene change keeps the pairing;
    • a reload in a paired browser keeps the pairing.
  • ty check reports no new diagnostics.
  • The pre-commit hooks pass.
  • zensical build passes.

Not exercised: a real headset, a real browser, or GPU rendering.

🤖 Generated with Claude Code

A V2 WebRTC server accepted a new or replacement viewer from any client
that could reach its port. Viewer admission and file uploads now require
an owner credential, a strict Host/Origin policy and an HTTPS origin
outside loopback. Authorization runs before offer parsing and upload
reads, and generation checks fence requests that were in flight when
the viewer changed.

By default the serving rank creates a private credential once
(~/.config/flashdreams/webrtc-token) and reuses it. On an interactive
terminal the runner prints a one-click link that carries the code in the
URL fragment, which is never sent to the server; logs get only the URL
and the credential path. --no-login keeps tokenless loopback for a
trusted single-user machine and is refused anywhere else. The credential
is also read on Windows, where profile ACLs protect it.

Replacing a viewer releases its held keyboard, mouse, gamepad, wheel and
native UI input through a focus-loss boundary that leaves model history
and reset generations unchanged. Retired callbacks, frames, uploads and
deferred input are dropped. Walkthroughs and the HandDreams launcher open
the viewer on loopback with an SSH forward instead of --host 0.0.0.0.

Signed-off-by: Jonathan McCaffrey <jmccaffrey@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmccaffrey-nv
jmccaffrey-nv requested a review from a team as a code owner November 26, 2026 01:29
@copy-pr-bot

copy-pr-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@jmccaffrey-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 492c9ef

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The reviewed changes appear safe to merge; all three previous findings are addressed.RetriggerView in GreptileConfidence Score: 5/5

[High impact] The reviewed changes appear safe to merge; all three previous findings are addressed.

Summary

This PR pairs remote Quest relays with a short code shown in the viewer.

  • V2 browser sessions ask each browser to pair before it can control a session.
  • Remote Quest relays pair with a code in the viewer and keep only current input active.
  • Input controls now release held actions when a window loses focus.

No new actionable issues were found in the changes since the previous review. This review used code and test inspection; no runtime or headset checks were run.

Reviews (2) · Last reviewed commit: "Pause Quest input with the viewer and fe..." · Reviewed by Greptile

jmccaffrey-nv and others added 3 commits November 25, 2026 17:52
HandDreams created the WebRTC viewer without running the WebRTC mode's
argument checks, so --no-login with FLASHDREAMS_WEBRTC_TOKEN_FILE set
loaded the credential instead of refusing the conflicting options.
Creating the WebRTC window now runs those checks, and the Isaac Teleop
and remote Quest modes apply them before anything is built.

The HandDreams launcher also printed the LAN address for the viewer,
which now listens on loopback. It prints the loopback URL and the SSH
forward to reach it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jonathan McCaffrey <jmccaffrey@nvidia.com>
A remote Quest relay authenticated with a shared token that stayed valid
across viewer and session changes. The laptop relay now pairs with a
6-symbol code that the operator shows in the authenticated viewer (P).
Entering it in remote-vr returns a reconnect key over the pinned TLS
channel, held only in the laptop's memory. A code is single-use, expires
after 5 minutes and is voided after 5 wrong entries. SSH still delivers
the TLS pin and the static token that decides who may try a code; it no
longer delivers control authority, so the pairing file and
FLASHDREAMS_CONTROLLER_PAIRING are removed.

The laptop stays paired across scene changes, viewer reloads in a paired
browser and network drops. R, a new code, a different viewer or shutdown
ends the pairing; one relay is served at a time and an old key is
refused. Epoch checks fence receiver and window queues, retained input
and model action preparation, so queued poses from a revoked pairing or a
previous scene are dropped. Revocation completes even when a viewer
callback raises. While no viewer is connected, input pauses without
revoking.

Signed-off-by: Jonathan McCaffrey <jmccaffrey@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The retained authority check the model loop runs before generating
  now also requires the paired viewer to be connected, like the
  observation check. Poses buffered before a viewer disconnect no longer
  reach the model; the reconnect key stays valid.
- The receiver records the scene epoch when it sends a pull and drops
  the reply if the scene changed while the pull was in flight, so
  old-scene poses are not stamped with the new epoch.
- A paired relay whose reconnect closes before the server answers now
  retries with its key instead of exiting. An unpaired relay still
  reports the authentication failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jonathan McCaffrey <jmccaffrey@nvidia.com>
@jmccaffrey-nv
jmccaffrey-nv force-pushed the dev/jmccaffrey/quest-remote-pairing branch from 492c9ef to 8425eab Compare November 26, 2026 01:54

@gtong-nv gtong-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jmccaffrey-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 8425eab

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants