fix: parse codex computer use timeout env strictly · openclaw/openclaw@5b79ab0
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -714,6 +714,23 @@ allowed_sandbox_modes = ["read-only", "workspace-write"]
|
714 | 714 | marketplaceSource: "github:example/plugins", |
715 | 715 | }, |
716 | 716 | ); |
| 717 | + |
| 718 | +for (const value of ["0x10", "1e3"]) { |
| 719 | +expectFields( |
| 720 | +resolveCodexComputerUseConfig({ |
| 721 | +pluginConfig: {}, |
| 722 | +env: { |
| 723 | +OPENCLAW_CODEX_COMPUTER_USE: "1", |
| 724 | +OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS: value, |
| 725 | +}, |
| 726 | +}), |
| 727 | +"computer use config", |
| 728 | +{ |
| 729 | +enabled: true, |
| 730 | +marketplaceDiscoveryTimeoutMs: 60_000, |
| 731 | +}, |
| 732 | +); |
| 733 | +} |
717 | 734 | }); |
718 | 735 | |
719 | 736 | it("allows plugin config to opt in to guardian-reviewed local execution", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,7 @@ const START_OPTIONS_KEY_SECRET_SYMBOL = Symbol.for("openclaw.codexAppServerStart
|
10 | 10 | const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret(); |
11 | 11 | const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml"; |
12 | 12 | const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml"; |
| 13 | +const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/; |
13 | 14 | |
14 | 15 | type CodexAppServerTransportMode = "stdio" | "websocket"; |
15 | 16 | type CodexAppServerPolicyMode = "yolo" | "guardian"; |
@@ -1035,10 +1036,11 @@ function readBooleanEnv(value: string | undefined): boolean | undefined {
|
1035 | 1036 | } |
1036 | 1037 | |
1037 | 1038 | function readNumberEnv(value: string | undefined): number | undefined { |
1038 | | -if (value === undefined) { |
| 1039 | +const trimmed = value?.trim(); |
| 1040 | +if (!trimmed || !PLAIN_DECIMAL_NUMBER_RE.test(trimmed)) { |
1039 | 1041 | return undefined; |
1040 | 1042 | } |
1041 | | -const parsed = Number(value); |
| 1043 | +const parsed = Number(trimmed); |
1042 | 1044 | return Number.isFinite(parsed) ? parsed : undefined; |
1043 | 1045 | } |
1044 | 1046 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。