Repository navigation
fix(cron): make condition watcher authoring reliable - #104787
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 479e1e0bd4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| everyMs: 250 | ||
| trigger: | ||
| script: "const count = (trigger.state?.count ?? 0) + 1; return { fire: count >= 6, state: { count } };" |
There was a problem hiding this comment.
Widen the quiet-observation window
With everyMs: 250 and fire: count >= 6, there are only four intervals (~1 second) between the first passing quiet condition (count >= 2) and the fired run. On a loaded Gateway/CI run where the first cron.get/cron.runs poll lands after that window, runs.entries.length is already 1 forever, so the waitForCondition later in the scenario times out even though the watcher behaved correctly. Use a much higher fire threshold or otherwise hold the job after the quiet checkpoint before waiting for the natural fire.
Useful? React with 👍 / 👎.
|
Land-ready verification complete for
Known proof gaps: none for the changed surface. |
|
Merged via squash.
|
* fix(cron): teach agents condition watcher contract * chore: defer cron note to release closeout
Closes #104780
What Problem This Solves
Fixes an issue where agents creating event-based cron condition watchers could omit required runtime semantics or silently choose announce delivery for a headless job, causing an otherwise successful fired payload to fail when no channel route exists.
The feature also lacked deterministic Gateway coverage proving that quiet evaluations persist state without run history before a natural one-shot fire.
Why This Change Was Made
The cron tool description now gives agents the complete condition-watcher contract: operator opt-in, immutable prior state and replacement state, quiet tick behavior, success-only fired-state persistence, explicit silent delivery,
oncesemantics, evaluation budgets, and hidden Code Mode tool access.A new QA Lab scenario exercises the real Gateway scheduler and timer. It proves quiet state with zero run rows, waits for a natural fired command payload, checks
triggerFired, and verifies thatoncedisarms the job after success. Prompt snapshots and a focused description regression test keep the model-facing contract stable.User Impact
Agents can create silent event-based cron watchers reliably in one pass and accurately explain their lifecycle. Operators get permanent regression coverage for the quiet-poll, fired-payload, state-persistence, and one-shot invariants.
Evidence
EVENT_CRON_RUNTIME_OK, onetriggerFiredrow, persisted state 4, and disabled the job (run_057816bfcaca,run_7836328fd63b).run_ac52302ae0dc).EVENT_CRON_AGENT_OK, but announce delivery had no route; the run failed, fired state stayed at 2, andoncestayed enabled (run_247058d7bd6c).delivery.mode: "none"(run_e49cd1a9976d). Natural evaluation 3 produced exactlyEVENT_CRON_AGENT_OK, recorded one successfultriggerFiredrow, persisted state 3, and disabled the job (run_56c9324744e9).pnpm test src/agents/tools/cron-tool.test.ts— 143 passed;pnpm openclaw qa suite --provider-mode mock-openai --scenario cron-condition-watcher— 1 passed (run_dbc6598f6507).run_d4d33205ee1a).run_835412fd0f35).AI-assisted change; implementation and live behavior were inspected and validated end to end.