diff --git a/src/commands/gateway-status.test.ts b/src/commands/gateway-status.test.ts index 46212816410..068d36a4bda 100644 --- a/src/commands/gateway-status.test.ts +++ b/src/commands/gateway-status.test.ts @@ -567,6 +567,26 @@ describe("gateway-status command", () => { expect(targets.some((t) => t.kind === "sshTunnel")).toBe(true); }); + it("passes the full caller timeout through to local loopback probes", async () => { + const { runtime } = createRuntimeCapture(); + probeGateway.mockClear(); + readBestEffortConfig.mockResolvedValueOnce({ + gateway: { + mode: "local", + auth: { mode: "token", token: "ltok" }, + }, + } as never); + + await runGatewayStatus(runtime, { timeout: "15000", json: true }); + + expect(probeGateway).toHaveBeenCalledWith( + expect.objectContaining({ + url: "ws://127.0.0.1:18789", + timeoutMs: 15_000, + }), + ); + }); + it("skips invalid ssh-auto discovery targets", async () => { const { runtime } = createRuntimeCapture(); await withEnvAsync({ USER: "steipete" }, async () => { diff --git a/src/commands/gateway-status/helpers.test.ts b/src/commands/gateway-status/helpers.test.ts index e0c1ecee763..1d43b4c4f4b 100644 --- a/src/commands/gateway-status/helpers.test.ts +++ b/src/commands/gateway-status/helpers.test.ts @@ -6,6 +6,7 @@ import { isScopeLimitedProbeFailure, renderProbeSummaryLine, resolveAuthForTarget, + resolveProbeBudgetMs, } from "./helpers.js"; describe("extractConfigSummary", () => { @@ -273,3 +274,15 @@ describe("probe reachability classification", () => { expect(renderProbeSummaryLine(probe, false)).toContain("RPC: failed"); }); }); + +describe("resolveProbeBudgetMs", () => { + it("lets local loopback probes use the full caller budget", () => { + expect(resolveProbeBudgetMs(15_000, "localLoopback")).toBe(15_000); + expect(resolveProbeBudgetMs(3_000, "localLoopback")).toBe(3_000); + }); + + it("keeps non-local probe caps unchanged", () => { + expect(resolveProbeBudgetMs(15_000, "configRemote")).toBe(1_500); + expect(resolveProbeBudgetMs(15_000, "sshTunnel")).toBe(2_000); + }); +}); diff --git a/src/commands/gateway-status/helpers.ts b/src/commands/gateway-status/helpers.ts index 5f1a5e2f5ee..2a2be5eaa82 100644 --- a/src/commands/gateway-status/helpers.ts +++ b/src/commands/gateway-status/helpers.ts @@ -118,7 +118,9 @@ export function resolveTargets(cfg: OpenClawConfig, explicitUrl?: string): Gatew export function resolveProbeBudgetMs(overallMs: number, kind: TargetKind): number { if (kind === "localLoopback") { - return Math.min(800, overallMs); + // Let the local probe use the caller's full budget. Slow local shells/containers can + // exceed the old fixed cap and produce false "unreachable" results. + return overallMs; } if (kind === "sshTunnel") { return Math.min(2000, overallMs);