Repository navigation
perf(agents): ship one automations job schema for add and update - #121645
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 10, 2026, 3:49 PM ET / 19:49 UTC. ClawSweeper reviewWhat this changesThe PR replaces separate Automations add and update job schemas with one nullable job object, then refreshes the affected prompt snapshots. Merge readiness⛔ Blocked by patch quality or review findings - 7 items remain Two source-proven scheduler-contract defects block merge: the shared schema advertises an update field that Gateway rejects, and add-time null cleanup can leave an invalid empty delivery object. Priority: P2 Review scores
Verification
How this fits togetherThe Automations tool is injected into agent context and turns model scheduler requests into Gateway cron add or update calls. Gateway preserves distinct strict contracts for complete job creation and partial job updates. flowchart LR
A[Agent prompt] --> B[Automations schema]
B --> C[Model scheduler request]
C --> D[Tool normalization]
D --> E{Add or update}
E --> F[Gateway cron add]
E --> G[Gateway cron update]
F --> H[Scheduled job]
G --> H
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -60, Tests -374. Total -434 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the one-schema design, but mark every create-only field explicitly and omit empty optional containers after add-time null removal. Do we have a high-confidence way to reproduce the issue? Yes, by source: update job.owner reaches the closed Gateway patch schema, and add delivery.completionDestination:null is stripped to delivery:{} before create validation. Is this the best way to solve the issue? No: consolidation is the right direction, but it must preserve action-specific field limits and no-op clear semantics before replacing the separate schemas. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8a5978154f69. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
f0e0d29 to
d0aedfb
Compare
The automations tool shipped two near-duplicate ~1.4k-token object schemas (job for add, patch for update) in every prompt on the default tool path — 13,016 chars of tool schema, 88% of it the duplicated pair. One nullable object schema now serves both actions (7,864 chars, ~1.3k tokens saved per prompt): update reads the job parameter, and the add path strips null clears before the strict gateway cron.add contract while preserving the agentId/sessionKey nulls that cron.add accepts. Fixes #121606
d0aedfb to
1c4f3f2
Compare
|
Merged via squash.
|
…nclaw#121645) The automations tool shipped two near-duplicate ~1.4k-token object schemas (job for add, patch for update) in every prompt on the default tool path — 13,016 chars of tool schema, 88% of it the duplicated pair. One nullable object schema now serves both actions (7,864 chars, ~1.3k tokens saved per prompt): update reads the job parameter, and the add path strips null clears before the strict gateway cron.add contract while preserving the agentId/sessionKey nulls that cron.add accepts. Fixes openclaw#121606
What Problem This Solves
The
automationstool's JSON Schema was the single largest tool-schema item on the default tool path: 13,016 chars (~3.25k tokens) in every prompt, 88% of it two hand-maintained near-duplicate parameters —job(5,533 chars,addonly) andpatch(5,922 chars,updateonly). Both shipped on every turn even though each applies to one of ten actions. Fixes #121606.Why This Change Was Made
Issue #121606 listed three options.
$defs/$refsharing (option 1) is blocked by the llama.cpp GBNF projection guard (findLlamacppGbnfSchemaViolationsincron-tool.schema.test.ts) and OpenAPI-3.0-subset providers. This PR implements option 2: one shared object schema for both actions, matching the repo's one-canonical-flow preference.src/agents/tools/cron-tool-schema.ts:createCronPatchObjectSchema()and the entirenullableClearsparameterization are deleted. OnecreateCronJobObjectSchema()(nullable-clear everywhere the patch was, plus the add-onlydeclarationKey/ownerfields) servesaddandupdate. The object's description states the per-action semantics.updatenow reads thejobparameter; thepatchparameter is removed cleanly (rootAGENTS.md: no hidden compat for model-facing params). The tool description documentsupdate jobId job (partial: only supplied fields change; null clears).addpath strips null-valued fields (stripCronCreateNullClears) before the strict gatewaycron.addcontract, which rejects the nullscron.updateaccepts. A null clear on create is a no-op. Top-levelagentId/sessionKeynulls are preserved:CronAddParamsSchemaaccepts them and a nullsessionKeyintentionally suppresses default creator-session binding (cron-tool.ts).CronAddParamsSchema/CronUpdateParamsSchema) is untouched; this is a model-facing tool-boundary change only.User Impact
Every turn of every agent on the default tool path gets ~5.2k fewer schema chars (~1.3k tokens, −40% of the automations schema): 13,016 → 7,864 chars. The Codex dynamic-tools catalog snapshot dropped from 65,134 to 51,863 chars (~3.3k rough tokens including serialization overhead). Accepted inputs are unchanged for
add;updatecalls move their patch object frompatchtojob, and nulls sent onadd(previously schema-invalid) are now tolerated as no-ops instead of failing at the gateway.Note: this branch briefly carried a
config/env-var-count-budget.txt507→503 ratchet fix for then-redmain; #121644 landed the identical change first and the commit auto-dropped on rebase.Evidence
createCronToolSchema()serialized): 13,016 chars /patch5,922 +job5,533 → 7,864 chars /job6,312, nopatch. ~1,290 tokens saved per prompt.node scripts/run-vitest.mjs src/agents/tools/cron-tool.test.ts src/agents/tools/cron-tool.flat-params.test.ts src/agents/tools/cron-tool.schema.test.ts— 245 tests green, including the llama.cpp GBNF projection guard, OpenAPI-3.0 provider projections (Gemini/jjcc), and a new regression test provingaddstrips null clears beforecron.addwhile preserving thesessionKey: nullbinding-suppression contract.node scripts/run-vitest.mjs src/agents/tools/cron-tool-creator-cap.test.ts src/cron/normalize.test.ts src/gateway/server-methods— green.pnpm prompt:snapshots:gen+pnpm prompt:snapshots:check— snapshots current.