fix(gateway): honor remote status probe timeout

This commit is contained in:
mushuiyu_xydt
2026-06-22 05:21:34 -04:00
committed by Peter Steinberger
parent 25e2017062
commit 056707dbc7
3 changed files with 27 additions and 8 deletions
+9
View File
@@ -983,6 +983,15 @@ describe("gateway-status command", () => {
]);
});
it("passes the full caller timeout through to active configured remote probes", async () => {
const { runtime } = createRuntimeCapture();
probeGateway.mockClear();
await runGatewayStatus(runtime, { timeout: "15000", json: true });
expect(requireProbeCall("wss://remote.example:18789").timeoutMs).toBe(15_000);
});
it("uses configured handshake timeout as the default local probe budget", async () => {
const { runtime } = createRuntimeCapture();
probeGateway.mockClear();
+12 -2
View File
@@ -436,20 +436,30 @@ describe("resolveProbeBudgetMs", () => {
).toBe(2_500);
});
it("keeps non-local probe caps unchanged", () => {
it("lets active remote probes use the full caller budget", () => {
expect(
resolveProbeBudgetMs(15_000, {
kind: "configRemote",
active: true,
url: "wss://gateway.example/ws",
}),
).toBe(1500);
).toBe(15_000);
expect(
resolveProbeBudgetMs(15_000, {
kind: "explicit",
active: true,
url: "wss://gateway.example/ws",
}),
).toBe(15_000);
});
it("keeps inactive remote and SSH tunnel probes on the short cap", () => {
expect(
resolveProbeBudgetMs(15_000, {
kind: "configRemote",
active: false,
url: "wss://gateway.example/ws",
}),
).toBe(1500);
expect(
resolveProbeBudgetMs(15_000, {
+6 -6
View File
@@ -150,15 +150,15 @@ export function resolveProbeBudgetMs(
if (target.kind === "sshTunnel") {
return Math.min(2000, overallMs);
}
if (target.active) {
return overallMs;
}
if (target.kind === "localLoopback") {
return Math.min(800, overallMs);
}
if (!isLoopbackProbeTarget(target)) {
return Math.min(1500, overallMs);
}
if (target.kind === "localLoopback" && !target.active) {
return Math.min(800, overallMs);
}
// Active/discovered loopback probes and explicit loopback URLs should honor
// the caller budget because healthy local detail RPCs can legitimately take
// longer than the legacy short caps.
return overallMs;
}