


























@@ -268,6 +268,24 @@ async function fetchLocalGatewayHealth(params: {
268268}
269269}
270270271+async function waitForQaGatewayRestartBoundary(params: {
272+logs: () => string;
273+offset: number;
274+pollMs?: number;
275+timeoutMs?: number;
276+}) {
277+const timeoutMs = params.timeoutMs ?? 30_000;
278+const pollMs = params.pollMs ?? 100;
279+const startedAt = Date.now();
280+while (Date.now() - startedAt < timeoutMs) {
281+if (params.logs().slice(params.offset).includes("restart mode:")) {
282+return;
283+}
284+await sleep(pollMs);
285+}
286+throw new Error(`qa gateway child did not reach restart boundary within ${timeoutMs}ms`);
287+}
288+271289export const __testing = {
272290 assertQaArtifactDirWithinRepo,
273291 buildQaRuntimeEnv,
@@ -283,6 +301,7 @@ export const __testing = {
283301 stageQaLiveAnthropicSetupToken,
284302 stageQaMockAuthProfiles,
285303 resolveQaLiveCliAuthEnv,
304+ waitForQaGatewayRestartBoundary,
286305 resolveQaOwnerPluginIdsForProviderIds,
287306 resolveQaBundledPluginSourceDir,
288307 resolveQaRuntimeHostVersion,
@@ -816,7 +835,20 @@ export async function startQaGatewayChild(params: {
816835if (!activeChild.pid) {
817836throw new Error("qa gateway child has no pid");
818837}
838+const restartLogOffset = logs().length;
819839process.kill(activeChild.pid, signal);
840+if (signal === "SIGUSR1") {
841+await waitForQaGatewayRestartBoundary({
842+ logs,
843+offset: restartLogOffset,
844+});
845+await waitForGatewayReady({
846+ baseUrl,
847+ logs,
848+child: activeChild,
849+timeoutMs: 120_000,
850+});
851+}
820852},
821853async restartAfterStateMutation(
822854mutateState: (context: QaGatewayChildStateMutationContext) => Promise<void>,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。