← Back to PRs

#15446: feat(cron): support prefix matching for job IDs

by andrewdamelio open 2026-02-13 13:14 View on GitHub →
stale size: XS
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