mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-27 22:53:36 +00:00
fix(gateway): honor remote status probe timeout (#89859)
Merged via squash.
Prepared head SHA: 056707dbc7
Co-authored-by: mushuiyu886 <266724580+mushuiyu886@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user