fix(cron): run named jobs without unnecessary list scans - #83477
fix(cron): run named jobs without unnecessary list scans#83477fangliquanflq wants to merge 1 commit into
Conversation
fix(cron): run named jobs without unnecessary list scans
|
|
Thanks for the review. I checked each point against the current head and the original schema-test intent:
Verification: |
Confirmed — AmbiguousJobReference handling and schema-test intent confirmed at head. No further blockers. |
|
Thanks for confirming. No further code changes are needed: the current head catches |
What does this PR do?
When a user asks Hermes to run, pause, or resume a scheduled job by its exact name, the tool guidance currently tells the model to list every job first. That unnecessary visual scan can make the model miss a job that the server could resolve deterministically. This change directs non-destructive actions to the existing exact-name resolver while preserving list-first ID verification for removal.
Symptom
A request to trigger a job by its exact name can produce an unnecessary
action='list'call followed by a false claim that the job does not exist, even when the target is present in the returned list.Impact
Users can fail to run, pause, or resume existing scheduled jobs by name. The extra list response also adds avoidable context and latency.
Bug Cause
Trigger:
tools/cronjob_tools.py:1452/ thecronjobschema description for job-management actionsCausal chain:
run,pause, orresumeusing an exact job name.Why it is wrong: The server already accepts a job ID or exact case-insensitive name for these non-destructive actions and reports missing or ambiguous names explicitly.
Working sibling / contrast: Removal is destructive, so listing jobs and verifying the concrete ID remains the appropriate safe path.
Ruled out: The runtime resolver is not missing or nondeterministic; existing tool tests verify exact-name resolution, ambiguity handling, and not-found behavior. The defect is the broader schema guidance that discourages using that resolver.
Fix
The schema now tells
run,pause, andresumecallers to pass an exact job name directly and list only after a not-found or ambiguity response. Separate removal guidance still requires listing first and using a verified job ID. Runtime schema-contract tests cover both requirements.Related Issue
Closes #83470
Type of Change
Changes Made
tools/cronjob_tools.py- scope list-first safety guidance to removal and document exact-name resolution for non-destructive actions.tests/cron/test_cronjob_schema.py- add runtime schema-contract coverage for direct name lookup and destructive removal safety.How to Test
CRONJOB_SCHEMAand verify its description directsrun,pause, andresumeto exact case-insensitive name resolution without a preliminary list call.action='list', a verified ID, and no guessed deletion target.Expected result: 68 tool tests and 3 schema tests pass.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.exampleupdates are N/A because no config keys changedCONTRIBUTING.mdandAGENTS.mdupdates are N/A because no architecture or workflow changedScreenshots / Logs
N/A - focused automated tests exercise the imported runtime schema contract.