Repository navigation
fix: keep one-time watchers armed when required delivery fails - #208193
Conversation
Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: passed. What this changesThe PR keeps one-time condition watchers armed and preserves their condition state until execution and required delivery succeed. Example: A once watcher runs successfully, but its required webhook returns HTTP 503.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a current watcher lifecycle bug with a focused change and no blocking source findings. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron evaluates a condition, executes its payload, settles delivery, and applies the recorded completion outcome to persisted watcher state and scheduling. flowchart LR
A[Scheduled condition check] --> B[Trigger evaluation]
B --> C[Payload execution]
C --> D[Required delivery]
D --> E[Recorded completion]
E --> F[Watcher state and scheduling]
E --> G[Startup recovery]
G --> F
Technical reviewBest possible solution: Use the existing delivery-aware completion result for once-watcher cursor persistence and disarming in both normal finalization and startup recovery. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the execution-ok, required-delivery-failed path, and the supplied CLI capture demonstrates it on the stated main revision; this read-only review ran no target code. Is this the best way to solve the issue? The change repairs the existing lifecycle owner without adding retry machinery, changing execution counters, or altering timed one-shot policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 211715359c34. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +34, Docs 0. Total +34 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 Reviewed November 29, 2026, 4:39 AM ET / 09:39 UTC. |
… test (#208309) ## What Problem This Solves Scheduled CI run 46257208997 fails `src/cron/service.stream-validation.test.ts` › "composes a final batch and rotates source identity when a once trigger disables the stream": `expected true to be false` at the `enabled` check. #208193 made a once trigger disarm only when the whole run completes successfully (`completionStatus === "succeeded"`), so a failed required delivery keeps the watcher armed. This test's job uses the default `announce` delivery, but its mocked agent run returns `{ status: "ok" }` with no delivery outcome. The run's delivery status is therefore `unknown`, completion is not `succeeded`, and the watcher correctly stays armed. ## Fix Test-only. The mocked run now reports `delivered: true`, which models the completed run the test means. The subject (final batch composition, disable and source-identity rotation) is unchanged. No product code changes. ## Why main went red #208193's PR CI selected changed-file tests only. Its node lanes ran `service.trigger-eval.test.ts` and other cron tests, but never this file, which reaches `timer-trigger.ts` only through `CronService`. The scheduled full run was the first to execute it. ## Evidence - origin/main: this test fails (1 failed, 11 passed). - With the fix: 12/12 pass. - Parent of #208193: the original test passes (12/12), and the updated test also passes there. Co-authored-by: Ayaan Zaidi <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84 (cherry picked from commit 39d230c) Release adaptation: Apply the upstream #208309 test-only companion: a successful default announce in the once-stream composition must report delivered=true. Companions: Included fixture fix-up from 4bd7eaf (#208309); broad UI/Doctor PR-number matches are unrelated. Co-authored-by: RomneyDa <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84 (cherry picked from commit 39d230c) Release adaptation: None; source applies intact to current stable owner. Companion audit: Keep the once watcher armed and preserve the cursor on required delivery failure in live and startup settlement. Compatible with existing authoritative run-outcome owner. Co-authored-by: RomneyDa <[email protected]>
…law#208193) Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84
… test (openclaw#208309) ## What Problem This Solves Scheduled CI run 46257208997 fails `src/cron/service.stream-validation.test.ts` › "composes a final batch and rotates source identity when a once trigger disables the stream": `expected true to be false` at the `enabled` check. openclaw#208193 made a once trigger disarm only when the whole run completes successfully (`completionStatus === "succeeded"`), so a failed required delivery keeps the watcher armed. This test's job uses the default `announce` delivery, but its mocked agent run returns `{ status: "ok" }` with no delivery outcome. The run's delivery status is therefore `unknown`, completion is not `succeeded`, and the watcher correctly stays armed. ## Fix Test-only. The mocked run now reports `delivered: true`, which models the completed run the test means. The subject (final batch composition, disable and source-identity rotation) is unchanged. No product code changes. ## Why main went red openclaw#208193's PR CI selected changed-file tests only. Its node lanes ran `service.trigger-eval.test.ts` and other cron tests, but never this file, which reaches `timer-trigger.ts` only through `CronService`. The scheduled full run was the first to execute it. ## Evidence - origin/main: this test fails (1 failed, 11 passed). - With the fix: 12/12 pass. - Parent of openclaw#208193: the original test passes (12/12), and the updated test also passes there. Co-authored-by: Ayaan Zaidi <[email protected]>

What Problem This Solves
A one-time condition watcher stops checking after its command succeeds even if the required webhook rejects the result. Run history correctly says delivery failed, but the watcher is disabled with no next run.
User Impact
A failed required delivery leaves the watcher scheduled and preserves its previous condition state. The next check evaluates the condition again. If it still fires, the payload can run again; this is not a delivery-only retry. Once the run completes successfully, the watcher disables itself as before. No configuration change is needed.
Why This Change Was Made
The scheduler already records whether the whole run succeeded under its delivery policy. The once watcher now uses that same result for both its cursor and its decision to disarm, including when restoring a finalized run at startup. Non-once watchers, timed
--atjobs and execution retry counters are unchanged.This restores the condition-watcher behavior observed in #104787: failed delivery left the watcher armed with its previous cursor. It preserves the separate timed one-shot no-replay decision.
Evidence
I ran an hourly isolated command watcher with
--trigger-once, a condition returning{ fire: true }, and a real HTTP receiver on Crabbox AWS. I usedopenclaw automations run <id> --wait, then read history and job state through the CLI. The receiver sawwatcher-outputbefore returning each status.6651072, HTTP 5032cdb1d4, HTTP 503The new regression failed on main: the watcher was disabled and its cursor advanced from
unseentoseen. On the fix, all 30 tests in the trigger-evaluation and completion-status suites passed, along with the core typecheck and targeted lint and formatting checks. The published headd9b6d15has the same Git tree as the tested fix. I did not wait for an hourly timer tick or exercise a live external channel.Reported and co-authored by @daniel-lxs.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by
🦞 Made with OpenClaw