@devries-cameron20 / t3code Mirror · read-only / commits / 6845207825
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 07:15 UTC

feat(server): pairing-link sessions renew with the device's DPoP key (#37980) (#38859)

Julius Marminge committed Nov 18, 2026 at 18:49 UTC 6845207825728928bc439442f10aa9df1307eb1c
2 files changed +24 -14
infra/relay/src/environments/ManagedEndpointProvider.ts
+8 -4
@@ -242,7 +242,10 @@ export class ManagedEndpointTunnelClient extends Context.Service<
242 readonly get: (
243 tunnelId: string,
244 ) => Effect.Effect<ManagedEndpointTunnel, ManagedEndpointTunnelClientError>;
245 - readonly list: (request: ManagedEndpointTunnelListRequest) => Effect.Effect<
245 + readonly list: (
246 + request: ManagedEndpointTunnelListRequest,
247 + options?: { readonly timeout?: Duration.Input },
248 + ) => Effect.Effect<
249 {
250 readonly result: ReadonlyArray<ManagedEndpointTunnel>;
251 readonly resultInfo?: {
@@ -504,6 +507,7 @@ const makeCloudflareApiGate = (alchemyRuntimeContext: Alchemy.BaseRuntimeContext
507 });
508 return <A, E>(
509 call: Effect.Effect<A, E, Alchemy.RuntimeContext>,
510 + timeout: Duration.Input = "8 seconds",
511 ): Effect.Effect<A, E | CloudflareApiPaused | Cause.TimeoutError> =>
512 Effect.gen(function* () {
513 const now = yield* Clock.currentTimeMillis;
@@ -522,7 +526,7 @@ const makeCloudflareApiGate = (alchemyRuntimeContext: Alchemy.BaseRuntimeContext
526 }
527 return yield* call.pipe(
528 Effect.provideService(CloudflareRetry.Retry, withoutRateLimitRetries),
525 - Effect.timeout("8 seconds"),
529 + Effect.timeout(timeout),
530 Effect.tapError((cause) =>
531 isCloudflareRateLimited(cause) ? recordRateLimit(cause) : Effect.void,
532 ),
@@ -1607,8 +1611,8 @@ export const layerCloudflareBindings = (
1611 }),
1612 ),
1613 ),
1610 - list: (request) =>
1611 - gate(tunnelClient.list(request)).pipe(
1614 + list: (request, options) =>
1615 + gate(tunnelClient.list(request), options?.timeout).pipe(
1616 Effect.mapError(
1617 (cause) =>
1618 new ManagedEndpointTunnelClientError({
infra/relay/src/environments/ManagedEndpointReaper.ts
+16 -10
@@ -17,8 +17,11 @@ const MANAGED_ENDPOINT_GRACE_PERIOD_MINUTES = 5;
17 // Never-connected tunnels may still be pairing; allow an hour.
18 const MANAGED_ENDPOINT_INACTIVE_GRACE_PERIOD_MINUTES = 60;
19 const MANAGED_ENDPOINT_SWEEP_PAGE_SIZE = 100;
20 -export const MANAGED_ENDPOINT_SWEEP_ATTEMPT_LIMIT = 250;
20 +// Down tunnels arrive at ~66k/day, about what 250 per sweep removed; the delete budget caps a sweep below this.
21 +export const MANAGED_ENDPOINT_SWEEP_ATTEMPT_LIMIT = 500;
22 const MANAGED_ENDPOINT_SWEEP_LIST_REQUEST_LIMIT = 10;
23 +// Cloudflare's filtered list over a large backlog can outlast the 8 s limit request paths use.
24 +const MANAGED_ENDPOINT_SWEEP_LIST_TIMEOUT = "30 seconds";
25 const MANAGED_ENDPOINT_LEGACY_AGE_BUCKET_DAYS = [7, 30, 90] as const;
26 // Hosts without recovery cannot replace deleted tunnels; allow a longer absence.
27 const MANAGED_ENDPOINT_LEGACY_GRACE_PERIOD_DAYS = 7;
@@ -197,15 +200,18 @@ const make = Effect.gen(function* () {
200 const cutoffIso = DateTime.formatIso(cutoff);
201 const listPage = (page: number) => {
202 listRequests += 1;
200 - return tunnels.list({
201 - isDeleted: false,
202 - includePrefix: prefix,
203 - status,
204 - existedAt: cutoffIso,
205 - ...(status === "down" ? { wasInactiveAt: cutoffIso } : {}),
206 - page,
207 - perPage: MANAGED_ENDPOINT_SWEEP_PAGE_SIZE,
208 - });
203 + return tunnels.list(
204 + {
205 + isDeleted: false,
206 + includePrefix: prefix,
207 + status,
208 + existedAt: cutoffIso,
209 + ...(status === "down" ? { wasInactiveAt: cutoffIso } : {}),
210 + page,
211 + perPage: MANAGED_ENDPOINT_SWEEP_PAGE_SIZE,
212 + },
213 + { timeout: MANAGED_ENDPOINT_SWEEP_LIST_TIMEOUT },
214 + );
215 };
216 const first = yield* listPage(1);
217 const totalCount =