From b62a17c3f4e374d69964ff2a5047c71b52028e48 Mon Sep 17 00:00:00 2001 From: ishaanko Date: Fri, 23 Oct 2026 15:35:09 -0700 Subject: [PATCH 1/7] fix(connect): reclaim a T3 Connect tunnel routed to another local port The relay routes a managed tunnel to the origin its environment registered last. When another process with the same environment credentials registers its own port and exits, the server that owns the tunnel keeps a healthy connector whose every request fails with "connection refused" on the dead port. Nothing re-registered until the server restarted. The owner now reads the ingress cloudflared received every minute. When it names an origin other than the one this server listens on, the server registers its origin again. Repeated mismatches back off to 30 minutes so a relay that cannot fix it is not asked every minute. --- .../src/cloud/ConnectReachability.test.ts | 23 +++++- .../src/cloud/ManagedEndpointRuntime.ts | 22 ++++- .../src/cloud/managedTunnelStartup.test.ts | 80 ++++++++++++++++++- apps/server/src/cloud/managedTunnelStartup.ts | 55 +++++++++++++ apps/server/src/server.ts | 8 ++ 5 files changed, 180 insertions(+), 8 deletions(-) diff --git a/apps/server/src/cloud/ConnectReachability.test.ts b/apps/server/src/cloud/ConnectReachability.test.ts index 28735b87378f7..aa12c8ce8ac76 100644 --- a/apps/server/src/cloud/ConnectReachability.test.ts +++ b/apps/server/src/cloud/ConnectReachability.test.ts @@ -7,8 +7,13 @@ import { describe, expect, it } from "@effect/vitest"; import { classifyReachability, type ReachabilityFacts } from "./ConnectReachability.ts"; const checkedAt = "2026-10-19T00:00:00.000Z"; -const connected = { readyConnections: 4, hostname: "env.example.test", protocol: "quic" }; -const notConnected = { readyConnections: 0, hostname: null, protocol: null }; +const connected = { + readyConnections: 4, + hostname: "env.example.test", + origin: null, + protocol: "quic", +}; +const notConnected = { readyConnections: 0, hostname: null, origin: null, protocol: null }; const facts = (overrides: Partial): ReachabilityFacts => ({ managedTunnelConfigured: true, connector: connected, @@ -40,7 +45,12 @@ describe("classifyReachability", () => { expect( classifyReachability( facts({ - connector: { readyConnections: null, hostname: "env.example.test", protocol: null }, + connector: { + readyConnections: null, + hostname: "env.example.test", + origin: null, + protocol: null, + }, endpoint: { kind: "status", status: 502 }, edgeReachable: false, }), @@ -51,7 +61,12 @@ describe("classifyReachability", () => { expect( classifyReachability( facts({ - connector: { readyConnections: null, hostname: "env.example.test", protocol: null }, + connector: { + readyConnections: null, + hostname: "env.example.test", + origin: null, + protocol: null, + }, endpoint: { kind: "dns_failed" }, edgeReachable: false, }), diff --git a/apps/server/src/cloud/ManagedEndpointRuntime.ts b/apps/server/src/cloud/ManagedEndpointRuntime.ts index 2bc742a170637..96e3b9253d3db 100644 --- a/apps/server/src/cloud/ManagedEndpointRuntime.ts +++ b/apps/server/src/cloud/ManagedEndpointRuntime.ts @@ -48,6 +48,8 @@ export interface ConnectorFacts { readonly readyConnections: number | null; /** The public tunnel hostname from the remote config cloudflared receives once it connects. */ readonly hostname: string | null; + /** The local origin that remote config routes the public hostname to. */ + readonly origin: string | null; readonly protocol: string | null; } @@ -107,7 +109,14 @@ const ConnectorReadyBody = Schema.Struct({ readyConnections: Schema.Number }); const ConnectorConfigBody = Schema.Struct({ config: Schema.Struct({ ingress: Schema.optional( - Schema.NullOr(Schema.Array(Schema.Struct({ hostname: Schema.optional(Schema.String) }))), + Schema.NullOr( + Schema.Array( + Schema.Struct({ + hostname: Schema.optional(Schema.String), + service: Schema.optional(Schema.String), + }), + ), + ), ), }), }); @@ -766,7 +775,12 @@ export const make = Effect.gen(function* () { } const protocol = yield* Ref.get(active.protocol); if (!(yield* Deferred.isDone(active.metricsAddress))) { - return { readyConnections: null, hostname: null, protocol } satisfies ConnectorFacts; + return { + readyConnections: null, + hostname: null, + origin: null, + protocol, + } satisfies ConnectorFacts; } const metricsUrl = `http://${yield* Deferred.await(active.metricsAddress)}`; const [ready, config] = yield* Effect.all( @@ -776,9 +790,11 @@ export const make = Effect.gen(function* () { ], { concurrency: 2 }, ); + const hostnameRule = config?.config.ingress?.find((rule) => rule.hostname); return { readyConnections: ready?.readyConnections ?? null, - hostname: config?.config.ingress?.find((rule) => rule.hostname)?.hostname ?? null, + hostname: hostnameRule?.hostname ?? null, + origin: hostnameRule?.service ?? null, protocol, } satisfies ConnectorFacts; }); diff --git a/apps/server/src/cloud/managedTunnelStartup.test.ts b/apps/server/src/cloud/managedTunnelStartup.test.ts index fbf4fc452c256..1468d33026999 100644 --- a/apps/server/src/cloud/managedTunnelStartup.test.ts +++ b/apps/server/src/cloud/managedTunnelStartup.test.ts @@ -1,7 +1,12 @@ import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; +import * as Fiber from "effect/Fiber"; +import * as TestClock from "effect/testing/TestClock"; -import { retryManagedTunnelRegistration } from "./managedTunnelStartup.ts"; +import { + retryManagedTunnelRegistration, + watchManagedTunnelOrigin, +} from "./managedTunnelStartup.ts"; describe("retryManagedTunnelRegistration", () => { it.effect("does not fall back or retry when registration is permanently rejected", () => @@ -26,3 +31,76 @@ describe("retryManagedTunnelRegistration", () => { }), ); }); + +describe("watchManagedTunnelOrigin", () => { + const localOrigin = "http://127.0.0.1:3773"; + + /** Runs the watcher for `minutes`, serving each check the next ingress in `ingress`. */ + const watch = (input: { + readonly ingress: ReadonlyArray; + readonly minutes: number; + readonly failRegistration?: boolean; + }) => + Effect.gen(function* () { + let checks = 0; + const registeredAtMinute: Array = []; + let minute = 0; + const fiber = yield* watchManagedTunnelOrigin({ + localOrigin, + readIngressOrigin: Effect.sync( + () => input.ingress[Math.min(checks++, input.ingress.length - 1)] ?? null, + ), + register: Effect.suspend(() => { + registeredAtMinute.push(minute); + return input.failRegistration ? Effect.fail("relay unavailable") : Effect.void; + }), + }).pipe(Effect.forkChild); + for (; minute < input.minutes;) { + minute += 1; + yield* TestClock.adjust("1 minute"); + } + yield* Fiber.interrupt(fiber); + return { checks, registeredAtMinute }; + }); + + it.effect("registers this server again when the ingress names another local port", () => + Effect.gen(function* () { + const result = yield* watch({ + ingress: ["http://127.0.0.1:46169", localOrigin], + minutes: 5, + }); + expect(result.registeredAtMinute).toEqual([1]); + }), + ); + + it.effect("leaves a matching or unknown ingress alone", () => + Effect.gen(function* () { + const result = yield* watch({ + ingress: [null, `${localOrigin}/`, localOrigin], + minutes: 5, + }); + expect(result.checks).toBe(5); + expect(result.registeredAtMinute).toEqual([]); + }), + ); + + it.effect("keeps checking after a failed registration", () => + Effect.gen(function* () { + const result = yield* watch({ + ingress: ["http://127.0.0.1:46169", "http://127.0.0.1:46169", localOrigin], + minutes: 8, + failRegistration: true, + }); + expect(result.registeredAtMinute).toEqual([1, 3]); + // Minutes 1, 3, and 7; the match at 7 restores the one-minute interval. + expect(result.checks).toBe(4); + }), + ); + + it.effect("backs off while the relay keeps routing elsewhere", () => + Effect.gen(function* () { + const result = yield* watch({ ingress: ["http://127.0.0.1:46169"], minutes: 20 }); + expect(result.registeredAtMinute).toEqual([1, 3, 7, 15]); + }), + ); +}); diff --git a/apps/server/src/cloud/managedTunnelStartup.ts b/apps/server/src/cloud/managedTunnelStartup.ts index a3eb6df24a6a7..9d42331eb5518 100644 --- a/apps/server/src/cloud/managedTunnelStartup.ts +++ b/apps/server/src/cloud/managedTunnelStartup.ts @@ -1,4 +1,5 @@ import type { RelayManagedEndpointRuntimeConfig } from "@t3tools/contracts/relay"; +import * as Cause from "effect/Cause"; import * as Clock from "effect/Clock"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; @@ -216,3 +217,57 @@ export const makeManagedTunnelRecovery = Effect.fn("ManagedTunnelRecovery.make") ), ); }); + +const MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL = Duration.minutes(1); + +const sameOrigin = (left: string, right: string) => { + try { + return new URL(left).origin === new URL(right).origin; + } catch { + return false; + } +}; + +/** + * The relay routes the tunnel to the origin this environment registered last. + * Only the server that owns the T3 home runs the connector, so an ingress that + * names any other origin is stale: a process with this environment's + * credentials registered its own port, then went away, and every request now + * fails with connection refused. Checks the connector's ingress every minute + * and registers this server's origin again when it points elsewhere. While the + * mismatch persists, each attempt doubles the wait, up to 30 minutes, so a + * relay that cannot fix it is not asked every minute. + */ +export const watchManagedTunnelOrigin = Effect.fn("ManagedTunnelOrigin.watch")(function* < + E, + R, +>(options: { + readonly localOrigin: string; + /** The service URL cloudflared routes the public hostname to, or `null` while unknown. */ + readonly readIngressOrigin: Effect.Effect; + readonly register: Effect.Effect; +}) { + let wait = MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL; + while (true) { + yield* Effect.sleep(wait); + const ingressOrigin = yield* options.readIngressOrigin; + if (ingressOrigin === null || sameOrigin(ingressOrigin, options.localOrigin)) { + wait = MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL; + continue; + } + yield* Effect.logWarning( + "T3 Connect routes this server's tunnel to another origin; registering this server again", + { ingressOrigin, localOrigin: options.localOrigin }, + ); + yield* options.register.pipe( + Effect.catchCause((cause) => + Cause.hasInterrupts(cause) + ? Effect.interrupt + : Effect.logWarning("Failed to register this server's T3 Connect origin again", { + cause, + }), + ), + ); + wait = Duration.min(Duration.times(wait, 2), MANAGED_TUNNEL_RECOVERY_MAX_COOLDOWN); + } +}); diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts index 403b30af1c719..d4e8de219636f 100644 --- a/apps/server/src/server.ts +++ b/apps/server/src/server.ts @@ -151,6 +151,7 @@ import { managedTunnelStartupAction, retryDesiredLinkReconcile, retryManagedTunnelRegistration, + watchManagedTunnelOrigin, } from "./cloud/managedTunnelStartup.ts"; import * as CloudCliTokenManager from "./cloud/CliTokenManager.ts"; import * as CloudCliState from "./cloud/CliState.ts"; @@ -893,6 +894,13 @@ const layerMakeServer = Layer.unwrap( Stream.runForEach(recoverManagedTunnel), Effect.forkScoped, ); + yield* watchManagedTunnelOrigin({ + localOrigin, + readIngressOrigin: endpointRuntime.inspectConnector.pipe( + Effect.map((connector) => connector?.origin ?? null), + ), + register: cloudLink.registerManagedTunnelRecovery(localOrigin), + }).pipe(Effect.forkScoped); const wantsCliLink = hasCloudPublicConfig ? yield* CloudCliState.readCliDesiredCloudLink.pipe( Effect.catch((cause) => From 48c01549452cb78258e1e8ca48d7178506bcdd0a Mon Sep 17 00:00:00 2001 From: ishaanko Date: Fri, 23 Oct 2026 22:55:37 -0700 Subject: [PATCH 2/7] fix(connect): keep origin backoff on unreadable ingress and forward recovery_required The origin watcher reset its backoff whenever the connector config could not be read, logged the raw ingress URL, and dropped a recovery_required registration instead of requesting tunnel recovery like the other registration callers. --- .../src/cloud/managedTunnelStartup.test.ts | 10 ++++++++++ apps/server/src/cloud/managedTunnelStartup.ts | 16 ++++++++++------ apps/server/src/server.ts | 10 +++++++++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/apps/server/src/cloud/managedTunnelStartup.test.ts b/apps/server/src/cloud/managedTunnelStartup.test.ts index 1468d33026999..cef817e7af6cc 100644 --- a/apps/server/src/cloud/managedTunnelStartup.test.ts +++ b/apps/server/src/cloud/managedTunnelStartup.test.ts @@ -103,4 +103,14 @@ describe("watchManagedTunnelOrigin", () => { expect(result.registeredAtMinute).toEqual([1, 3, 7, 15]); }), ); + + it.effect("keeps the backoff when one check cannot read the ingress", () => + Effect.gen(function* () { + const result = yield* watch({ + ingress: ["http://127.0.0.1:46169", null, "http://127.0.0.1:46169"], + minutes: 10, + }); + expect(result.registeredAtMinute).toEqual([1, 5, 9]); + }), + ); }); diff --git a/apps/server/src/cloud/managedTunnelStartup.ts b/apps/server/src/cloud/managedTunnelStartup.ts index 9d42331eb5518..4c2287e2bb1c4 100644 --- a/apps/server/src/cloud/managedTunnelStartup.ts +++ b/apps/server/src/cloud/managedTunnelStartup.ts @@ -220,11 +220,11 @@ export const makeManagedTunnelRecovery = Effect.fn("ManagedTunnelRecovery.make") const MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL = Duration.minutes(1); -const sameOrigin = (left: string, right: string) => { +const urlOrigin = (url: string) => { try { - return new URL(left).origin === new URL(right).origin; + return new URL(url).origin; } catch { - return false; + return null; } }; @@ -247,17 +247,21 @@ export const watchManagedTunnelOrigin = Effect.fn("ManagedTunnelOrigin.watch")(f readonly readIngressOrigin: Effect.Effect; readonly register: Effect.Effect; }) { + const localOrigin = urlOrigin(options.localOrigin); let wait = MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL; while (true) { yield* Effect.sleep(wait); - const ingressOrigin = yield* options.readIngressOrigin; - if (ingressOrigin === null || sameOrigin(ingressOrigin, options.localOrigin)) { + const ingress = yield* options.readIngressOrigin; + // An unreadable ingress says nothing, so it keeps whatever backoff is running. + if (ingress === null) continue; + const ingressOrigin = urlOrigin(ingress); + if (ingressOrigin !== null && ingressOrigin === localOrigin) { wait = MANAGED_TUNNEL_ORIGIN_CHECK_INTERVAL; continue; } yield* Effect.logWarning( "T3 Connect routes this server's tunnel to another origin; registering this server again", - { ingressOrigin, localOrigin: options.localOrigin }, + { ingressOrigin: ingressOrigin ?? "unparseable", localOrigin }, ); yield* options.register.pipe( Effect.catchCause((cause) => diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts index d4e8de219636f..1be324334ec12 100644 --- a/apps/server/src/server.ts +++ b/apps/server/src/server.ts @@ -899,7 +899,15 @@ const layerMakeServer = Layer.unwrap( readIngressOrigin: endpointRuntime.inspectConnector.pipe( Effect.map((connector) => connector?.origin ?? null), ), - register: cloudLink.registerManagedTunnelRecovery(localOrigin), + register: cloudLink + .registerManagedTunnelRecovery(localOrigin) + .pipe( + Effect.flatMap((registration) => + registration.status === "recovery_required" + ? endpointRuntime.requestRecovery(registration.config) + : Effect.void, + ), + ), }).pipe(Effect.forkScoped); const wantsCliLink = hasCloudPublicConfig ? yield* CloudCliState.readCliDesiredCloudLink.pipe( From f60d15fcba5391a6f0bde5c3578ee8dd32dc2ef7 Mon Sep 17 00:00:00 2001 From: ishaanko Date: Fri, 23 Oct 2026 23:14:40 -0700 Subject: [PATCH 3/7] fix(connect): origin watcher skips re-registration for publish-only links Startup never registers a managed tunnel for a publish-only CLI link, so the watcher must not route the tunnel to this host either. --- apps/server/src/server.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts index 1be324334ec12..93dfd789d3f13 100644 --- a/apps/server/src/server.ts +++ b/apps/server/src/server.ts @@ -899,15 +899,22 @@ const layerMakeServer = Layer.unwrap( readIngressOrigin: endpointRuntime.inspectConnector.pipe( Effect.map((connector) => connector?.origin ?? null), ), - register: cloudLink - .registerManagedTunnelRecovery(localOrigin) - .pipe( - Effect.flatMap((registration) => - registration.status === "recovery_required" - ? endpointRuntime.requestRecovery(registration.config) - : Effect.void, - ), + // Like startup, a publish-only link never routes the tunnel to this host. + register: CloudCliState.readCliDesiredLinkMode.pipe( + Effect.flatMap((mode) => + mode === "publish_only" + ? Effect.void + : cloudLink + .registerManagedTunnelRecovery(localOrigin) + .pipe( + Effect.flatMap((registration) => + registration.status === "recovery_required" + ? endpointRuntime.requestRecovery(registration.config) + : Effect.void, + ), + ), ), + ), }).pipe(Effect.forkScoped); const wantsCliLink = hasCloudPublicConfig ? yield* CloudCliState.readCliDesiredCloudLink.pipe( From 050de0bd9e2184474f3033908e951b5db0e8eda1 Mon Sep 17 00:00:00 2001 From: ishaanko Date: Mon, 26 Oct 2026 12:19:38 -0700 Subject: [PATCH 4/7] fix(connect): fit main's comment cap and connector fixture --- apps/server/src/cloud/managedTunnelStartup.ts | 11 +++-------- apps/server/src/guest/GuestShareService.test.ts | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/server/src/cloud/managedTunnelStartup.ts b/apps/server/src/cloud/managedTunnelStartup.ts index 8b8c9d9791ea2..ed7dd7aa4d8eb 100644 --- a/apps/server/src/cloud/managedTunnelStartup.ts +++ b/apps/server/src/cloud/managedTunnelStartup.ts @@ -225,14 +225,9 @@ const urlOrigin = (url: string) => { }; /** - * The relay routes the tunnel to the origin this environment registered last. - * Only the server that owns the T3 home runs the connector, so an ingress that - * names any other origin is stale: a process with this environment's - * credentials registered its own port, then went away, and every request now - * fails with connection refused. Checks the connector's ingress every minute - * and registers this server's origin again when it points elsewhere. While the - * mismatch persists, each attempt doubles the wait, up to 30 minutes, so a - * relay that cannot fix it is not asked every minute. + * Only this server runs the connector, so an ingress naming another origin is a dead + * registration. Checks every minute and re-registers this origin on a mismatch, + * doubling the wait (up to 30 minutes) while the relay keeps routing elsewhere. */ export const watchManagedTunnelOrigin = Effect.fn("ManagedTunnelOrigin.watch")(function* < E, diff --git a/apps/server/src/guest/GuestShareService.test.ts b/apps/server/src/guest/GuestShareService.test.ts index 2f0366d4d2d22..15d977712710b 100644 --- a/apps/server/src/guest/GuestShareService.test.ts +++ b/apps/server/src/guest/GuestShareService.test.ts @@ -76,6 +76,7 @@ const layerConnect = Layer.mock(CloudManagedEndpointRuntime)({ inspectConnector: Effect.map(Ref.get(hostname), (value) => ({ readyConnections: 1, hostname: value, + origin: null, protocol: "http2", })), }); From f74f170aac8ed5fe3ea2faa2fb2410e049fbe7ec Mon Sep 17 00:00:00 2001 From: ishaanko Date: Tue, 3 Nov 2026 10:48:15 -0800 Subject: [PATCH 5/7] test(server): cover reading the tunnel origin from cloudflared's config --- .../src/cloud/ManagedEndpointRuntime.test.ts | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/apps/server/src/cloud/ManagedEndpointRuntime.test.ts b/apps/server/src/cloud/ManagedEndpointRuntime.test.ts index ad7761f7c4549..60b491c6de448 100644 --- a/apps/server/src/cloud/ManagedEndpointRuntime.test.ts +++ b/apps/server/src/cloud/ManagedEndpointRuntime.test.ts @@ -20,7 +20,7 @@ import * as Sink from "effect/Sink"; import * as Stream from "effect/Stream"; import * as TestClock from "effect/testing/TestClock"; import { ChildProcess, ChildProcessSpawner } from "effect/process"; -import { HttpClient } from "effect/http"; +import { HttpClient, HttpClientResponse } from "effect/http"; import type { RelayManagedEndpointRuntimeConfig } from "@t3tools/contracts/relay"; import * as RelayClient from "@t3tools/shared/relayClient"; @@ -251,6 +251,68 @@ describe("CloudManagedEndpointRuntime", () => { }), ); + it.effect("reads the public hostname and its origin from cloudflared's remote config", () => + Effect.gen(function* () { + let ingress: unknown = [ + { hostname: "env.example.t3.codes", service: "http://127.0.0.1:3773" }, + { service: "http_status:404" }, + ]; + const httpClient = HttpClient.make((request) => + Effect.succeed( + HttpClientResponse.fromWeb( + request, + Response.json( + request.url.endsWith("/config") + ? { config: ingress === undefined ? {} : { ingress } } + : { readyConnections: 4 }, + ), + ), + ), + ); + const output = yield* Queue.unbounded(); + const spawner = ChildProcessSpawner.make(() => + Effect.gen(function* () { + const handle = makeHandle({ + pid: 702, + onKill: () => {}, + output: Stream.fromQueue(output), + }); + yield* Effect.addFinalizer(() => handle.kill().pipe(Effect.ignore)); + return handle; + }), + ); + const runtime = yield* buildCloudManagedEndpointRuntime( + spawner, + layerRelayClientAvailable, + httpClient, + ); + yield* runtime.applyConfig({ + providerKind: "cloudflare_tunnel", + connectorToken: "connector-token", + tunnelId: "tunnel-1", + }); + yield* Queue.offer( + output, + new TextEncoder().encode( + "2026-10-06T00:00:01Z INF Starting metrics server on 127.0.0.1:20241/metrics\n" + + "2026-10-06T00:00:01Z INF Registered tunnel connection connIndex=0\n", + ), + ); + yield* Stream.runHead(runtime.tunnelConnected); + + expect(yield* runtime.inspectConnector).toMatchObject({ + readyConnections: 4, + hostname: "env.example.t3.codes", + origin: "http://127.0.0.1:3773", + }); + // Before the edge pushes a config, the origin is unknown rather than wrong. + for (const missing of [null, undefined]) { + ingress = missing; + expect(yield* runtime.inspectConnector).toMatchObject({ hostname: null, origin: null }); + } + }), + ); + it.effect("logs a connection unregistration at info with the connector token redacted", () => { const logs: Array<{ readonly level: string; readonly message: unknown }> = []; const unregistrationLogged = Deferred.makeUnsafe(); From 690d44bc5e32ac5d8b94a6b5871e90ba93dcbbaf Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 22:02:21 +0000 Subject: [PATCH 6/7] test(server): drop a watcher case the backoff test already covers AI-assisted; verified with the tests and tools listed above. --- apps/server/src/cloud/managedTunnelStartup.test.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/apps/server/src/cloud/managedTunnelStartup.test.ts b/apps/server/src/cloud/managedTunnelStartup.test.ts index cef817e7af6cc..7e617bd5893ab 100644 --- a/apps/server/src/cloud/managedTunnelStartup.test.ts +++ b/apps/server/src/cloud/managedTunnelStartup.test.ts @@ -63,16 +63,6 @@ describe("watchManagedTunnelOrigin", () => { return { checks, registeredAtMinute }; }); - it.effect("registers this server again when the ingress names another local port", () => - Effect.gen(function* () { - const result = yield* watch({ - ingress: ["http://127.0.0.1:46169", localOrigin], - minutes: 5, - }); - expect(result.registeredAtMinute).toEqual([1]); - }), - ); - it.effect("leaves a matching or unknown ingress alone", () => Effect.gen(function* () { const result = yield* watch({ From 5a109c1910380e2d5a2261df4d2ce7b4231eeaeb Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Fri, 13 Nov 2026 23:41:46 +0000 Subject: [PATCH 7/7] test(server): use a while loop in the origin watcher test helper Co-Authored-By: Claude Opus 5.5 --- apps/server/src/cloud/managedTunnelStartup.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/src/cloud/managedTunnelStartup.test.ts b/apps/server/src/cloud/managedTunnelStartup.test.ts index 7e617bd5893ab..6752307b1d010 100644 --- a/apps/server/src/cloud/managedTunnelStartup.test.ts +++ b/apps/server/src/cloud/managedTunnelStartup.test.ts @@ -55,7 +55,7 @@ describe("watchManagedTunnelOrigin", () => { return input.failRegistration ? Effect.fail("relay unavailable") : Effect.void; }), }).pipe(Effect.forkChild); - for (; minute < input.minutes;) { + while (minute < input.minutes) { minute += 1; yield* TestClock.adjust("1 minute"); }