Skip to content

fix(cron): add single-job get path for id-based inspection - #67677

Closed
zexho994 wants to merge 5 commits into
openclaw:mainfrom
zexho994:codex/fix-cron-get-by-id
Closed

zexho994 wants to merge 5 commits into
openclaw:mainfrom
zexho994:codex/fix-cron-get-by-id

Conversation

@zexho994

@zexho994 zexho994 commented Apr 16, 2026 •

Copy link
Copy Markdown

Summary

  • Problem: openclaw cron only supports full-job inspection via cron list --json, so consumers must fetch and filter the entire job set even when they already know the target job id.
  • Why it matters: this is inconsistent with existing id-based cron operations and wastes payload/token budget for agent-driven, scripted, and debugging workflows.
  • What changed: added cron.get plus openclaw cron get <id> for single-job inspection.
  • What did NOT change (scope boundary): no scheduling, execution, delivery, or existing cron list behavior changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: cron jobs are already modeled as id-addressable resources for mutate operations (edit, run, rm), but the CLI/RPC surface did not expose a matching single-job read path.
  • Missing detection / guardrail: there was no test coverage asserting parity between id-based cron mutation and id-based cron inspection.
  • Contributing context (if known): callers that already knew a job id still had to fetch the full job list and filter client-side.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • src/cli/cron-cli.test.ts
    • src/gateway/protocol/cron-validators.test.ts
    • src/gateway/server.cron.test.ts
  • Scenario the test should lock in: a caller can fetch one cron job by id through both CLI and gateway RPC, and missing ids fail cleanly.
  • Why this is the smallest reliable guardrail: the change is a CLI/protocol/server seam addition, so those seams are the narrowest place to lock the behavior.
  • Existing test that already covers this (if any): none.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • Added openclaw cron get <id> for single-job inspection.
  • Added gateway RPC cron.get.
  • Added the same single-job inspection path to the cron agent tool.

Diagram (if applicable)

Before:
[caller knows job id] -> [cron list --json] -> [filter full job set client-side]

After:
[caller knows job id] -> [cron get <id>] -> [single job payload]

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling size: S labels Apr 16, 2026
@greptile-apps

greptile-apps Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds cron.get / openclaw cron get <id> for single-job inspection, filling the gap between id-addressable cron mutations (edit, run, rm) and the read surface that previously required filtering the full cron list result. The change is additive and touches the expected layers: protocol schema, AJV validator, gateway handler, service contract + op, CLI subcommand, agent tool, method scope, and server method list.

Confidence Score: 5/5

Safe to merge; the only finding is a minor UX inconsistency with the --json flag that doesn't affect correctness.

All findings are P2. The implementation is consistent with existing cron op patterns, tests cover both the success and not-found paths, and the change is purely additive with no behavior changes to existing surfaces.

src/cli/cron-cli/register.cron-simple.ts — the --json flag is declared but never consulted.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-simple.ts
Line: 38-46

Comment:
**`--json` flag declared but never consulted**

`cron get` always calls `printCronJson(res)` regardless of `opts.json`, so the flag is a no-op. `cron list` explicitly checks `opts.json` to switch between `printCronList` (table) and `printCronJson` (raw), but `cron get` never reads the option. The flag is also surfaced in `docs/cli/index.md` as `cron get <id> [--json]`, which implies a non-JSON default format exists.

Two clean resolutions: (a) drop the `--json` option entirely since the output is always JSON, or (b) add a human-readable single-job view when `--json` is absent (e.g. wrap the job in a one-element array and call `printCronList`).

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

Reviews (1): Last reviewed commit: "fix(cron): add single-job get path for i..." | Re-trigger Greptile

@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: 5c027bdce4

ℹ️ 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 src/gateway/protocol/index.ts Resolved

@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: 14e0705bf1

ℹ️ 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".

@zexho994

Copy link
Copy Markdown
Author
image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: add single-job inspection by id

1 participant