fix(gateway): honor injected env for watchdog timeouts · openclaw/openclaw@9d04064
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
File tree
packages/gateway-client/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -500,10 +500,11 @@ function formatGatewayClientErrorForLog(err: unknown): string {
|
500 | 500 | export function resolveGatewayClientConnectChallengeTimeoutMs( |
501 | 501 | opts: Pick< |
502 | 502 | GatewayClientOptions, |
503 | | -"connectChallengeTimeoutMs" | "connectDelayMs" | "preauthHandshakeTimeoutMs" |
| 503 | +"connectChallengeTimeoutMs" | "connectDelayMs" | "env" | "preauthHandshakeTimeoutMs" |
504 | 504 | >, |
505 | 505 | ): number { |
506 | 506 | return resolveConnectChallengeTimeoutMs(readConnectChallengeTimeoutOverride(opts), { |
| 507 | +env: opts.env, |
507 | 508 | configuredTimeoutMs: opts.preauthHandshakeTimeoutMs, |
508 | 509 | }); |
509 | 510 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -125,6 +125,11 @@ describe("GatewayClient", () => {
|
125 | 125 | preauthHandshakeTimeoutMs: 30_000, |
126 | 126 | }), |
127 | 127 | ).toBe(30_000); |
| 128 | +expect( |
| 129 | +resolveGatewayClientConnectChallengeTimeoutMs({ |
| 130 | +env: { OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS: "6000" }, |
| 131 | +}), |
| 132 | +).toBe(6_000); |
128 | 133 | }); |
129 | 134 | |
130 | 135 | test("closes on missing ticks", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway Client tests cover readiness behavior. |
| 2 | +import { describe, expect, it, vi } from "vitest"; |
| 3 | +import { startGatewayClientWithReadinessWait } from "./readiness.js"; |
| 4 | + |
| 5 | +describe("startGatewayClientWithReadinessWait", () => { |
| 6 | +it("uses the injected client env when resolving the readiness timeout", async () => { |
| 7 | +const waitForReady = vi.fn(async () => ({ |
| 8 | +ready: true, |
| 9 | +aborted: false, |
| 10 | +elapsedMs: 0, |
| 11 | +checks: 1, |
| 12 | +maxDriftMs: 0, |
| 13 | +})); |
| 14 | +const client = { start: vi.fn() }; |
| 15 | + |
| 16 | +await startGatewayClientWithReadinessWait(waitForReady, client, { |
| 17 | +clientOptions: { |
| 18 | +env: { OPENCLAW_CONNECT_CHALLENGE_TIMEOUT_MS: "6000" }, |
| 19 | +}, |
| 20 | +}); |
| 21 | + |
| 22 | +expect(waitForReady).toHaveBeenCalledWith({ |
| 23 | +maxWaitMs: 6_000, |
| 24 | +signal: undefined, |
| 25 | +}); |
| 26 | +expect(client.start).toHaveBeenCalledTimes(1); |
| 27 | +}); |
| 28 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ export type GatewayClientStartReadinessOptions = {
|
21 | 21 | timeoutMs?: number; |
22 | 22 | clientOptions?: Pick< |
23 | 23 | GatewayClientOptions, |
24 | | -"connectChallengeTimeoutMs" | "connectDelayMs" | "preauthHandshakeTimeoutMs" |
| 24 | +"connectChallengeTimeoutMs" | "connectDelayMs" | "env" | "preauthHandshakeTimeoutMs" |
25 | 25 | >; |
26 | 26 | signal?: AbortSignal; |
27 | 27 | }; |
@@ -42,6 +42,7 @@ function resolveGatewayClientStartReadinessTimeoutMs(
|
42 | 42 | ? clientOptions.connectDelayMs |
43 | 43 | : undefined; |
44 | 44 | return resolveConnectChallengeTimeoutMs(timeoutOverride, { |
| 45 | +env: clientOptions.env, |
45 | 46 | configuredTimeoutMs: clientOptions.preauthHandshakeTimeoutMs, |
46 | 47 | }); |
47 | 48 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -188,7 +188,7 @@ function createOpenClawGatewayClientHostDeps(
|
188 | 188 | export function resolveGatewayClientConnectChallengeTimeoutMs( |
189 | 189 | opts: Pick< |
190 | 190 | GatewayClientOptions, |
191 | | -"connectChallengeTimeoutMs" | "connectDelayMs" | "preauthHandshakeTimeoutMs" |
| 191 | +"connectChallengeTimeoutMs" | "connectDelayMs" | "env" | "preauthHandshakeTimeoutMs" |
192 | 192 | >, |
193 | 193 | ): number { |
194 | 194 | return baseResolveGatewayClientConnectChallengeTimeoutMs(opts); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。