Repository navigation
[Bug]: Connections settings cannot detect or repair a relay link that drifted to publish-only (toggle shows on, relink is a no-op, mobile gets endpoint_provider_not_managed) #11899
Description
Activity
Triage
Confirmed on
main. This is a real recovery bug, not a duplicate of #11898 or #6568.What the UI is looking at
useCloudLinkControlleronly (re)links when local state disagrees with the desired toggles:if (!linked || managedTunnelActive !== desired.managedTunnel) { await linkPrimaryEnvironment({ mode: desired.managedTunnel ? "managed" : "publish_only" }); }
managedTunnelActivecomes fromreadCloudLinkState(apps/server/src/cloud/http.ts) and is just “doescloud-endpoint-runtime-configexist?”. It never consults the relay’sendpoint.providerKind.So if the relay row is
manual(publish-only) and the local runtime-config secret is still present, Settings → Connections shows T3 Connect on, and turning it on again is a no-op. There is no Repair/Re-link action.Account → T3 Connect already labels the relay view (
cloudflare_tunnel→ “Managed tunnel”, else “Activity publishing only”) inT3ConnectUserProfilePage/ mobileT3ConnectProfilePage. Connections does not use that.Why off → on does not recover while Publish is on
wantsLink = desired.managedTunnel || desired.publishis intentional: T3 Connect off + Publish on relinks aspublish_onlyinstead of unlinking (toast: “The managed tunnel was removed. Agent activity publishing stays on.”). The only combination that actually unlinks is both off, which is why the workaround works.Why mobile is a dead end
EnvironmentConnector.resolveManagedEndpointrejects any non-cloudflare_tunnellink withendpoint_provider_not_managed. Shared copy inpackages/client-runtime/src/relay/errorPresentation.tsalready special-casesenvironment_link_not_found, but this reason falls through to:Relay rejected the environment connection request (endpoint_provider_not_managed).That matches the iOS / Android reports and does not tell the user to repair the desktop link.
How you get here
- [Bug]: applyCloudRelayConfig is not atomic; a failed secret write after the relay link is committed leaves the environment stuck on endpoint_provider_not_managed #11898: relay upsert commits, then a later local secret write fails (Windows AV/
EPERMis a documented path). - [Bug]: T3 Connect environment is discoverable but relay connection is unauthorized (endpoint_provider_not_managed) #6568 comment: tunnel logout/login after
environment_link_not_found. - Restoring
cloud-endpoint-runtime-config.binafter a publish-only relink (the in-issue repro).
Related
- [Bug]: applyCloudRelayConfig is not atomic; a failed secret write after the relay link is committed leaves the environment stuck on endpoint_provider_not_managed #11898 — companion, server-side non-atomic apply (how drift is created). Keep separate.
- [Bug]: T3 Connect environment is discoverable but relay connection is unauthorized (endpoint_provider_not_managed) #6568 — broader stuck-state / mobile failure. This issue is the desktop “cannot see or fix it” slice; do not close [Bug]: T3 Connect environment is discoverable but relay connection is unauthorized (endpoint_provider_not_managed) #6568 on this alone.
- [Bug]: T3 Connect switch stays off after startup restores the tunnel #6628 — opposite UI lie (toggle stays off after startup restore). Same atom, different bug.
- fix(web): refresh T3 Connect switch after startup reconcile #7193 — closed, unmerged [Bug]: T3 Connect switch stays off after startup restores the tunnel #6628 refresh; would not fix this.
- No open/merged PR for this recovery gap.
Suggested fix (keep #11898 as the apply-atomicity follow-up)
- Compare local
managedTunnelActiveto relayendpoint.providerKind(discovery /useManagedRelayEnvironmentsalready has it) and surface “T3 Connect is out of sync”. - Add a Repair / Re-link control that always runs
linkPrimaryEnvironment({ mode: "managed" }). - When turning T3 Connect off while Publish stays on, say that the link becomes publish-only and that a full unlink needs Publish off as well.
- Map
endpoint_provider_not_managedinerrorPresentation.tsto actionable desktop copy (same pattern asenvironment_link_not_found).
Workaround (verified in-issue): Settings → Connections: Publish off → T3 Connect off → T3 Connect on → Publish on.
Severity: major bug (environment discoverable, not connectable; obvious toggle path cannot repair).
- [Bug]: applyCloudRelayConfig is not atomic; a failed secret write after the relay link is committed leaves the environment stuck on endpoint_provider_not_managed #11898: relay upsert commits, then a later local secret write fails (Windows AV/
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.acceptedfeature request acceptedfeature request acceptedvia-triageFiled through npx t3 triageFiled through npx t3 triage
on Sep 15, 2026
Before submitting
Area
apps/web
Steps to reproduce
Companion to #11898 (non-atomic relay-config apply) and to #6568. That issue is about how relay and desktop get out of sync. This one is about the desktop not being able to see it or fix it once it has happened.
Why the UI cannot recover
useCloudLinkController(apps/web/src/cloud/useCloudLinkController.ts) decides whether to relink like this:managedTunnelActivecomes fromreadCloudLinkStateon the local environment server, which is justOption.isSome(secrets.get(CLOUD_ENDPOINT_RUNTIME_CONFIG)). It never consults what the relay actually holds for this environment (endpoint.providerKindon the/v1/client/environmentsrecord). So when the relay saysmanualand the local secret says managed, the toggle already renders as "on" and switching it on again is a no-op. The user has no action that rewrites the relay record short of knowing to unlink completely first.Two smaller things in the same area make this harder to get out of:
publish_onlymode (ConnectionsSettings.tsx,updateManagedTunnel, toast text "The managed tunnel was removed. Agent activity publishing stays on."). That is documented in the code comments, so it is intentional, but the UI does not say that the only way to get a fresh managed link is to turn publishing off first.Relay rejected the environment connection request (endpoint_provider_not_managed), which gives the user nothing to act on. The relay's own reason text is "the linked endpoint is not relay-managed" (EnvironmentConnector.ts,describeReason), which is closer, but neither says "the desktop linked this environment in publish-only mode, turn T3 Connect on there".Repro
manual, localcloud-endpoint-runtime-configpresent). The quickest way without simulating a write failure: link in managed mode, then with a copy ofcloud-endpoint-runtime-config.binsaved aside, turn T3 Connect off while publishing is on, then restore the saved file and restart T3 Code. Local now says managed, relay says manual.manualif publishing was on for the "off" step. (If publishing was off, this sequence does work, which is the workaround.)endpoint_provider_not_managed.Expected behavior
managedTunnelActive(or a sibling field) should reflect the relay's view of the link, not only the presence of a local secret.refreshRelayEnvironmentsalready fetches the environment list includingendpoint.providerKind; comparing that against the local runtime config and surfacing "T3 Connect is out of sync, re-link" would be enough.endpoint_provider_not_managedon mobile (and in the desktop connections list) to text that says what to do on the desktop.Actual behavior
The toggle shows on, toggling does nothing to the relay record, and the environment stays discoverable but unconnectable from mobile until the user discovers the publish-off, tunnel-off, tunnel-on sequence. #6568 and its comment show two other users hitting the same wall, one of them after an
environment_link_not_foundand a tunnel logout/login, so this is not only reachable via the write-failure path.Impact
Major degradation or frequent failure
Version or commit
Desktop 0.0.40 (release channel). Code references are against
mainas of 2026-09-15.Environment
Windows 11 Home 10.0.26200, T3 Code desktop 0.0.40, iOS T3 Code app.
Logs or stack traces
Workaround
Settings > Connections: turn Publish agent activity off, turn T3 Connect off, turn T3 Connect on, turn publishing back on. Verified working on 2026-09-15: all six
cloud-*secrets were rewritten together, cloudflared restarted, and the mobile app connected on the next attempt.