Repository navigation
fix(cron): refuse an automation add that would silently save no tools - #167550
wangmiao0668000666 wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(cron): refuse an automation add that would silently save no tools This is item 1/1 in the current shard. Shard 0/1. This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
Related: #167281
What Problem This Solves
Fixes:
cronadd reports success but persiststoolsAllow: []when the request names only tools this turn does not hold, so the scheduled run silently has no tools and still reportsok.On a complete creator capture, a finite
toolsAllowrequest whose names all fall outside the captured surface is filtered to nothing bycapCronJobToolsAllow(src/agents/tools/cron-tool-creator-cap.ts), and that empty cap is written throughcron.add. #167281 hit this with a native Codex alias (mcp__<server>__get_calendar_view): add returned a job withtoolsAllow: []while update stored the same alias, and the scheduled run answered that the calendar tool "was unavailable in this run".The incomplete-capture variant of the same decision already refuses loudly (
INCOMPLETE_CRON_CREATOR_AUTHORITY_MESSAGE), so only the complete-capture path degrades silently.Why This Change Was Made
capCronJobToolsAllownow refuses — for add only — a non-empty finite request that intersects to nothing, naming the requested tools and reusing the existing recovery guidance (CRON_CREATOR_AUTHORITY_RECOVERY_MESSAGE). A complete capture is positive proof that the creator cannot use those names, so persisting[]hides a job that can never run as asked.cron.addis never called and the payload is left untouched.Production LOC is
+18/-2in the single owner. No new validator, option, configuration, persistence, or migration surface.Classification:
behavior-completingUser Impact
An automation can no longer be created that silently runs with zero tools: the add fails at creation time and the error names the tools this turn cannot use. A caller that asks for a tool it does not hold must retry with tools it does, or create the job from the CLI/Gateway with an explicit finite list.
No stored job, schedule, delivery, or configuration changes. Existing jobs and every update path are untouched; only a new add whose whole finite selection is unusable now fails instead of saving an empty cap.
Evidence
Exact-head proof receipt
48b7554745de2660ba35fd5a4823ed528a551d57(branchfix/cron-creator-cap-silent-empty)121417e32b0fec872d73a785865a47f1e25d797c(the branch base; none of the three touched files changed between that revision and50d7eb1b7fbc, verified withgit diff HEAD^ origin/main -- <files>)capCronJobToolsAllowOnCreate(real exported owner,src/agents/tools/cron-tool-creator-cap.ts) and the agent-tool entryexecuteCron→cron.add(src/agents/tools/cron-tool.ts:485)capCronJobToolsAllow(src/agents/tools/cron-tool-creator-cap.ts:270) →createToolPolicyMatcherintersectionpayload.toolsAllowcap and whethercron.addis calledpayload.toolsAllow, and thecron.addcall countInspectable RED -> GREEN terminal trace
Remote lane
10.54.159.54, Dockerlexiflow-all:latest, Nodev24.18.0, against a cleanorigin/maintree. Base bytes re-read asmd5 35578d47fcc9156f57a7bed48d7dfed7before each run and restored byte-identical afterwards.Verification
node scripts/run-vitest.mjs run src/agents/tools/cron-tool-creator-cap.test.ts src/agents/tools/cron-tool.test.ts --maxWorkers=1— 18 passed, 59 passednode scripts/run-vitest.mjs run src/agents/tools/cron-tool.management.test.ts src/agents/tools/cron-tool.output-contract.test.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.flat-params.test.ts --maxWorkers=1— 12 + 4 + 21 passed, including every update-patch casetsc -p tsconfig.core.json --noEmit— no diagnostic in any changed file (the worktree reports 613 pre-existing declaration-portability errors in unrelated*-test-supportfiles caused by this checkout's symlinkednode_modules)oxlinton the three changed files — 0 warnings, 0 errors;oxfmt --checkclean;git diff --checkcleancron-tool.test.ts, because its import graph switches Vitest to the compiled-subprocess worker and this host cannot restore the worker cache (openat2 beneath root: Function not implemented, the documented kernel 3.10 limit). That file's red→green above is the same command on the workstation lane; CI covers it.Scope and risk
+18/-2, one file+74/-32, two filesCRON_CREATOR_AUTHORITY_RECOVERY_MESSAGE) and the existing all-unmatched branch; no second guard, option, or validatorcron.add; nothing else changes.