Skip to content

fix(cron): persist delivery suppression reason and log strict failures - #130811

Merged
steipete merged 1 commit into
mainfrom
steipete/cron-delivery-suppression-reason
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cron-delivery-suppression-reason

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Two recording gaps in cron delivery, one doctrine: record facts where they happen.

  1. deliverySuppressionReason was typed, set, and then dropped. The isolated runner records why a delivery was intentionally suppressed (e.g. a <silent> reply) in delivery-dispatch.ts, but timer-execution.ts forwarded the run result field-by-field and omitted it — so an intentional silent reply and an unexplained non-delivery were indistinguishable in job state, run history, the finished event, and every operator surface.
  2. Strict (non-bestEffort) delivery failures produced no log line. The catch returned status:"error" silently; only the bestEffort path logged.

Why This Change Was Made

The reason now follows the exact threading precedent #95419 established for deliveryError: isolated-run result → timer execution → resolved delivery state → persisted job state → scheduled/manual finished events → task-backed run history → job API projections and cron plugin hooks. Later outcomes and restart interruption repair clear stale reasons; finalized-run recovery restores recorded ones. Storage stayed additive-optional: the field rides the existing state_json column and task-detail JSON codec — no DDL, no columns, no migrations, no schema-version change. Protocol schemas gained Type.Optional(Type.String()) on the three closed objects (additive-first), with generated Swift parity verified by scripts/protocol-gen-swift.ts --check; a direct schema probe accepted all four reasons and older records with the field absent. The strict-path failure now uses the existing single error-log call, labelled required vs bestEffort. Explicitly untouched: the intentional post-delivery ok-downgrade (#94058), completion policy/required-delivery defaults, and failure-alert routing (those are separate product decisions).

LOC: handwritten production +57/−4; generated Swift +8; tests +103; docs +1.

User Impact

Run logs, cron runs, the finished event, and the job API now say why a cron run delivered nothing when it was intentional — and operators tailing logs see strict delivery failures the moment they happen.

Evidence

  • Pre-fix proofs: the persistence regression failed on all three requested surfaces (job state, run history, finished event) for both scheduled and manual runs; the strict-log regression observed zero log calls for a required-delivery failure.
  • Post-fix: 352 tests green across seven cron suites; 34 protocol validator tests green; 502 tests green on the macOS-CI file selection; focused suites re-run green after rebase onto latest origin/main.
  • Full changed-file gate: all 30 planned checks passed (production/test types, full core lint incl. the 1,000-line max-lines split into a colocated regression file, SwiftLint 0.65.0 pinned-tool run with zero violations, sidecar/import-cycle/storage guards). Worktree-only environment repairs (ui/node_modules and playwright-core links to the primary install) are documented in the worker report; no dependency files changed.
  • Codex autoreview: clean, no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: S labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 07:57
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 27, 2026
@steipete
steipete merged commit 63e6869 into main Aug 27, 2026
273 checks passed
@steipete
steipete deleted the steipete/cron-delivery-suppression-reason branch August 27, 2026 08:22
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant