Skip to content

Commit 7157deb

Browse files
committed
fix(workers): use the diagnosed admission-deadline message after #130435 rebase
WorkerConnection now formats the redacted last-failure diagnosis into the deadline error itself, so the runtime's re-format (and its lastConnectionFailure tracking) is redundant; errorText uses error.message.
1 parent 8faa56f commit 7157deb

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎src/worker/worker.runtime.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,11 @@ describe("worker runtime", () => {
12931293
endpoint: launch.connectionEndpoint,
12941294
connectParams: buildWorkerConnectParams(launch),
12951295
});
1296-
const deadline = new WorkerAdmissionDeadlineExceededError();
1296+
// Production formats the last failure into the deadline message
1297+
// (WorkerConnection.failAdmissionDeadline); model that here.
1298+
const deadline = new WorkerAdmissionDeadlineExceededError(
1299+
"no admission after 3 attempts to gateway.sock: connect ECONNREFUSED",
1300+
);
12971301
const start = vi.spyOn(connection, "start");
12981302
if (phase === "initial admission") {
12991303
start.mockRejectedValue(deadline);

‎src/worker/worker.runtime.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { registerSecretValueForRedaction } from "../logging/secret-redaction-reg
1010
import type { WorkerBrowserRuntime } from "./browser-runtime.js";
1111
import { buildWorkerConnectParams, type WorkerLaunchDescriptor } from "./launch-descriptor.js";
1212
import {
13-
formatWorkerConnectionFailure,
1413
WorkerAdmissionDeadlineExceededError,
1514
type WorkerAdmissionDeadlineResult,
1615
} from "./worker-connection-contract.js";
@@ -98,12 +97,10 @@ export async function runWorkerDescriptor(
9897
let turnStarted = false;
9998
let resultFenceAcked = false;
10099
let forcedStopTimer: NodeJS.Timeout | undefined;
101-
let lastConnectionFailure: Error | undefined;
102100
const connection = createWorkerConnection({
103101
endpoint: descriptor.connectionEndpoint,
104102
connectParams: buildWorkerConnectParams(descriptor),
105103
onConnectionFailure: (error) => {
106-
lastConnectionFailure = error;
107104
options.onConnectionFailure?.(error?.message);
108105
},
109106
});
@@ -153,10 +150,9 @@ export async function runWorkerDescriptor(
153150
return {
154151
status: "not-started",
155152
reason: "admission-deadline",
156-
errorText: `${error.message}: ${formatWorkerConnectionFailure(
157-
descriptor.connectionEndpoint,
158-
lastConnectionFailure ?? error,
159-
)}`,
153+
// The deadline error message already carries the formatted, redacted
154+
// last-failure diagnosis (see WorkerConnection.failAdmissionDeadline).
155+
errorText: error.message,
160156
};
161157
}
162158
throw error;

0 commit comments

Comments
 (0)