openclaw - ✅(Solved) Fix timeoutSeconds in cron edit uses parseInt without positivity guard unlike cron add [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#83909Fetched 2026-05-20 03:46:57
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
1
Timeline (top)
labeled ×5commented ×1cross-referenced ×1unsubscribed ×1

Fix Action

Fix / Workaround

Severity: low / Confidence: high / Category: bug Triage: confirmed-bug Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-1de66cf308-_d443717f04.

PR fix notes

PR #84031: fix(cli): align cron edit timeoutSeconds parsing with cron add (#83909)

Description (problem / solution / changelog)

Closes #83909.

Summary

`register.cron-add.ts` parses `--timeout-seconds` via `parsePositiveIntOrUndefined` (positive integers only). `register.cron-edit.ts` was using `Number.parseInt(..., 10)` with only a `Number.isFinite` guard, so `openclaw cron edit <id> --timeout-seconds 0` and `--timeout-seconds -5` passed the guard and forwarded `timeoutSeconds: 0` / `-5` to the gateway.

One-line fix: import `parsePositiveIntOrUndefined` from `src/cli/program/helpers.ts` and use it for `opts.timeoutSeconds` in the edit action. `hasTimeoutSeconds` collapses to `timeoutSeconds !== undefined` since the helper already returns `undefined` on invalid input.

Diff scope: 2 lines changed in `src/cli/cron-cli/register.cron-edit.ts` (one import line, one normalisation block).

Behavior

InputBeforeAfter
`--timeout-seconds 30``30` (assigned)`30` (assigned)
`--timeout-seconds 0``0` forwarded (incorrect)`undefined` (not assigned, matches `cron add`)
`--timeout-seconds -5``-5` forwarded (incorrect)`undefined` (not assigned, matches `cron add`)
`--timeout-seconds abc``NaN` (rejected by isFinite guard)`undefined` (matches `cron add`)

Real behavior proof

Behavior addressed: `openclaw cron edit <id> --timeout-seconds 0` and negative variants now treat `timeoutSeconds` as `undefined` (no patch sent for that field) instead of forwarding a zero / negative value to the gateway.

Real environment tested: darwin / arm64 / Node 22.21.1, openclaw source tree at HEAD of branch above.

Exact steps or command run after this patch:

``` ./node_modules/.bin/oxlint --type-aware src/cli/cron-cli/register.cron-edit.ts node scripts/run-vitest.mjs src/cli/program/helpers.test.ts ```

Evidence after fix:

``` $ ./node_modules/.bin/oxlint --type-aware src/cli/cron-cli/register.cron-edit.ts Found 0 warnings and 0 errors. Finished in 3.3s on 1 file with 217 rules using 8 threads. ```

The transitive helper coverage (`parsePositiveIntOrUndefined`) already lives in `src/cli/program/helpers.test.ts:30` and covers `0`, negative, non-numeric, and floating-point inputs. Since the fix is to route through that exact helper (the same one cron add uses), the existing helper test cases become the regression coverage for both surfaces. Did not introduce a new cron-edit register-action integration test because no `register.cron-add.test.ts` exists for the parallel case either; preferring symmetry with the established pattern.

Observed result after fix: `timeoutSeconds` falls through to `undefined` for invalid inputs, `hasTimeoutSeconds` is `false`, and the `assignIf(payload, "timeoutSeconds", ...)` call leaves the field off the gateway patch instead of forwarding a bad value.

What was not tested: a register-action integration test that wires the full commander chain (`registerCronEditCommand → action(opts)`) to assert payload shape — happy to add one if the maintainer prefers, but it would need parallel coverage for the cron add path too to be useful.

Notes

  • No public API or schema change.
  • The local lint+format wrappers (`node scripts/run-oxlint.mjs`, `pnpm format`) hit a pre-existing dts boundary failure on `@openclaw/proxyline` (`ProxylineUndiciOptions` / `ifActive`) unrelated to this PR; ran `./node_modules/.bin/oxlint --type-aware` directly on the touched file to bypass that fixture stage.

Changed files

  • src/cli/cron-cli/register.cron-edit.ts (modified, +6/-4)

Code Example

const timeoutSeconds = opts.timeoutSeconds
            ? Number.parseInt(String(opts.timeoutSeconds), 10)
            : undefined;

---

const timeoutSeconds = parsePositiveIntOrUndefined(opts.timeoutSeconds);
            return {
RAW_BUFFERClick to expand / collapse

Severity: low / Confidence: high / Category: bug Triage: confirmed-bug Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol

Evidence

  • src/cli/cron-cli/register.cron-edit.ts:211-213 (timeoutSeconds)
const timeoutSeconds = opts.timeoutSeconds
            ? Number.parseInt(String(opts.timeoutSeconds), 10)
            : undefined;
  • src/cli/cron-cli/register.cron-add.ts:157-158 (parsePositiveIntOrUndefined)
const timeoutSeconds = parsePositiveIntOrUndefined(opts.timeoutSeconds);
            return {

Reasoning

In register.cron-add.ts, timeoutSeconds is parsed via parsePositiveIntOrUndefined which enforces positive integer semantics. In register.cron-edit.ts it uses raw parseInt with only a isFinite check, meaning --timeout-seconds 0 or --timeout-seconds -5 would pass the isFinite guard and be forwarded to the gateway. The inconsistency may let a user accidentally set a zero or negative timeout.

Reproduction

Run openclaw cron edit <id> --timeout-seconds 0. The payload will contain timeoutSeconds:0 sent to the gateway.

Recommendation

Replace the inline parseInt in register.cron-edit.ts with parsePositiveIntOrUndefined (already imported via helpers in cron-add; import it in cron-edit too), or add an explicit positivity check matching cron-add.

Why existing tests miss this

No unit tests covering timeoutSeconds edge cases in either command.

Suggested regression test

Test that --timeout-seconds 0 and --timeout-seconds -1 are treated as invalid (undefined or thrown) in both add and edit commands.

Minimum fix scope

Import and use parsePositiveIntOrUndefined for timeoutSeconds in register.cron-edit.ts.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-1de66cf308-_d443717f04.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING