Skip to content

Commit 2b9b2ea

Browse files
t3dotggclaude
andcommitted
fix(connect): address review - stop retrying conflict errors, drop reason alias
Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 5ce17a2 commit 2b9b2ea

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎apps/server/src/server.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,15 @@ export const makeServerLayer = Layer.unwrap(
540540
// On reboot this races NIC/DNS bring-up, so back off exponentially
541541
// (capped at 30s) instead of burning all retries in a second.
542542
// Bounded overall so a permanently broken setup still surfaces the
543-
// warning below. Bad-request/unauthorized are deterministic local
544-
// failures that no amount of retrying converges.
543+
// warning below. Bad-request/unauthorized/conflict are
544+
// deterministic failures (malformed origin, not linked yet, linked
545+
// to a different cloud account) that no amount of retrying
546+
// converges.
545547
Effect.retry({
546548
while: (error) =>
547549
error._tag !== "EnvironmentHttpBadRequestError" &&
548-
error._tag !== "EnvironmentHttpUnauthorizedError",
550+
error._tag !== "EnvironmentHttpUnauthorizedError" &&
551+
error._tag !== "EnvironmentHttpConflictError",
549552
schedule: Schedule.exponential("1 second").pipe(
550553
Schedule.modifyDelay(({ duration }) =>
551554
Effect.succeed(Duration.min(duration, Duration.seconds(30))),

‎infra/relay/src/environments/EnvironmentConnector.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ import * as ManagedEndpointAllocations from "./ManagedEndpointAllocations.ts";
4545
import * as RelayConfiguration from "../Config.ts";
4646
import { isManagedEndpointHostname } from "../deploymentConfig.ts";
4747

48-
// The reason set is part of the public relay contract so clients can render
49-
// specific diagnostics (e.g. "your server never linked" vs. a real auth issue).
50-
export const EnvironmentConnectNotAuthorizedReason = RelayEnvironmentConnectNotAuthorizedReason;
51-
export type EnvironmentConnectNotAuthorizedReason =
52-
typeof EnvironmentConnectNotAuthorizedReason.Type;
53-
5448
function environmentConnectNotAuthorizedReasonMessage(
55-
reason: EnvironmentConnectNotAuthorizedReason,
49+
reason: RelayEnvironmentConnectNotAuthorizedReason,
5650
): string {
5751
switch (reason) {
5852
case "client_proof_key_thumbprint_missing":
@@ -79,7 +73,7 @@ export class EnvironmentConnectNotAuthorized extends Schema.TaggedErrorClass<Env
7973
{
8074
environmentId: Schema.String,
8175
operation: Schema.Literals(["connect", "status"]),
82-
reason: EnvironmentConnectNotAuthorizedReason,
76+
reason: RelayEnvironmentConnectNotAuthorizedReason,
8377
},
8478
) {
8579
override get message(): string {

0 commit comments

Comments
 (0)