Skip to content

fix(ui): format common cron intervals - #65382

Closed
OwenYWT wants to merge 2 commits into
openclaw:mainfrom
OwenYWT:codex/cron-display-65135
Closed

OwenYWT wants to merge 2 commits into
openclaw:mainfrom
OwenYWT:codex/cron-display-65135

Conversation

@OwenYWT

@OwenYWT OwenYWT commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • format common cron patterns (every N minutes/hours) so the control tooltip reads "Every ..." instead of raw cron syntax
  • keep the existing fallback for unusual schedules and preserve timezone annotations

Testing

  • pnpm --dir ui test src/ui/presenter.test.ts

@greptile-apps

greptile-apps Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Formats common cron step patterns (0 */N * * * → "Every N hours", */N * * * * → "Every N minutes") as human-readable strings in the control UI tooltip, with a clean fallback to raw cron for unrecognized expressions. The implementation is straightforward and safe. Two minor P2 notes: the minute-interval branch (*/N * * * *) has no test cases, and the most common "every hour" expression 0 * * * * still falls through to raw display since only the */N step form is matched.

Confidence Score: 5/5

Safe to merge — all findings are P2 style/coverage suggestions with no correctness or data-integrity risk.

All remaining findings are P2: a missing test for the minute-interval branch, and the common 0 * * * * pattern not being formatted. The logic is correct, the fallback is safe, and no production behavior is broken.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/presenter.test.ts
Line: 19-27

Comment:
**Missing test coverage for minute intervals**

The PR adds logic to format `*/N * * * *` as "Every N minutes", but the test file has no case exercising that branch. The test description even says "hourly cron intervals", matching the omission. A case like `expect(formatCronSchedule(cronSchedule("*/5 * * * *"))).toBe("Every 5 minutes")` would cover the `hour === "*"` path in `formatCommonCronExpression`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: ui/src/ui/presenter.ts
Line: 80-84

Comment:
**`0 * * * *` falls through to raw cron display**

The hourly-step branch only matches `0 */N * * *` (the step form). The plain `0 * * * *`, which is the most idiomatic "every hour" expression cron generators emit, falls through to `Cron 0 * * * *`. This may be intentional scope, but worth considering alongside `*/1` which is rarely used in practice. A simple string equality check could cover it:

```ts
if (minute === "0") {
  if (hour === "*") {
    return `Every ${formatCronIntervalUnit(1, "hour")}`;
  }
  const hourStep = parsePositiveCronStep(hour);
  if (hourStep !== null) {
    return `Every ${formatCronIntervalUnit(hourStep, "hour")}`;
  }
}
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(ui): format common cron intervals" | Re-trigger Greptile

Comment on lines +19 to +27
describe("formatCronSchedule", () => {
it("formats common hourly cron intervals as human-readable intervals", () => {
expect(formatCronSchedule(cronSchedule("0 */6 * * *"))).toBe("Every 6 hours");
expect(formatCronSchedule(cronSchedule("0 */1 * * *", "UTC"))).toBe("Every 1 hour (UTC)");
});

it("keeps unsupported cron expressions on the raw cron fallback", () => {
expect(formatCronSchedule(cronSchedule("15 3 * * 1"))).toBe("Cron 15 3 * * 1");
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing test coverage for minute intervals

The PR adds logic to format */N * * * * as "Every N minutes", but the test file has no case exercising that branch. The test description even says "hourly cron intervals", matching the omission. A case like expect(formatCronSchedule(cronSchedule("*/5 * * * *"))).toBe("Every 5 minutes") would cover the hour === "*" path in formatCommonCronExpression.

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/presenter.test.ts
Line: 19-27

Comment:
**Missing test coverage for minute intervals**

The PR adds logic to format `*/N * * * *` as "Every N minutes", but the test file has no case exercising that branch. The test description even says "hourly cron intervals", matching the omission. A case like `expect(formatCronSchedule(cronSchedule("*/5 * * * *"))).toBe("Every 5 minutes")` would cover the `hour === "*"` path in `formatCommonCronExpression`.

How can I resolve this? If you propose a fix, please make it concise.

Comment thread ui/src/ui/presenter.ts
Comment on lines +80 to +84
if (minute === "0") {
const hourStep = parsePositiveCronStep(hour);
if (hourStep !== null) {
return `Every ${formatCronIntervalUnit(hourStep, "hour")}`;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 0 * * * * falls through to raw cron display

The hourly-step branch only matches 0 */N * * * (the step form). The plain 0 * * * *, which is the most idiomatic "every hour" expression cron generators emit, falls through to Cron 0 * * * *. This may be intentional scope, but worth considering alongside */1 which is rarely used in practice. A simple string equality check could cover it:

if (minute === "0") {
  if (hour === "*") {
    return `Every ${formatCronIntervalUnit(1, "hour")}`;
  }
  const hourStep = parsePositiveCronStep(hour);
  if (hourStep !== null) {
    return `Every ${formatCronIntervalUnit(hourStep, "hour")}`;
  }
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/presenter.ts
Line: 80-84

Comment:
**`0 * * * *` falls through to raw cron display**

The hourly-step branch only matches `0 */N * * *` (the step form). The plain `0 * * * *`, which is the most idiomatic "every hour" expression cron generators emit, falls through to `Cron 0 * * * *`. This may be intentional scope, but worth considering alongside `*/1` which is rarely used in practice. A simple string equality check could cover it:

```ts
if (minute === "0") {
  if (hour === "*") {
    return `Every ${formatCronIntervalUnit(1, "hour")}`;
  }
  const hourStep = parsePositiveCronStep(hour);
  if (hourStep !== null) {
    return `Every ${formatCronIntervalUnit(hourStep, "hour")}`;
  }
}
```

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d16967553c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/ui/presenter.ts
Comment on lines +59 to +65
function parsePositiveCronStep(field: string): number | null {
const match = field.match(/^\*\/([1-9]\d*)$/);
if (!match) {
return null;
}
const step = Number(match[1]);
return Number.isSafeInteger(step) ? step : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate cron step ranges before humanizing schedule

parsePositiveCronStep treats any positive integer as a valid step, so cron strings like */70 * * * * or 0 */25 * * * get rendered as “Every 70 minutes” / “Every 25 hours” instead of staying on the raw Cron ... fallback. In environments where malformed cron expressions can still exist in stored jobs, this makes an invalid schedule look valid and obscures why the job is failing; the formatter should only humanize steps that are within the allowed field ranges for minutes/hours.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep this PR open, but it is not merge-ready: the small Control UI formatter is useful polish, yet it can make invalid cron expressions look valid and the external PR still has only unit-test validation rather than real UI proof.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes for the PR-introduced formatter bug by source inspection: the added parser accepts out-of-range positive steps that Croner rejects. I did not run the Control UI because this read-only review cannot provide the contributor's required real behavior proof.

Is this the best way to solve the issue?

No as-is. The presenter is an acceptable narrow layer for display polish, but it must share Croner's valid field bounds or use a safe parser so only exact supported patterns are humanized.

Security review:

Security review cleared: The diff only changes Control UI formatting code and a colocated unit test; no dependency, workflow, secret, permission, install, publishing, or code-execution surface is changed.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-12T14:09:32Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • joshavant: Current-main formatCronSchedule, its Cron Jobs call site, and adjacent cron semantics were most recently carried by the merged cron scoping work in commit cee2aca40912 / Scope agent cron operations to the calling agent #96883. (role: recent area contributor; confidence: high; commits: cee2aca40912; files: ui/src/ui/presenter.ts, ui/src/ui/views/cron.ts, src/cron/stagger.ts)
  • steipete: Peter Steinberger appears repeatedly in the UI and cron history and posted the close analysis for the related cron-display report, making this a useful routing signal for the UI behavior boundary. (role: feature-history contributor; confidence: medium; commits: e1fe71872c33, 39bcf695dce4, 19d0c2dd1d25; files: ui/src/ui/views/cron.ts, src/cron/service.issue-66019-unresolved-next-run.test.ts, src/cron/service/jobs.ts)
  • Val Alexander: Val Alexander carried earlier Control UI dashboard/view refactors in the same UI surface area before the current presenter split. (role: adjacent UI contributor; confidence: medium; commits: 5464ad113e2c, f76a3c5225bb; files: ui/src/ui/views/cron.ts, ui/src/ui/presenter.ts)

Codex review notes: model internal, reasoning high; reviewed against 3630d502eb9b.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 13, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jun 16, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 17, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 17, 2026
@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants