Repository navigation
Description
Version: Plannotator 0.28.27 (Pi extension; same code path in the CLI). Agent on a remote Linux machine, browser on a Mac (and an iPhone for the second proposal).
Use case: I run Pi with Plannotator on a remote dev machine and review from my laptop. Remote mode is off: everything binds loopback, and an SSH forward of a fixed range (PLANNOTATOR_PORT=19432-19439, plus my app ports) makes http://localhost:19432 on the laptop reach the remote machine. Plans, code review, annotate-last and HTML files all work this way, and Ask this session stays on.
Live app annotation does not. /plannotator-annotate http://localhost:5173 opens the editor, but the frame stays empty (the browser's broken-page icon).
Why: the live proxy binds a port the OS picks (listen(0, "127.0.0.1") in packages/shared/live-proxy-node.ts, port: 0 in packages/server/live-proxy.ts), and the editor frames http://localhost:<that port>/ (buildLiveAppUrl in packages/shared/live-proxy-core.ts). On Linux that port comes from 32768–60999 and changes every session, so it cannot be forwarded ahead of time. The editor at localhost:19432 arrives through the forward; the frame's localhost:<random port> hits the laptop itself.
Repro
- Remote machine, remote mode off:
PLANNOTATOR_PORT=19432-19439, and any page onpython3 -m http.server 5173 --bind 127.0.0.1. - Laptop:
ssh -L 19432:127.0.0.1:19432 -L 5173:127.0.0.1:5173 <remote>. - In Pi on the remote:
/plannotator-annotate http://localhost:5173, then openhttp://localhost:19432on the laptop.
Expected: the app in the frame. Actual: an empty frame. The frame points at http://localhost:41535/ (a random port); the proxy answers there with frame-ancestors http://localhost:19432 http://127.0.0.1:19432.
Proposal
- Let the live proxy use a fixed port or range, for example
PLANNOTATOR_LIVE_PORT=19440-19447(same syntax and busy-port fallback asPLANNOTATOR_PORT, Handle remote multi-session port conflicts with port-range fallback #437). The proxy still binds127.0.0.1, with the same Host and Origin checks and the sameframe-ancestors. Remote mode's hard-off (feat(annotate): live local app annotation through a loopback reverse proxy #1352) stays as it is. The user forwards that range next to the editor's, and live annotation works over SSH, VS Code Remote, or any local port forward. - Optional, for forwards that change the host name: when the editor is opened at a host already allowed through
PLANNOTATOR_ALLOWED_HOSTS(for example a tailnet name that a user-run forwarder maps to loopback), build the frame URL fromlocation.hostnameinstead oflocalhost, and add that origin to the proxy'sframe-ancestorsand Host check. The proxy still binds loopback; reaching it stays the user's own forward. This is what a phone needs, wherelocalhostcan never mean the remote machine. I understand it touches the live proxy's security contract, so (1) alone already solves the SSH-forward case.
I can send a PR for (1) if the shape works for you.
Activity
backnotprop commentedon Oct 23, 2026
Thanks for the detailed report. We reproduced it with a simulated SSH forward and confirmed the fix. Please go ahead with a PR for (1),
PLANNOTATOR_LIVE_PORTwith the same syntax and busy-port fallback asPLANNOTATOR_PORT, used by both the Bun and Node proxies, still bound to 127.0.0.1 with the same checks. A few things we'd like in it:PLANNOTATOR_REMOTE=0We'll hold off on (2).
backnotprop commentedon Oct 24, 2026
Fixed in #2145.