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
fix(emulator): show the paired server's simulators in remote workspaces - #47448
If your project lives on another Mac that you connected to, the phone simulator panel now shows that Mac's simulators (and their live picture), not the ones on the laptop you are sitting at.
What Changed
Before: in a workspace owned by a paired server, the Mobile Emulator pane always talked to this desktop's runtime. It listed this desktop's simulators, booted them here, and streamed them from this desktop's 127.0.0.1.
After: the pane follows the workspace's runtime, as the browser pane does.
Calls.attach, listDevices, tap, gesture, button, rotate, type, syncKeyboardLayout, checkInput and shutdown now go to emulatorRuntimeTarget(worktreeId) (runtimeEnvironmentIdOrLocalUnlessTwin, the same owner lookup the browser pane uses). The simulator tab is stamped with that host, and the opening-preferences capability is read from that runtime.
Stream. serve-sim's URLs name the server's loopback (http://127.0.0.1:31xx/helper/<udid>/stream.mjpeg, .../stream.avcc, ws://.../ws). For a remote session the desktop now swaps them for loopback ports on this desktop that tunnel to the server:
Server: new streaming RPC emulator.tunnel (permission: 'workspace', binary). It reuses BrowserNetworkTunnelSession (framing, window-v2 flow control, memory budget) but admits only loopback connections to ports of this host's registered simulator helpers (emulatorTunnelTargetAllowed). Advertised as emulator.tunnel.v1.
Desktop main: EmulatorRuntimeTunnelTransport subscribes to it with BrowserNetworkTunnelClient; EmulatorRuntimePortForwards opens one 127.0.0.1:0 listener per server port and pipes each accepted socket through the tunnel. New IPC emulator:forwardRuntimeSession (trusted UI renderer only) returns the rewritten URLs. Forwards are never closed under a pane (parked panes keep working); past 64 per server, new forwards fail with an explicit error.
Video: startVideoStream also passes the stream URL the pane was given. Main resolves AVCC from a forwarded URL it issued and still serves, else from this host's own session only when the pane named that session's stream, so same-UDID devices on two hosts never share a picture.
The existing MJPEG/AVCC readers and the control WebSocket are unchanged; they just dial the forwarded port.
Keyboard. Remote panes skip emulator.syncKeyboardLayout and type through text input, because that sync applies the server's hardware layout, not this keyboard's.
Cleanup. If forwarding fails after a remote attach, the managed session is shut down so no simulator is left without a pane.
Local workspaces are untouched: the target is { kind: 'local' }, no forwarding happens, URLs are used as before.
Why
The runtime side of emulator.* already accepted paired callers; only the client hard-coded local, and the picture came from the wrong machine's loopback.
I first tried to reuse the client-hosted browser's network route (network.browserTunnel + SOCKS) directly, but it needs a browser host lease and the server's native execution-host revision (which a client only learns from browser page commands), and it is host-admin. A workspace-scoped emulator.tunnel that reuses the same tunnel session/client classes keeps the framing and flow control, needs no browser lease, and can only reach simulator helper ports.
Client MacBook Air, workspace on a paired MacBook Pro server:
Before (upstream main): the pane lists the Air's own simulators and fails with selector_not_found.
After (this branch): the pane lists the server's simulators and streams Apple's Food Truck sample running on the server.
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
Manual, two physical Macs (both macOS, Apple silicon). Server: MacBook Pro; client: MacBook Air. Both ran an arm64 build of this branch packaged side by side with the release app (own bundle id and profile), paired with orca pair / orca environment add.
Over the LAN and over Tailscale: the client's picker listed the server's devices, not the Air's own; Connect booted the server's simulator; the pane showed its live picture.
With Apple's Food Truck sample built for the simulator on the server: the app ran in the client's pane; taps, Home and typing (text input) reached it, and the picture stayed smooth. Retested after the review fixes.
lsof on the client: one new 127.0.0.1 forward listener; the only connections to the server were the runtime's port; nothing dialed the server's serve-sim port.
Idle home screen over LAN: ~47 frames / 10 s, ~7 KB of H.264; app launch animation over Tailscale: 49 frames / 10 s, ~36 KB.
Earlier, one machine, two isolated dev instances: instance A ran as the server (orca pair --address 127.0.0.1), instance B was paired to it with orca environment add and opened A's workspace.
B's picker listed A's devices; Connect booted iPhone 17e through A, and A started serve-sim on 127.0.0.1:3101.
B's pane showed the live picture. lsof: B's main process listened on a new loopback port and both B's main (AVCC/MJPEG) and B's renderer (control WebSocket) connected only to that port; only A connected to 3101.
A tap in B's pane opened Settings on the simulator; xcrun simctl io … screenshot matched the pane. emulator.button / emulator.list from B returned A's session.
Local path: A's own pane on the same workspace connected directly to 3101 and opened no forward listener.
Not tested: the Orca relay (only LAN and Tailscale), sustained motion bandwidth, Android emulators on a remote server, Linux/Windows clients.
Note for reviewers testing with pnpm dev on macOS 15+: the dev bundle lacks NSLocalNetworkUsageDescription, so it cannot reach LAN hosts (Tailscale works). That is a separate dev-tooling fix.
Automated: emulator-runtime-port-forwards.test.ts carries a real TCP connection through the real tunnel session/client to an echo server, and checks that an unregistered server port is refused (fails if emulatorTunnelTargetAllowed admits everything). pnpm check:changed passes (lint, typecheck, tests, ratchets, rpc catalog).
Performance
Only runs while a remote workspace shows a simulator. Each forwarded stream is one TCP stream inside one emulator.tunnel subscription; frames are not decoded or copied beyond the tunnel framing. iOS prefers the AVCC (H.264) stream, which is much smaller than the MJPEG fallback (numbers under Testing); sustained motion and the relay were not measured, and the MJPEG fallback may lag over a relay. Idle forwards are only loopback listeners (no traffic); at most 64 per server.
Risk
Level: Medium
Remote workspaces that used to (wrongly) show this desktop's simulators now show the server's. A server without emulator.tunnel.v1 (older build) still gets the right device list and controls, but no picture.
New server-side surface: a paired client with workspace scope can open TCP streams to this host's loopback, limited to ports of currently registered simulator helpers.
Forward listeners bind 127.0.0.1 only, so local processes on the client can reach the server's simulator helper while it is shown — the same exposure a local serve-sim has today.
Remote panes type through text input, not physical key codes, so layout-specific shortcuts behave like the paste path.
Android on a remote server is not covered (scrcpy video stays local-only); the pane shows controls without a picture.
Back out: plain revert. No persisted data or settings change.
AI Disclosure
Written with Claude Code (Claude Opus 5.5); I reviewed the change and ran the manual tests above on my own two Macs. CodeRabbit's findings are addressed in the second commit.
Review
Cross-platform: Node net only, loopback-bound; no platform branches. Simulators are macOS-only on the server anyway.
SSH/remote: paired-server workspaces are the point of the change; direct-SSH workspaces keep the local target as before.
Agents/integrations: agent-driven orca emulator calls already ran on the server; unchanged.
Performance: see above.
UI: no UI changes.
Security: new workspace-scoped RPC limited to loopback ports of registered simulator helpers; covered by a test.
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
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)
I stated the risk: what could break, for whom, and how to back it out
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) — pnpm check:changed and pnpm build:desktop pass locally; the arm64 app was packaged with electron-builder
Emulator RPCs follow the workspace's runtime, and a new emulator.tunnel carries its stream ports to this desktop over the browser tunnel framing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 routes emulator operations for a worktree to its owning runtime and adds tunnel-based forwarding for remote emulator stream endpoints to local ports. It adds endpoint validation, tunnel setup and cleanup, IPC and preload forwarding APIs, and forwarded iOS video URL resolution. Emulator tab lookup, creation, attach, input, controls, inventory, and shutdown now use the selected runtime target.
Severity of issue fixed: Medium
Merge Risk: Low · up to 07cee · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(emulator): show the paired server's simulators in remote workspaces" names the main change. The changeset routes emulator RPCs to the workspace's owning runtime, so the pane lists and c…
Description check
The description follows the repository template and fills every required section: ELI5, What Changed, Why, Linked Issue (Fixes #47447), Visual Proof with before/after images, Testing with manual two-M…
Linked Issues check
Issue #47447 requires that, in a paired-server workspace, the Mobile Emulator pane list, boot, and stream the server's simulators. The current head implements this path. Per the prior review and the P…
Out of Scope Changes check
The changes map to #47447: target routing in the renderer emulator hooks, the emulator.tunnel server RPC and its capability, the desktop tunnel transport and port forwards, the forward IPC and preload…
Full details: Title check
Explanation
The title "fix(emulator): show the paired server's simulators in remote workspaces" names the main change. The changeset routes emulator RPCs to the workspace's owning runtime, so the pane lists and controls the paired server's simulators. It also forwards stream URLs through a tunnel, which the title does not mention but does not contradict.
Full details: Description check
Explanation
The description follows the repository template and fills every required section: ELI5, What Changed, Why, Linked Issue (Fixes #47447), Visual Proof with before/after images, Testing with manual two-Mac runs and automated tests, Performance, Risk with level and back-out plan, AI Disclosure, and Checklist. The Performance section gives a reasoned answer. The Visual Proof section includes before and after images. The Review section and the Agent skill upstream boundary checkbox are present. The Level field in Risk is set to Medium. Some template comment text was left in place, but the content is complete.
Full details: Linked Issues check
Explanation
Issue #47447 requires that, in a paired-server workspace, the Mobile Emulator pane list, boot, and stream the server's simulators. The current head implements this path. Per the prior review and the PR summary, emulator RPCs (listDevices, attach, tap, gesture, button, rotate, type, checkInput, shutdown) now resolve their target through emulatorRuntimeTarget(worktreeId). The simulator tab is stamped with that host. Stream URLs are rewritten to loopback forwards through the new emulator.tunnel RPC. Video identity is keyed by the issued forwarded URL, so same-UDID devices on different runtimes do not share a stream. I read src/main/emulator/remote/emulator-runtime-stream-forwarding.ts at head. It confirms the forwarding, issued-URL tracking, isLive check for stale forwarded URLs, and resolveIosVideoStreamUrl. The retirement path on transport invalidation is also present there. Residual uncertainty: the incremental diff from the previous reviewed head could not be read because changed blobs are missing from the checkout. I could not confirm line-level changes since the prior review. Also, forwardUrl in that file calls forwards.localPortFor, while the PR summary names localPort. I did not verify the port-forwards class method name, so this is not confirmed. The prior PASS conclusion is retained.
Full details: Out of Scope Changes check
Explanation
The changes map to #47447: target routing in the renderer emulator hooks, the emulator.tunnel server RPC and its capability, the desktop tunnel transport and port forwards, the forward IPC and preload API, the video-stream resolver, and the related tests. Forward retirement on environment transport invalidation (re-pairing) is part of the remote stream path. It is a behavior that the PR text does not state explicitly, which is a documentation gap and not an unrelated change. No unrelated change was found in the files read. The incremental diff could not be read, so changes since the prior review are assessed from the head file and the PR summary only.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
101-101: Major · Functional Correctness · Heavy lift
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Include the runtime in the video-stream identity.
If two paired runtimes expose the same deviceUdid, forwarding the second runtime overwrites the first runtime's URL here. getForwardedIosVideoStreamUrl(deviceUdid) then returns the second runtime's video for both workspaces. The core resolver can also select a same-ID local device before this lookup.
Pass the runtime identity through video-stream start and lookup. Key forwarded URLs by runtime and device. Use the local bridge only for local targets. This preserves direct local streaming and separates same-ID remote devices.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4ef40111-63bf-4b89-8b72-17402df95374
Commits
Reviewing files that changed from the base of the PR and between 0010ffc and 9903d24.
Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Resolve forwarded video by the issued URL, keep forwards alive for open panes, retry failed tunnels, restrict the forward IPC, keep remote keyboards on text input, and release a remote attach whose forwarding fails.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai Addressed the outside-diff finding on emulator-runtime-stream-forwarding.ts (video-stream identity) in a109b96: startVideoStream now also passes the stream URL the pane was given, and main resolves AVCC from a forwarded URL it issued and still serves (one forward per runtime port), falling back to this host's own session only when the pane named that session's stream. Same-UDID devices on two runtimes, or on a runtime and this host, no longer share a picture.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Include streamUrl in the failure identity. · use-emulator-video-stream.ts:59
src/renderer/src/components/emulator-pane/streaming/use-emulator-video-stream.ts:59 Minor · Functional Correctness · Quick win
Include streamUrl in the failure identity.
If URL A fails, then URL B replaces it with the same deviceId and streamKey, this hook returns A's stored error for B. The new dependency restarts the effect, but both identity expressions omit streamUrl. The screen can then disable AVCC for B and use JPEG without testing B.
Include streamUrl in both identity expressions. An unchanged URL must retain its own error; a replacement URL must not inherit it.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 8ef759ec-f450-4ef5-a221-9597d579bef9
Commits
Reviewing files that changed from the base of the PR and between 9903d24 and a109b96.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
For best results, initiate chat on the files or code changes.
Analysis chain
Script executed:
#!/bin/bashset -u
printf'%s\n''--- HEAD ---'
git rev-parse HEAD
printf'%s\n''--- Named file ---'
fd -t f '^emulator-runtime-stream-forwarding\.ts$'.|while IFS= read -r file;do
ast-grep outline "$file" --items all
cat -n "$file"doneprintf'%s\n''--- Related paths ---'forfilein \
src/main/ipc/emulator/emulator-video-stream.ts \
src/main/ipc/register-core-handlers/register-core-handlers.ts \
src/renderer/src/components/emulator-pane/streaming/emulator-screen-stream-content.tsx \
src/renderer/src/components/emulator-pane/streaming/use-emulator-video-stream.ts;doif [ -f"$file" ];thenprintf'\n--- %s outline ---\n'"$file"
ast-grep outline "$file" --items all
printf'\n--- relevant matches ---\n'
rg -n -C5 'resolveIosVideoStreamUrl|registerEmulatorVideoStreamHandlers|startVideoStream|useEmulatorVideoStream|previewUrl'"$file"fidoneprintf'\n--- Relevant test references ---\n'
rg -n -C3 --glob '*test*''resolveIosVideoStreamUrl|forwardEmulatorRuntimeSession|startVideoStream|same.?UDID|stream identity' src/main/emulator src/main/ipc/emulator src/renderer/src/components/emulator-pane/streaming ||true
Length of output: 27201
Script executed:
#!/bin/bashset -u
forfilein \
src/main/emulator/remote/emulator-runtime-port-forwards.ts \
src/main/emulator/serve-sim-detached-session.ts \
src/main/ipc/emulator/emulator-video-stream.ts \
src/main/emulator/remote/emulator-runtime-port-forwards.test.ts;doif [ -f"$file" ];thenprintf'\n--- %s outline ---\n'"$file"
ast-grep outline "$file" --items all
fidoneprintf'\n--- Forward allocation and liveness ---\n'
cat -n src/main/emulator/remote/emulator-runtime-port-forwards.ts | sed -n '1,170p'printf'\n--- AVCC URL derivation ---\n'
rg -n -C12 'deriveAvccUrlFromStreamUrl' src/main/emulator/serve-sim-detached-session.ts
printf'\n--- Video subscription decision ---\n'
cat -n src/main/ipc/emulator/emulator-video-stream.ts | sed -n '35,135p'printf'\n--- Forward tests ---\n'
cat -n src/main/emulator/remote/emulator-runtime-port-forwards.test.ts | sed -n '1,180p'printf'\n--- Related tests across repository ---\n'
rg -n -i -C2 --glob '*test*''resolveIosVideoStreamUrl|forwardEmulatorRuntimeSession|issuedStreamUrls|same.?udid|stream.?identity'.||true
Length of output: 20949
@neozheng-dev Thanks for the fix. I checked the stream-identity path at the current head.
The iOS pane passes its stream URL to main. Main resolves issued forwarded URLs only while their forwards are live, and a supplied URL falls back to the local session only if it matches that session. This addresses the reported same-UDID routing concern in the code.
I did not run tests or find a direct regression test for stream identity. I recommend covering same-UDID local and remote sessions, two remote runtimes, and a stale forwarded URL.
If you found this review helpful, would you consider giving us a shout-out on X?
@coderabbitai Addressed the outside-diff finding on use-emulator-video-stream.ts:59 in e9e68eb: both failure-identity expressions now include streamUrl, so a replacement URL no longer inherits the previous URL's error, while an unchanged URL keeps its own.
For best results, initiate chat on the files or code changes.
Analysis chain
Script executed:
#!/bin/bashset -u
printf'%s\n''--- HEAD ---'
git rev-parse HEAD
printf'\n%s\n''--- Named file ---'
fd -t f '^use-emulator-video-stream\.ts$'.|while IFS= read -r file;doprintf'\n--- %s outline ---\n'"$file"
ast-grep outline "$file" --items all
printf'\n--- %s source ---\n'"$file"
cat -n "$file"doneprintf'\n%s\n''--- Relevant test references ---'
rg -n -i -C3 --glob '*test*''useEmulatorVideoStream|streamUrl.*(error|fail)|(?:error|fail).*streamUrl' src/renderer/src/components/emulator-pane ||trueprintf'\n%s\n''--- Reported commit availability ---'
git cat-file -t e9e68ebf98 2>&1||true
Length of output: 14418
@neozheng-dev Thanks for the fix. At the current head, both failure-identity expressions include streamUrl, and the effect restarts when the URL changes. A replacement URL will not display the previous URL’s error.
I did not run tests or find a direct regression test for this behavior.
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
If your project lives on another Mac that you connected to, the phone simulator panel now shows that Mac's simulators (and their live picture), not the ones on the laptop you are sitting at.
What Changed
Before: in a workspace owned by a paired server, the Mobile Emulator pane always talked to this desktop's runtime. It listed this desktop's simulators, booted them here, and streamed them from this desktop's
127.0.0.1.After: the pane follows the workspace's runtime, as the browser pane does.
attach,listDevices,tap,gesture,button,rotate,type,syncKeyboardLayout,checkInputandshutdownnow go toemulatorRuntimeTarget(worktreeId)(runtimeEnvironmentIdOrLocalUnlessTwin, the same owner lookup the browser pane uses). The simulator tab is stamped with that host, and the opening-preferences capability is read from that runtime.http://127.0.0.1:31xx/helper/<udid>/stream.mjpeg,.../stream.avcc,ws://.../ws). For a remote session the desktop now swaps them for loopback ports on this desktop that tunnel to the server:emulator.tunnel(permission: 'workspace', binary). It reusesBrowserNetworkTunnelSession(framing, window-v2 flow control, memory budget) but admits only loopback connections to ports of this host's registered simulator helpers (emulatorTunnelTargetAllowed). Advertised asemulator.tunnel.v1.EmulatorRuntimeTunnelTransportsubscribes to it withBrowserNetworkTunnelClient;EmulatorRuntimePortForwardsopens one127.0.0.1:0listener per server port and pipes each accepted socket through the tunnel. New IPCemulator:forwardRuntimeSession(trusted UI renderer only) returns the rewritten URLs. Forwards are never closed under a pane (parked panes keep working); past 64 per server, new forwards fail with an explicit error.startVideoStreamalso passes the stream URL the pane was given. Main resolves AVCC from a forwarded URL it issued and still serves, else from this host's own session only when the pane named that session's stream, so same-UDID devices on two hosts never share a picture.emulator.syncKeyboardLayoutand type through text input, because that sync applies the server's hardware layout, not this keyboard's.attach, the managed session is shut down so no simulator is left without a pane.{ kind: 'local' }, no forwarding happens, URLs are used as before.Why
The runtime side of
emulator.*already accepted paired callers; only the client hard-codedlocal, and the picture came from the wrong machine's loopback.I first tried to reuse the client-hosted browser's network route (
network.browserTunnel+ SOCKS) directly, but it needs a browser host lease and the server's native execution-host revision (which a client only learns from browser page commands), and it ishost-admin. A workspace-scopedemulator.tunnelthat reuses the same tunnel session/client classes keeps the framing and flow control, needs no browser lease, and can only reach simulator helper ports.Linked Issue
Fixes #47447
Visual Proof
Client MacBook Air, workspace on a paired MacBook Pro server:
main): the pane lists the Air's own simulators and fails withselector_not_found.Testing
Manual, two physical Macs (both macOS, Apple silicon). Server: MacBook Pro; client: MacBook Air. Both ran an arm64 build of this branch packaged side by side with the release app (own bundle id and profile), paired with
orca pair/orca environment add.lsofon the client: one new127.0.0.1forward listener; the only connections to the server were the runtime's port; nothing dialed the server's serve-sim port.Earlier, one machine, two isolated dev instances: instance A ran as the server (
orca pair --address 127.0.0.1), instance B was paired to it withorca environment addand opened A's workspace.127.0.0.1:3101.lsof: B's main process listened on a new loopback port and both B's main (AVCC/MJPEG) and B's renderer (control WebSocket) connected only to that port; only A connected to 3101.xcrun simctl io … screenshotmatched the pane.emulator.button/emulator.listfrom B returned A's session.Not tested: the Orca relay (only LAN and Tailscale), sustained motion bandwidth, Android emulators on a remote server, Linux/Windows clients.
Note for reviewers testing with
pnpm devon macOS 15+: the dev bundle lacksNSLocalNetworkUsageDescription, so it cannot reach LAN hosts (Tailscale works). That is a separate dev-tooling fix.Automated:
emulator-runtime-port-forwards.test.tscarries a real TCP connection through the real tunnel session/client to an echo server, and checks that an unregistered server port is refused (fails ifemulatorTunnelTargetAllowedadmits everything).pnpm check:changedpasses (lint, typecheck, tests, ratchets, rpc catalog).Performance
Only runs while a remote workspace shows a simulator. Each forwarded stream is one TCP stream inside one
emulator.tunnelsubscription; frames are not decoded or copied beyond the tunnel framing. iOS prefers the AVCC (H.264) stream, which is much smaller than the MJPEG fallback (numbers under Testing); sustained motion and the relay were not measured, and the MJPEG fallback may lag over a relay. Idle forwards are only loopback listeners (no traffic); at most 64 per server.Risk
Level: Medium
emulator.tunnel.v1(older build) still gets the right device list and controls, but no picture.127.0.0.1only, so local processes on the client can reach the server's simulator helper while it is shown — the same exposure a local serve-sim has today.AI Disclosure
Written with Claude Code (Claude Opus 5.5); I reviewed the change and ran the manual tests above on my own two Macs. CodeRabbit's findings are addressed in the second commit.
Review
netonly, loopback-bound; no platform branches. Simulators are macOS-only on the server anyway.orca emulatorcalls already ran on the server; unchanged.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) —pnpm check:changedandpnpm build:desktoppass locally; the arm64 app was packaged with electron-builder🤖 Generated with Claude Code