Skip to content

improve: Doctor flags cron failure alerts that could not be delivered - #188946

Open
Nikhil-jaiswal007 wants to merge 2 commits into
openclaw:mainfrom
Nikhil-jaiswal007:fix/doctor-cron-alert-delivery-diagnostic
Open

Nikhil-jaiswal007 wants to merge 2 commits into
openclaw:mainfrom
Nikhil-jaiswal007:fix/doctor-cron-alert-delivery-diagnostic

Conversation

@Nikhil-jaiswal007

Copy link
Copy Markdown

Related: #186990

What Problem This Solves

Fixes the Doctor gap behind #186990: when a scheduled automation fails and its failure alert cannot be delivered (for example on a gateway with no messaging channel configured), the delivery failure was recorded only in the job's state fields, and openclaw doctor never surfaced it.

User Impact

User impact: operators running openclaw doctor now see which automations have an undeliverable failure alert, the recorded reason (such as "Channel is required (no configured channels detected)"), and what to do next: configure a messaging channel for the Gateway or set an explicit delivery target on the job. No behavior changes outside Doctor output, and the check is read-only.

Why This Change Was Made

Doctor already reports chronic failures, auto-disabled jobs, and in-flight markers, but it did not read the settled alert-delivery result. This adds a finding next to those, driven by lastFailureNotificationDeliveryStatus and lastFailureNotificationDeliveryError.

Scope follows the agreement in the issue thread:

  • Only not-delivered warns. delivered, not-requested, unknown, and absent fields stay silent, so an unsettled delivery is never reported as a failure.
  • The recorded reason is sanitized before display (control characters stripped, whitespace collapsed, capped at 200 characters).
  • Repair-brief wording and deduplication of repair requests are deliberately untouched. Current source already has a repair-per-streak marker and an owner-directed fallback, and the reporter is running the bounded repro to settle those separately. This PR uses Related: rather than Closes for that reason.
Implementation notes
  • Detection lives in inspectCronJobHealth and runs for enabled and disabled jobs, so it is placed before the early continue that only the auto-disabled path needs.
  • Tests are in a new index.failure-alert.test.ts because index.test.ts is already at the repo's file-length cap.
  • docs/cli/doctor/checks.md lists the new check beside the other cron reports.

Evidence

  • New tests (3 passed) cover: a channel-less failed alert produces the warning with job name, recorded reason, and fix hint; a delivered alert produces no warning; not-requested, unknown, and missing fields produce no warning. These match the verification criteria the maintainer set on the issue.
  • pnpm tsgo:core passes.
  • Existing index.test.ts: 27 of 28 pass, and the one failure (reports a moved partition, refuses --yes guessing...) also fails on unmodified upstream/main on Windows. The message embeds the store path JSON-escaped, so the raw-path match fails. It is unrelated to this change.
  • Docs file passes oxfmt --check.
  • On my Windows machine the local pre-commit hook cannot launch pnpm (spawn pnpm ENOENT), so I ran the docs checks manually and relied on CI for the rest.

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: S labels Oct 31, 2026
@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 9d744de8469d69022ff2f079a3ed31d69c7f683f, but the PR head is now d08e62572c98f3c1d5e578567ae69c1d3e562b81. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (1 earlier review cycle)
  • reviewed 2026-10-31T02:07:43.774Z sha 9d744de :: needs real behavior proof before merge. :: [P2] Preserve real terminal exports in the new note mock

@jerome-queck

Copy link
Copy Markdown
Contributor

Hi @Nikhil-jaiswal007, thanks for this. Your d08e625 already fixes the note-mock finding: check:test-mock-exports fails on 9d744de and passes on d08e625 for me on Linux. I opened #189881, which cherry-picks both of your commits unchanged (authorship kept) onto current main and adds a real openclaw doctor before/after capture with seeded cron state, which covers the proof ClawSweeper asked for. Credit is yours. If you'd rather paste that output here and request a fresh @clawsweeper re-review, I'm happy to close mine.

@Nikhil-jaiswal007

Copy link
Copy Markdown
Author

Hi @jerome-queck, thank you for verifying d08e625 on Linux and for keeping my authorship in #189881.

Your real openclaw doctor before/after capture is the proof ClawSweeper asked for, and I can't reproduce it on my Windows setup. I'm happy for #189881 to carry this change. I'll keep this PR open until a maintainer confirms which one to land, then
close it.

Thanks again for the collaboration.

@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants