Repository navigation
fix: direct routes come before forwarded tunnels - #83
nullStack65 merged 2 commits into
Conversation
A saved bearer route to a loopback address, such as a `cloudflared access tcp` forward, now has its own "forward" kind and ranks with public routes, behind LAN and Tailscale. Routes for servers on this device keep the "loopback" kind: the primary target and desktop-local backends registered under the `local:` connection id prefix. Forwards keep loopback's trust rules and show as "Forwarded". Model: claude-opus-5-5 Task: fix Agent: claude-code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bot review round 1 (Claude Opus 5.5, independent) @ 5636f45Verdict: non-blocking. The fix is correct. It is small and matches the reported bug. Trust handling is unchanged. The failover test does prove the full sequence. My findings are a missed instance of the same "loopback answers quickly" assumption, an overclaim in the PR description, and a few nits. Pinned: base What I checked and found sound
Findings (most severe first)
What I ran
|
The descriptor check before connecting still used the 3-second loopback timeout for a forwarded route, judged by its 127.0.0.1 address. A cloudflared tunnel that takes longer to open then failed the connect. The bearer broker now passes the route kind, so a forward waits as long as a remote address. Review round 1 finding 1. Model: claude-opus-5-5 Task: fix Agent: claude-code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Repair round 1 @ 33b265aFixes for the round 1 review (#83 (comment)):
Ran: |
|
Fleet build artifacts from
|
The desktop app reaches some machines through a
cloudflared access tcpforward on a laptop port such ashttp://127.0.0.1:23780. Route ranking called that route "loopback", which ranks first. So when the app learned the machine's Tailscale or LAN route, it put that route behind the tunnel and never moved off the tunnel.Fix
connectionRouteKindnow returns a newforwardkind for aBearerConnectionTargetwith a loopback address, unless that route belongs to a desktop-local backend.forwardranks withpublic(3), behind LAN (1) and Tailscale/VPN (2) and ahead of SSH and T3 Connect. A newly learned direct route is now placed ahead of the forward, and the supervisor's existing better-route check moves the connection to it.PrimaryConnectionTargetand keepsloopback. Desktop-local secondary backends such as WSL uselocal:-prefixed connection IDs. That prefix now comes fromclient-runtimeso web and the route kind share one constant, and those backends also keeploopback. Desktopssh -Lroutes areSshConnectionTargetand keepssh. Platform environments shadow user-saved entries for the same environment and never learn routes. So a user-saved bearer loopback route on desktop is a forward to another machine.routeKeepsItsHosttreatsforwardlikeloopback.tokenAllowsPlainHttpstill excludes it, so a forward's token is not sent over plain-HTTP LAN.arrow.left.arrow.righticon in its kind-to-icon map.insertRoute(new paired or learned routes) uses rank. Saved or dragged orders are never re-sorted.docs/user/remote-access.md, "Reach one machine several ways".Tests
supervisor.test.tscase runs the failover scenario on synthetic routes, usingTestClockand wakeups with no wall-clock waits:127.0.0.1:23780). The server reports a Tailscale endpoint, andmergeLearnedRoutessaves the order Tailscale, then Forwarded. The connection moves to Tailscale (generation 2).network-changedwakeup moves the connection back to Tailscale (generation 4).routes.test.tscases cover: forward vs. desktop-local vs. primary classification, the label,routeKeepsItsHost, insertion order, and that a saved order is not rearranged.vp test runonroutes.test.ts,supervisor.test.tsandregistry.test.ts: 144 passed.packages/client-runtime,apps/webandapps/mobile. Lint and format checks pass on the touched files.Known limits
app.t3.codes, mobile), a bearer route to localhost that really is this device is also labeled "Forwarded". It ranks behind learned HTTPS or Tailscale routes to the same server, which still connect.localhost(anothernpx t3, a dev worktree server, a Docker port), and to the iOS Simulator reaching the Mac. It is labeled "Forwarded", gets the slower health checks, and may connect to itself over Tailscale. Trust rules are unchanged.connection.routetelemetry value is now "forward" for these routes, not "loopback".authorization/layer.test.ts).Model: claude-opus-5-5
Task: fix
🤖 Generated with Claude Code