fix(openshell): cap command timeout config · openclaw/openclaw@c36b2bf
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,7 +56,8 @@
|
56 | 56 | }, |
57 | 57 | "timeoutSeconds": { |
58 | 58 | "type": "number", |
59 | | -"minimum": 1 |
| 59 | +"minimum": 1, |
| 60 | +"maximum": 2147000 |
60 | 61 | } |
61 | 62 | } |
62 | 63 | }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -70,6 +70,14 @@ describe("openshell plugin config", () => {
|
70 | 70 | ).toThrow("mode must be one of mirror, remote"); |
71 | 71 | }); |
72 | 72 | |
| 73 | +it("rejects timeouts beyond Node's safe timer range", () => { |
| 74 | +expect(() => |
| 75 | +resolveOpenShellPluginConfig({ |
| 76 | +timeoutSeconds: 2_147_001, |
| 77 | +}), |
| 78 | +).toThrow("timeoutSeconds must be a number <= 2147000"); |
| 79 | +}); |
| 80 | + |
73 | 81 | it("keeps the runtime json schema in sync with the manifest config schema", () => { |
74 | 82 | const manifest = JSON.parse( |
75 | 83 | fsSync.readFileSync(new URL("../openclaw.plugin.json", import.meta.url), "utf8"), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -42,6 +42,7 @@ const DEFAULT_SOURCE = "openclaw";
|
42 | 42 | const DEFAULT_REMOTE_WORKSPACE_DIR = "/sandbox"; |
43 | 43 | const DEFAULT_REMOTE_AGENT_WORKSPACE_DIR = "/agent"; |
44 | 44 | const DEFAULT_TIMEOUT_MS = 120_000; |
| 45 | +const MAX_OPEN_SHELL_TIMEOUT_SECONDS = 2_147_000; |
45 | 46 | const OPEN_SHELL_MANAGED_REMOTE_ROOTS = [ |
46 | 47 | DEFAULT_REMOTE_WORKSPACE_DIR, |
47 | 48 | DEFAULT_REMOTE_AGENT_WORKSPACE_DIR, |
@@ -90,8 +91,13 @@ const OpenShellPluginConfigSchema = z.strictObject({
|
90 | 91 | "remoteAgentWorkspaceDir must be a non-empty string", |
91 | 92 | ).optional(), |
92 | 93 | timeoutSeconds: z |
93 | | -.number({ error: "timeoutSeconds must be a number >= 1" }) |
| 94 | +.number({ |
| 95 | +error: `timeoutSeconds must be a number between 1 and ${MAX_OPEN_SHELL_TIMEOUT_SECONDS}`, |
| 96 | +}) |
94 | 97 | .min(1, { error: "timeoutSeconds must be a number >= 1" }) |
| 98 | +.max(MAX_OPEN_SHELL_TIMEOUT_SECONDS, { |
| 99 | +error: `timeoutSeconds must be a number <= ${MAX_OPEN_SHELL_TIMEOUT_SECONDS}`, |
| 100 | +}) |
95 | 101 | .optional(), |
96 | 102 | }); |
97 | 103 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。