mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-30 20:03:30 +00:00
fix(sdk): preserve zero run timeout watchdog
This commit is contained in:
@@ -790,9 +790,11 @@ export class RunsNamespace {
|
||||
constructor(private readonly client: OpenClaw) {}
|
||||
|
||||
async create(params: RunCreateParams): Promise<Run> {
|
||||
const raw = await this.client.request("agent", buildAgentParams(params), {
|
||||
const timeoutMs = normalizeTimeoutMs(params.timeoutMs);
|
||||
const normalizedParams = timeoutMs !== undefined ? { ...params, timeoutMs } : params;
|
||||
const raw = await this.client.request("agent", buildAgentParams(normalizedParams), {
|
||||
expectFinal: false,
|
||||
timeoutMs: params.timeoutMs,
|
||||
...(timeoutMs !== undefined ? { timeoutMs: timeoutMs === 0 ? null : timeoutMs } : {}),
|
||||
});
|
||||
const record = asRecord(raw);
|
||||
const runId = readOptionalString(record.runId);
|
||||
|
||||
@@ -445,6 +445,11 @@ describe("OpenClaw SDK", () => {
|
||||
timeoutMs: 1_500,
|
||||
idempotencyKey: "timeout-test",
|
||||
});
|
||||
await oc.runs.create({
|
||||
input: "run without SDK watchdog",
|
||||
timeoutMs: 0,
|
||||
idempotencyKey: "no-watchdog-test",
|
||||
});
|
||||
|
||||
expect(requireTransportCall(transport.calls, 0)).toEqual({
|
||||
method: "agent",
|
||||
@@ -455,6 +460,15 @@ describe("OpenClaw SDK", () => {
|
||||
idempotencyKey: "timeout-test",
|
||||
},
|
||||
});
|
||||
expect(requireTransportCall(transport.calls, 1)).toEqual({
|
||||
method: "agent",
|
||||
options: { expectFinal: false, timeoutMs: null },
|
||||
params: {
|
||||
message: "run without SDK watchdog",
|
||||
timeout: 0,
|
||||
idempotencyKey: "no-watchdog-test",
|
||||
},
|
||||
});
|
||||
await expect(
|
||||
oc.runs.create({
|
||||
input: "bad timeout",
|
||||
|
||||
Reference in New Issue
Block a user