Repository navigation
fix(cron): refuse an automation add that would silently save no tools - #167560
wangmiao0668000666 wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. What this changesThe automation tool rejects a new job when every explicitly requested tool is unavailable in the creating turn, instead of silently saving a job with no tools. Example: An agent creates an automation requesting toolsAllow: ["future__tool"] while its captured tools contain only read.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains This PR contains useful work that current main does not provide. The prior symbolic-selector finding is fixed, and no introduced correctness defect remains; changing the established creation-success behavior still needs the area's owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherOpenClaw's automation tool turns agent requests into scheduled jobs stored by the Gateway. Its creator-tool policy limits requested tools to those available to the creating turn before the job is saved. flowchart LR
A[Agent requests automation] --> B[Capture available creator tools]
B --> C[Intersect requested tool selection]
C --> D{Finite selection has no matches?}
D -->|Yes on new add| E[Return actionable error]
D -->|No| F[Gateway saves scheduled job]
F --> G[Scheduled execution applies tool policy]
Technical reviewBest possible solution: Approve the narrow add-time refusal while leaving authenticated native alias resolution and add/update identity consistency with the linked issue. Do we have a high-confidence way to reproduce the issue? Yes: current-main source saves an empty intersection for future__tool against a read-only capture, and the contributor supplies a baseline-to-head real-Gateway trace for that exact scenario. This read-only review did not execute the reproduction. Is this the best way to solve the issue? Yes for the narrow silent-creation problem: the change uses the existing cap owner and preserves partial matches, symbolic groups, and updates. It is only a partial response to the linked issue's native alias and add/update identity requirements. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2c5b2ccaa776. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +31, Tests +48. Total +79 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed October 9, 2026, 8:34 AM ET / 12:34 UTC (Revision 3). |
The unmatched-add refusal now fires only for finite selections. A symbolic selector such as group:plugins resolves at runtime, so an empty plugin expansion keeps the base behavior of an empty cap instead of throwing. Co-Authored-By: Claude Code <[email protected]>
48b7554 to
f4899c2
Compare
|
Round 2 addresses both blocking items from the last review. P2 finding (symbolic selectors rejected): the refusal is now gated on the existing finite/resolved request classification ( Real behavior proof: added to the body under "Real Gateway proof (no mocks at the behavior boundary)". A real Gateway (token auth, cron enabled, isolated temp state, SQLite cron store) is driven by a loopback mock model; the model calls
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Closing this PR: the current empty-intersection persistence is deliberate owner-designed behavior (introduced and tested in #130579 — the creator-cap contract intentionally saves the available intersection, including an empty one). This PR changes that established creation-success outcome, which is an area-owner design decision, not a defect fix. Withdrawing rather than leaving it parked on a maintainer decision. The silent-empty-cap observation stays documented in #167281 for the owner to weigh against the alias-resolution work there. |
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.*,group:*) whose runtime expansion is empty — e.g.group:pluginsagainst a capture with no plugin tools — keeps the base empty-cap behavior instead of throwing.Production LOC is
+32/-1in 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
f4899c2a010bafbb446d0e209bd095079c913a5b(branchfix/cron-creator-cap-silent-empty, rebased ontoorigin/main21ecc39d75d)origin/main21ecc39d75d(the rebase base); the RED runs below execute theorigin/mainbytes ofsrc/agents/tools/cron-tool-creator-cap.ts, and the bug is still present there — current main assigns the filtered creator tools directly totoolsAllowwithout rejecting a wholly unmatched finite selectioncapCronJobToolsAllowOnCreate(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 (Revision 1 unit-test lane)
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.Real Gateway proof (no mocks at the behavior boundary)
Revision 2, head
f4899c2a010bafbb446d0e209bd095079c913a5b. RealstartGatewayWithClientGateway (token auth, cron enabled, isolated temp state dir, SQLite cron store) driven by a loopback mock model server: the model calls theautomationstool withaction: "add"andpayload.toolsAllow: ["future__tool"]; the second provider request carries the tool result back, andcron.listis read afterward. The behavior boundary under test is the tool result the Gateway feeds the model plus the persisted job set — nocallGatewaymock anywhere in the path.Lane: this workstation, Node v24.18.0,
vitest run --config test/vitest/vitest.e2e.config.tsagainstsrc(tsx). The driver is an untracked proof file; it is not part of the PR diff.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 passed (Revision 1)vitest run src/agents/tools/cron-tool-creator-cap.test.ts src/agents/tools/cron-tool.test.ts— 78 passed (both files), including the new symbolic-group regression case (group:plugins, andgroup:pluginsmixed with an unmatched finite name, against aread-only capture both keep the empty-cap base behavior)node 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
+32/-1, one file+70/-22, two filesCRON_CREATOR_AUTHORITY_RECOVERY_MESSAGE) and the existing all-unmatched branch; no second guard, option, or validatorcron.add; nothing else changes.