Skip to content

fix: keep one-time watchers armed when required delivery fails - #208193

Merged
daniel-lxs merged 2 commits into
mainfrom
openclaw/trigger-once-disarms-on-failed-webhook-93de69
Nov 29, 2026
Merged

daniel-lxs merged 2 commits into
mainfrom
openclaw/trigger-once-disarms-on-failed-webhook-93de69

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

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 --at jobs 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 used openclaw automations run <id> --wait, then read history and job state through the CLI. The receiver saw watcher-output before returning each status.

Revision and receiver Wait exit Payload Completion / delivery Watcher afterward
Main 6651072, HTTP 503 1 ok failed / not-delivered Disabled, no next run
Fix 2cdb1d4, HTTP 503 1 ok failed / not-delivered Enabled, next run scheduled
Same fixed watcher, receiver switched to HTTP 204 0 ok succeeded / delivered Disabled, no next run

The new regression failed on main: the watcher was disabled and its cursor advanced from unseen to seen. 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 head d9b6d15 has the same Git tree as the tested fix. I did not wait for an hourly timer tick or exercise a live external channel.

Terminal comparison of the real CLI readbacks on main and the fix

Reported and co-authored by @daniel-lxs.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 29, 2026 09:28
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84
@clawsweeper

clawsweeper Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Recorded CLI fields from the real Gateway runs on Crabbox AWS. On the fix, the same watcher stayed armed after HTTP 503 and disarmed after HTTP 204.

Terminal comparison of main and fixed watcher state after real HTTP responses

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS labels Nov 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. labels Nov 29, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 29, 2026 09:34
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 29, 2026
@clawsweeper

clawsweeper Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

The 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.

  • Before: The watcher advances its cursor and disables itself despite recording failed delivery.
  • After: The watcher retains its previous cursor and a future check; after HTTP 204 completes a later run, it disables itself.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with real CLI evidence and a meaningful service regression; startup recovery is source-reviewed rather than demonstrated by the supplied live proof, and CI is unfinished.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The inspected terminal evidence records the shipped automations CLI against an isolated Gateway and real HTTP receiver: the fixed watcher remains scheduled after HTTP 503 and disables after HTTP 204; the body identifies tested revision 2cdb1d4 and reports the published head has the same tree.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A one-time watcher silently stops checking after its payload succeeds even though required delivery fails.
Reason: The maintainer-authored direction restores an evidenced watcher contract with a small change and clearly documents that a later check may execute the payload again.

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: d9b6d150f6bb777622d5ee2a9fca168b88a3fd95

Before merge

None.

Findings

None.

Agent review details

How this fits together

Cron 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
Loading

Technical review

Best 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

  • Once-watcher cursor persistence and disarming changes intended behavior with a stated reason (a6768d9: The original event-trigger implementation retained prior state after failed fired runs so later evaluations could detect the event again; the linked historical Gateway proof also retained watchers after delivery failure. Local historical blob inspection encountered disabled lazy fetching, while GitHub commit patches and merged PR descriptions supplied the relevant intent.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8e1c238 adds src/cron/service/timer-trigger.ts:93 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8e1c238c1c25; files: src/cron/service/timer-trigger.ts)
  • Jason (Json): Raw commit 530d5bd adds src/cron/service/timer-trigger.ts:71 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 530d5bd37f86; files: src/cron/service/timer-trigger.ts)
  • RoboClaw: Raw commit e210870 adds src/cron/service/timer-trigger.ts:95 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: e210870acfe2; files: src/cron/service/timer-trigger.ts)

PR surface

Source 0, Tests +34, Docs 0. Total +34 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 7 7 0
Tests 1 34 0 +34
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 42 8 +34

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 29, 2026, 4:39 AM ET / 09:39 UTC.

@daniel-lxs
daniel-lxs merged commit 39d230c into main Nov 29, 2026
215 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/trigger-once-disarms-on-failed-webhook-93de69 branch November 29, 2026 10:50
obviyus added a commit that referenced this pull request Nov 29, 2026
… 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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 29, 2026
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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
…law#208193)

Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 83b977a2-cda5-47cf-a092-b7b9110d7b84
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants