openclaw - 💡(How to fix) Fix Unbounded pagination loop in loadCronJobForShow can hang indefinitely

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…

Fix Action

Fix / Workaround

Severity: high / 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 (https://x.com/bradmillscan/status/2056377217437909178)

Reasoning

loadCronJobForShow uses an unbounded for (;;) loop with no max-pages guard and no check that nextOffset advances. If the gateway returns a page where nextOffset equals the current offset (misbehaving server or a bug), the loop spins forever issuing identical RPC calls. The sibling function loadCronJobForEditSchedulePatch has CRON_EDIT_LOOKUP_MAX_PAGES=50 guard and an advancement check, but loadCronJobForShow omits both.

Recommendation

Mirror the guard from loadCronJobForEditSchedulePatch: add a CRON_SHOW_LOOKUP_MAX_PAGES constant, assert nextOffset > offset, and throw when the limit is exceeded.

Code Example

for (;;) {
    const res = await callGatewayFromCli("cron.list", opts, {
      includeDisabled: true,
      limit: CRON_SHOW_PAGE_SIZE,
      offset,
    });
    const page = res as {
      jobs?: CronJob[];
      hasMore?: boolean;
      nextOffset?: number | null;
    };
    const jobs = page.jobs ?? [];
    const job = findCronJobInPage(jobs, idOrName);
    if (job) {
      return { job, deliveryPreview: coerceCronDeliveryPreviews(res).get(job.id) };
    }
    if (!page.hasMore || typeof page.nextOffset !== "number") {
      return {};
    }
    offset = page.nextOffset;
RAW_BUFFERClick to expand / collapse

Severity: high / 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 (https://x.com/bradmillscan/status/2056377217437909178)

Evidence

  • src/cli/cron-cli/register.cron-simple.ts:103-123 (loadCronJobForShow)
for (;;) {
    const res = await callGatewayFromCli("cron.list", opts, {
      includeDisabled: true,
      limit: CRON_SHOW_PAGE_SIZE,
      offset,
    });
    const page = res as {
      jobs?: CronJob[];
      hasMore?: boolean;
      nextOffset?: number | null;
    };
    const jobs = page.jobs ?? [];
    const job = findCronJobInPage(jobs, idOrName);
    if (job) {
      return { job, deliveryPreview: coerceCronDeliveryPreviews(res).get(job.id) };
    }
    if (!page.hasMore || typeof page.nextOffset !== "number") {
      return {};
    }
    offset = page.nextOffset;

Reasoning

loadCronJobForShow uses an unbounded for (;;) loop with no max-pages guard and no check that nextOffset advances. If the gateway returns a page where nextOffset equals the current offset (misbehaving server or a bug), the loop spins forever issuing identical RPC calls. The sibling function loadCronJobForEditSchedulePatch has CRON_EDIT_LOOKUP_MAX_PAGES=50 guard and an advancement check, but loadCronJobForShow omits both.

Reproduction

Start a gateway that returns hasMore=true but nextOffset stays at 0. Run openclaw cron show <name>. The CLI loops forever.

Recommendation

Mirror the guard from loadCronJobForEditSchedulePatch: add a CRON_SHOW_LOOKUP_MAX_PAGES constant, assert nextOffset > offset, and throw when the limit is exceeded.

Why existing tests miss this

No tests are present for this feature group (tests array is empty in the feature manifest).

Suggested regression test

Unit test loadCronJobForShow with a mock callGatewayFromCli that always returns hasMore=true and nextOffset=0; assert it throws rather than looping.

Minimum fix scope

Add a page counter and advancement assertion to loadCronJobForShow, matching the existing pattern in loadCronJobForEditSchedulePatch.


Standardized clawpatch finding submission. Persistent across v2026.5.12 → v2026.5.18 — not resolved by upgrading. Finding ID: fnd_sig-feat-cli-command-1de66cf308-_e2f98649e2.

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

openclaw - 💡(How to fix) Fix Unbounded pagination loop in loadCronJobForShow can hang indefinitely