Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eb5f14b. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces an automatically enabled local-promotion workflow that changes relay connection behavior, adds background endpoint discovery and route switching, and extends authenticated DPoP use to direct origins. Its cross-cutting production impact and auth-sensitive connection changes merit human review. You can add or adjust custom eligibility rules. Learn more. |
Relay-connected environments now discover direct LAN and Tailscale routes to the same server and reconnect through them automatically, with the relay as fallback. - Server: authenticated GET /api/remote-access/endpoints (relay:read) advertises the server's own loopback/LAN/Tailscale endpoints, aware of the configured binding. Tailscale endpoint synthesis hoisted from desktop into @t3tools/tailscale and shared. - Client: while relay-connected, a scoped discovery fiber fetches advertised endpoints through the tunnel, probes direct candidates, verifies the environment id, and stores a per-environment route override. The supervisor replaces the lease without backoff and the relay broker connects through the override using the cached DPoP access token (host-independent; only per-request proofs are URL-bound). A failed direct route clears the override, starts a cooldown to prevent route flapping, and falls back to the relay in the same prepare call. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Track promotion cooldowns per endpoint so a second failed candidate does not clear the first one's cooldown (Bugbot, Macroscope). - Probe a direct route's descriptor with the 3s cached-endpoint timeout so a black-holed LAN address leaves the 15s establish budget for the relay fallback (Bugbot). - Advertise the loopback endpoint at the host the server actually binds (`::1`, `127.0.0.2`) instead of assuming 127.0.0.1, and withhold the Tailscale Serve endpoint when Serve cannot reach that binding (Macroscope). - Tag promoted direct sockets with connectionMethod=direct for the analytics field main added. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
eb5f14b to
2aa5f83
Compare
CI's typecheck fails on the Effect language service's multipleEffectProvide warning, which the new cooldown test tripped by chaining two Effect.provide calls. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
A machine with Docker or VM bridge interfaces enumerated before its physical LAN could exhaust the five-candidate cap without probing the reachable LAN address. Probes run concurrently with a 3s timeout, so the cap bought nothing. Also import the endpoint service as a module namespace to match server.ts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The relay broker only reports override failures inside prepare. A direct route that opened but died during socket setup, before readiness, or later in the session stayed installed, so every retry re-selected the same broken route instead of falling back to the relay. The supervisor now reports those failures too, which clears the override and starts its cooldown. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Problem
Connecting to an environment through T3 Connect always routes through the relay tunnel, even when your phone or laptop is sitting on the same network (or tailnet) as the environment. That means tunnel latency for traffic that could be a LAN hop away.
Solution
Relay connections now promote themselves to a direct connection when one exists, and fall back to the relay when it stops working.
GET /api/remote-access/endpointsroute (relay:readscope), aware of what it is actually bound to. A loopback-only server advertises nothing promotable.environmentIdbefore trusting it.@t3tools/tailscaleso desktop and server advertise identicaltailscale-ip:/tailscale-magicdns:endpoint ids.Browser-hosted HTTPS clients can only promote to HTTPS endpoints (mixed-content rules); that falls out of the probe failing rather than special-cased platform logic. Desktop and mobile can promote to plain LAN HTTP endpoints.
Status
Warning
Theo has not tested this yet. Rebased onto main on 2026-09-01 and the four Bugbot/Macroscope findings (per-endpoint cooldowns, 3s direct probe timeout, IPv6 loopback host, Serve reachability) are fixed with regression tests in 2aa5f83. Typechecks, lint, and the focused test suites pass (promotion candidate selection, resolver direct-route + fallback, supervisor lease replacement, server endpoint resolution across binding modes), but no one has verified the end-to-end promotion flow against a real relay-connected environment.
Built by Claude Fable 5.1 via Claude Code.
🤖 Generated with Claude Code
Note
Medium Risk
Touches connection establishment, DPoP authorization, and background lease replacement; mis-probed or stale advertised endpoints could cause extra reconnects, though descriptor checks and cooldowns limit ping-ponging.
Overview
Relay-connected environments can switch to LAN or tailnet routes automatically when the server advertises reachable direct endpoints and probes confirm the same
environmentId.The server adds
GET /api/remote-access/endpoints(relay:read), backed byServerAdvertisedEndpoints, which lists only addresses the process actually listens on (loopback vs wildcard vs specific bind, Tailscale Serve reachability, IPv6 loopback). Tailscale endpoint synthesis moves into@t3tools/tailscalewith asourcefield so desktop and server share stabletailscale-ip:/tailscale-magicdns:ids; desktop drops its local provider import.On the client,
ConnectionPromotionfetches that list over the tunnel, ranks LAN over private-network candidates, probes with short timeouts, and stores an in-memory override. The relay resolver triesauthorizeDpopDirect(cached DPoP token, fresh proofs per origin) before bootstrap; failures clear the override, apply per-endpoint cooldowns, and fall back in the same prepare. The supervisor rediscovers on an interval and reconnects viaPromoteRequestedwithout backoff when a better route appears.Reviewed by Cursor Bugbot for commit 2db8ba7. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add automatic local connection promotion for T3 Connect relay environments
ServerAdvertisedEndpointsservice and aGET /api/remote-access/endpointsAPI that returns addresses compatible with the server's binding mode, classified by reachability (LAN, private-network, public), with a 60-second cacheConnectionPromotionservice that fetches advertised endpoints through the current relay connection, filters and ranks candidates (LAN first), probes them concurrently with a 3-second descriptor timeout, and stores the selected route override per environmentauthorizeDpopDirecttoRemoteEnvironmentAuthorizationwhich authorizes via a cached DPoP token against a direct endpoint, rejecting missing or near-expiry credentials withConnectionTransientErrorEnvironmentSupervisornow periodically discovers direct routes (every 3 minutes viaPROMOTION_REDISCOVERY_INTERVAL) for connected DPoP-authenticated relay sessions, signalsPromoteRequestedto replace the relay lease without backoff, and reports failed promoted routes to clear the override and fall back to relay@t3tools/tailscalepackage and adds a requiredsourceparameter to endpoint resolutionConnectionResolver.makeRelayBrokernow attempts direct authorization through a stored override before relay bootstrap; any direct failure reports the override and falls back to relay in the same prepare call. Failed endpoints enter a 5-minute cooldown inConnectionPromotion.make. Promotion discovery only runs for relay targets with DPoP-authenticated active connections; non-relay and non-DPoP sessions are unaffected.Macroscope summarized 2db8ba7.