#15446: feat(cron): support prefix matching for job IDs
stale
size: XS
Cluster:
Cron Job Enhancements
Allow short ID prefixes to match cron jobs, similar to how Git handles short commit hashes. If the prefix uniquely matches one job, it resolves to that job. If multiple jobs match, an error lists the ambiguous matches.
This removes the need to copy full UUIDs when interacting with cron jobs via the tool interface.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `src/cron/service/jobs.ts` to allow resolving cron jobs by a unique ID prefix, similar to short git hashes. `findJobOrThrow` now attempts an exact `id` match first, then falls back to prefix matching across stored job IDs; if the prefix matches multiple jobs it throws an error listing the matching job IDs, and if it matches none it throws the existing “unknown cron job id” error.
This behavior is used by cron operations like `cron.update` and `cron.run` (via `src/cron/service/ops.ts`), improving ergonomics when users interact with cron jobs through the tool/gateway interface without needing to paste full UUIDs.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Change is tightly scoped to cron job lookup, with clear exact-match-first behavior and deterministic erroring on ambiguous prefixes. External inputs are already validated as NonEmptyString by the gateway protocol schemas, which avoids empty-prefix edge cases at the primary call paths.
- src/cron/service/jobs.ts
<sub>Last reviewed commit: e33f010</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7984: fix undefined variable in cron
by ThunderDrag · 2026-02-03
77.0%
#5428: fix(Cron): prevent one-shot loop on skip
by imshrishk · 2026-01-31
76.4%
#8578: fix(cron): add failure limit and exponential backoff for isolated t...
by Baoxd123 · 2026-02-04
76.4%
#13592: feat(ui): group cron jobs by name folders
by turanalemfilms-cloud · 2026-02-10
76.3%
#2071: fix: accept JSON string for cron.add job parameter (#1940)
by andrescardonas7 · 2026-01-26
75.9%
#19372: fix(cron): normalize jobId → id for file-backed jobs
by namabile · 2026-02-17
75.9%
#8698: fix(cron): default enabled to true for new jobs
by emmick4 · 2026-02-04
75.7%
#12443: fix(cron): don't advance past-due jobs that haven't been executed
by rummangeminicode · 2026-02-09
75.4%
#9393: fix(cron): avoid recomputeNextRuns on forceReload
by matthewpapa07 · 2026-02-05
75.2%
#12747: fix: catch up missed cron-expression job runs on restart
by obin94-commits · 2026-02-09
75.1%