Skip to content

fix(cron): carry the failure-alert delivery outcome in repair briefs - #188022

Open
Linux2010 wants to merge 10 commits into
openclaw:mainfrom
Linux2010:fix/186990-repair-brief-alert-delivery
Open

Linux2010 wants to merge 10 commits into
openclaw:mainfrom
Linux2010:fix/186990-repair-brief-alert-delivery

Conversation

@Linux2010

@Linux2010 Linux2010 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Related to #186990.

What Problem This Solves

Cron records a failed alert's delivery result on the job. The fallback conversation receives the original alert text and omits that delivery result. An owner repair brief also loses the previous alert outcome when the next run clears the per-run delivery fields.

User Impact

Fallback notices identify a settled delivery failure. A fallback already scoped to the private owner route also shows the redacted reason. An owner repair brief labels any retained outcome as the previous alert's, so the agent can distinguish it from the current failure.

Why This Change Was Made

Integrates upstream main at 10b7402043d and retains its current owner repair, deduplication, and routing policy. Captures the previous recorded delivery result before resetting per-run fields. When the transport settles as not-delivered, the existing fallback includes the status. Detailed errors are bounded, redacted, and wrapped as untrusted text for private fallbacks. Existing stale-cycle and private-delivery guards still control dispatch. #203362 separately addresses ambiguous timeout classification.

Evidence

A built channel-less Gateway ran the same isolated cron job against a loopback model fixture. The job failed on the base build e2de897bf5f and on the reviewed head 5b5172b43a9. In each run cron.get recorded not-delivered and the missing-channel explanation. The Gateway's persisted session events confirm the fallback text.

Built runtime Persisted fallback
Base e2de897bf5f, default fallback Automation failure and cause
Head 5b5172b43a9, default fallback Automation failure, cause, and Failure alert delivery: not-delivered.
Head 5b5172b43a9, private directPolicy: block fallback The same status and the actual missing-channel reason inside one untrusted-data block
  • The two added assertions failed on the integrated unpatched base 10b7402043d. Six focused suites passed 106 tests on the reviewed tree. They cover owner notices, previously settled status, public and private fallback behavior, credential redaction, stale cycles, and route selection.
  • pnpm build qaRuntime, core typecheck, scoped lint and formatting, and git diff --check passed. The runtime check used Node 26.12.1 on macOS with synthetic data and a loopback model endpoint. All isolated Gateways stopped cleanly.
  • The prior revision's owner-conversation transcript remains available as historical evidence. Revision 7

The report was closed by inactivity triage. It describes the original behavior, and the current proof above reproduces the omission in the fallback path. Issue closure

Review follow-up

Commit 71b856788d5 retains an explicitly typed mock for the optional session enqueue callback. The services-cron test typecheck now passes after reproducing the reported TS2532 on the preceding revision. All 106 focused tests passed again, as did scoped lint and formatting. This commit changes one test file. The Gateway evidence above applies to the same production source.

Live proof for the owner repair brief

Repeated the same two-run scenario on the built base e2de897bf5f and candidate 5b5172b43a9. The candidate has the same production code as current head 71b856788d5 (the intervening commit changes one test file).

  1. An isolated Gateway created an owned automation in an initialized conversation using the public cron.add RPC. The first run failed through the loopback model, and the explicit last-channel alert settled as not-delivered. cron.get recorded the missing-channel reason.
  2. An ordinary cron.update cleared the alert's explicit channel and selected a different synthetic failure for a second run of the same job. The owner and previous delivery status remained intact across the edit.
  3. The scheduler delivered the second run's repair brief into the owner conversation on both builds. Read-only inspection of the persisted transcript showed these differences:
Owner conversation transcript Base Candidate
Second run and current notice text present Yes Yes
Previous failure alert delivery: not-delivered. Absent Present
Previous missing-channel reason inside the untrusted-data block Absent Present

Both job runs recorded error on both builds. The second run's repair delivery settled as delivered on both builds. Both isolated Gateways stopped cleanly. Only the model responses were synthetic. The scheduler, transport, owner admission, and transcript storage used the built Gateway.

On a channel-less gateway a failing automation's operator alert cannot
be delivered: the delivery failure ('Channel is required (no configured
channels detected)') lands only in job state fields, while the repair
brief injected into the owner conversation says just 'No failure alert
was sent.' - the operator's only visible signal omits the reason
(openclaw#186990).

buildCronFailureRepairBrief now takes the last failure-alert delivery
outcome (from failureNotificationDeliveryFromJobState) and renders it:
the recorded status and reason when a delivery failed, the fact of
delivery when it succeeded, and the original bare sentence when no
attempt was recorded. The recurring variant keeps its consecutiveErrors
counter and the incident-level single-brief behavior stays as-is, so
each repair window still produces one counted brief rather than one per
run. The doctor/status-line visibility option from the report is left
as a follow-up (the report's Expected offers either).
@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@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 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR includes recorded failure-alert delivery outcomes in owner repair briefs and settled fallback notices.

Example: A channel-less Gateway cannot deliver an automation alert, and directPolicy is block.

  • Before: The private fallback describes the automation failure without explaining the failed alert delivery.
  • After: The fallback adds “Failure alert delivery: not-delivered.” and the redacted missing-channel reason inside an untrusted-data block.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with supplied Gateway proof, meaningful boundary coverage, and no remaining findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied built-Gateway run exercises scheduler failure, real channel selection, delivery settlement, and persisted fallback events on macOS with isolated synthetic state and a loopback model fixture; default fallbacks gain the status and private fallbacks also gain the redacted reason, while historical Gateway output covers the prior-outcome repair path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An automation's fallback notice omits the failed alert's delivery outcome, while a later repair brief loses the previously recorded result.
Reason: The change makes existing failure information usable without altering owner repair, deduplication, routing, defaults, or configuration.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR remains useful and resolves the prior typed-mock finding; no actionable code defects remain, but required hosted CI awaits approval.

Priority: P2
Reviewed head: 71b856788d5df66499bbf152ee28f66d30e707f8

Before merge

  • Await maintainer action - Approve the pending workflow runs for head 71b8567 so required CI can execute.

Findings

None.

Agent review details

How this fits together

Cron finalization turns run outcomes into committed notification intents; host dispatch transports alerts, records settlement, and queues fallback or owner-conversation notices.

flowchart TD
  A[Automation run outcome] --> B[Cron finalization]
  B --> C[Owner repair brief]
  B --> D[Failure alert transport]
  D --> E[Recorded delivery outcome]
  E --> F[Fallback session notice]
  E --> B
Loading

Technical review

Best possible solution:

Keep the existing notification owners and routing policy while carrying settled delivery facts into their existing diagnostic text.

Do we have a high-confidence way to reproduce the issue?

Current-main source shows the omission directly, and the contributor supplies base-versus-head Gateway evidence; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch is a small, complete fix for the stated text omission: it reuses recorded outcomes, existing dispatch boundaries, and one shared formatter without adding persistent state or competing notification policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5b2a999a3042.

Provenance checked

  • Owner repair briefs keeps the original intent (fb2052a: Send actionable repair requests into the owning conversation and wrap external text as untrusted data.)
  • Unified failure-notification policy keeps the original intent (9a12f4d: Use one threshold, cooldown, deduplication, and routing pipeline instead of a separate repair state machine.)
  • Settled fallback dispatch and privacy keeps the original intent (f59d9a8: Keep owner-targeted and blocked-direct-delivery fallbacks inside the session instead of sending to its last external conversation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1ccccb0 adds src/cron/service/notification-dispatch.ts:124 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1ccccb02788a; files: src/cron/service/notification-dispatch.ts)

PR surface

Source +39, Tests +33. Total +72 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 45 6 +39
Tests 2 69 36 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 114 42 +72

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 rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: This is a bounded diagnostic improvement for failed automation notifications, without changes to scheduling or delivery policy.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-30T01:52:51.409Z sha 94eaf14 :: needs real behavior proof before merge. :: [P2] Capture the settled outcome before starting the new cycle | [P3] Construct a valid typed cron fixture
  • reviewed 2026-10-30T05:06:14.064Z sha 3d46581 :: needs real behavior proof before merge. :: [P2] Surface the failure after alert delivery actually settles | [P2] Wrap delivery errors as untrusted prompt data
  • reviewed 2026-10-30T08:26:17.830Z sha 9f4c836 :: needs real behavior proof before merge. :: [P2] Surface the failure after alert delivery actually settles
  • reviewed 2026-10-30T08:32:54.307Z sha 9f4c836 :: needs real behavior proof before merge. :: [P2] Surface the failure after alert delivery actually settles
  • reviewed 2026-10-30T11:36:11.668Z sha d271903 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-31T09:55:20.425Z sha c26ca18 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-24T09:50:24.389Z sha 5b5172b :: blocked before merge. :: [P2] Retain a typed mock before reading the optional callback's calls

Reviewed November 24, 2026, 5:02 AM ET / 10:02 UTC (Revision 8).

Linux2010 added 2 commits October 30, 2026 12:58
The repair brief's alertDelivery read ran after two reset sites had
already cleared job state: run finalization resets
lastFailureNotification* to not-requested, then the new alert cycle
resets them again, so a channel-less gateway's recorded reason (e.g.
"Channel is required (no configured channels detected).") never
reached the brief. Capture the settled outcome before the run-level
reset and thread it through failure-alert finalization into the brief
(openclaw#186990, review finding P2).

The service-boundary regression fails on the prior head and passes
after this change.
Replace the as-unknown-as CronJob cast with the canonical cronTestJob
builder so job-contract changes stay type-checked, and drop the
standalone consecutive-counter case: the service.failure-repair suite
already asserts the recurring brief's counter (review finding P3).
@Linux2010

Copy link
Copy Markdown
Contributor Author

Addressed both review findings on head 94eaf14c313, plus the low-value test note. Scope unchanged: no budget, delivery, scheduling, or incident-state semantics touched; doctor/status-line stays a follow-up.

Finding → commit mapping

1. [P2] Capture the settled outcome before starting the new cycle (src/cron/service/failure-alerts.ts:501) → 8fd8fc6

Source tracing confirmed the read was too late, and actually behind two reset sites, not one:

  • applyJobResult (run finalization, timer-outcomes.ts) resets lastFailureNotification* to not-requested before the failure-alert path runs;
  • startFailureAlertCycle (via requestFailureNotification) resets them again, then the repair branch sets not-requested/unknown.

Fix: capture the prior settled outcome via failureNotificationDeliveryFromJobState before the run-level reset in applyJobResult, and thread it as priorAlertDelivery through finalizeCronFailureNotifications → maybeEmitFailureAlert → buildCronFailureRepairBrief. The service owner now carries the value end to end; the formatter is no longer fed a fresh post-reset read.

2. [P3] Construct a valid typed cron fixture (failure-repair-brief.test.ts:16) → 3d46581

The as unknown as CronJob cast is gone; the fixture is built with the canonical cronTestJob builder.

3. Low-value test note → 3d46581

The standalone consecutive-failure counter case is removed; service.failure-repair already asserts the recurring brief's counter ("failed 2").

Service-boundary regression (red on base, green after repair)

New test in service.failure-repair.test.ts: "carries the prior settled failure-alert delivery outcome into the repair brief". It seeds job state with the recorded channel-less outcome (not-delivered + "Channel is required (no configured channels detected)."), drives the run finalization path (applyJobResult), and asserts the queued failure-repair brief carries the reason.

  • Red on 94eaf14c313 (before the fix):
    × CronService failure repair > carries the prior settled failure-alert delivery outcome into the repair brief
      → expected 'Automation repair request from the sc…' to contain 'No failure alert was sent (last failu…'
      Test Files  1 failed (1)
          Tests  1 failed | 28 skipped (29)
    
    The queued brief read: failed 2 consecutive runs. No failure alert was sent. — the reason was lost, exactly as the review established.
  • Green after 8fd8fc6:
    Test Files  5 passed (5)  (failure-repair, failure-repair-brief, failure-alerts.outcome, failure-alerts.persistence, failure-alerts.account-routing)
        Tests  66 passed (66)
    

Local verification on the touched files: oxlint 0 warnings/0 errors, format check clean, tsc on the cron test shard shows no diagnostics in the touched files.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 30, 2026
Linux2010 added 2 commits October 30, 2026 16:19
…prompt data

Codex review (head 3d46581) flagged that delivery.error originates from
transport errors, is persisted without prompt escaping, and was interpolated
inline beside scheduler instructions, bypassing the wrapper used for the job's
other errors. Render the delivery status (internal enum) in the summary
sentence and move the transport error into a wrapUntrustedPromptDataBlock
bounded by the existing REPAIR_ERROR_MAX_CHARS, restoring the original intent
of fb2052a (external content presented as untrusted data).

Also replace the standalone recorded-delivery wording unit case with an
injection-boundary case (raw structural markup must stay escaped inside the
data block).
Add an owner-level sequence regression for the canonical openclaw#186990 lifecycle:
failure 1 requests repair before any alert is attempted, the post-deadline
alert's delivery settles as failed, and no later failure in the same streak
emits another brief carrying that settled error (signature dedup suppresses
identical failures; the finalizer captures the outcome but no brief consumes
it). Update the prior-delivery regression to the untrusted-block wording.
@Linux2010

Copy link
Copy Markdown
Contributor Author

Addressing the re-review on head 3d465815cfd. Finding → commit mapping:

1. [P2] Wrap delivery errors as untrusted prompt data → 2bd93b2959c

delivery.error no longer interpolates inline. The summary sentence now carries only the internal delivery.status enum; the transport error is rendered through wrapUntrustedPromptDataBlock (label Last failure-alert delivery error, bounded by the existing REPAIR_ERROR_MAX_CHARS = 1000, truncation marker [truncated]), the same boundary and bound as the job's other error text. The standalone recorded-delivery wording unit case is replaced by an injection-boundary case (embedded \n + <!-- openclaw:end --> must stay escaped inside the single data block); the owner-level regression in service.failure-repair.test.ts covers the new wording end to end. 5 suites / 67 tests green locally.

This also resolves the security item ("Transport errors lose their data boundary") and restores the provenance intent of fb2052a33fd — external content presented as untrusted data.

2. [P2] Surface the failure after alert delivery actually settles — confirmed, remedy exceeds this PR's declared scope

Source tracing confirms the reported gap, now pinned by an owner-level sequence regression (9f4c836c69e, "never re-briefs inside a streak whose later alert delivery settles as failed"): failure 1 requests repair before any alert is attempted (brief cannot name a delivery error yet); after the repair deadline expires unanswered, the streak's alert fires and its delivery settles as failed; from then on identical failures are signature-deduped to silence, and the finalizer captures the settled outcome but no brief ever consumes it inside that streak.

Both remedies the review suggests sit outside the boundaries this PR declared up front:

  • Second brief within a streak — changes the one-brief-per-incident dedup contract (!repair condition) and incident-state semantics, which this PR explicitly does not touch.
  • Diagnostic/fallback surface — that is the issue's A branch (doctor/status-line), declared follow-up.

What this PR does deliver in-scope: a new incident's brief now states why the previous streak's alert never arrived, instead of a bare "No failure alert was sent." — turning a recorded-but-invisible channel error into operator-visible state across incidents, with the delivery error now behind the untrusted-data boundary.

Happy to take the in-streak surfacing as a follow-up (either a dedup-contract change or the A-branch diagnostic) — @clawsweeper please rule on whether that blocks here or lands as follow-up.

3. Low-value test → 2bd93b2959c + 9f4c836c69e

Standalone recorded-delivery-failure wording case removed; the owner-level regression covers the wording through the real lifecycle, and the unit file keeps the no-attempt / delivered / terminal-variant boundaries plus the new injection-boundary case.

Scope unchanged: no budget, delivery, scheduling, or incident-state semantics touched; doctor/status-line stays a follow-up.

@Linux2010

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (no code change; head stays c26ca18d10b)

The new cross-reference from #189947 made one boundary worth stating before a maintainer reads the two cron PRs together. Verified against both diffs, added under Risk and Compatibility:

State re-checked on this head: mergeable: true / clean, 54 checks passing, 0 failures; the only non-terminal item is the optional auto-response bot check (pending, not part of openclaw/ci-gate, which is pass), plus 59 scoped checks correctly skipped. ci-gate, pr-failure-report, check-prod-types/check-lint/check-test-types, the changed-node shards and all security shards are green on c26ca18d10b; 0 review threads and 0 formal reviews outstanding; labels proof: sufficient / rating: 🦞 diamond lobster / status: 👀 ready for maintainer look since the 2026-10-31 re-review.

Base currency was verified rather than assumed: no commit on main since this head (2026-10-30T14:41Z) touches any of the 7 files in this diff (failure-alerts.ts, notification-dispatch.ts, timer-outcomes.ts, failure-repair-brief.ts and the three test files — 0 commits each on main after the head date), and the earlier cron commits on those paths (#184598, #183508, #183285) are already ancestors of this head. main is otherwise ~1.6k commits ahead, so mergeable: clean plus this path check is what makes the diff current — no rebase or merge of main is performed here.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (head stays c26ca18d10b) — accidental auto-close link removed

The Risk note added on 2026-11-01 ended with "…nor should be used to close #189947". GitHub treats close #<number> as a closing keyword regardless of the negation around it, so this PR was registered as the closer of #189947 — the P1 route-selection bug it explicitly does not fix. closingIssuesReferences reported [189947]; on merge, that P1 report would have been auto-closed by a PR that changes no target, channel, or recipient resolution.

Corrected in place: the clause now reads "so this PR is not the resolution of that report; the report stays open until the route-selection work lands", with no closing keyword adjacent to an issue number. Re-checked: closingIssuesReferences is now empty, and #189947 remains open under #189953.

#186990 intentionally stays Related: rather than a closer, matching the sibling Doctor-side PRs (#188946, #189881): that report's Expected has two branches, and each PR covers one of them, so no single PR should close it.

No code, diff, label, or head change. State re-verified on this head after the body edit: mergeable: MERGEABLE / mergeStateStatus: CLEAN, proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, 0 outstanding findings; required gates (ci-gate, dependency-review, security-sensitive-review) all success, no failing check in the rollup. Base currency holds: no commit on main since this head touches any of the 7 files in this diff.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (head stays c26ca18d10b) — boundary note for the change that landed on main today

Appended one Risk bullet: this PR and #190598 ("let scheduled jobs read their own delivery receipts", main commit 266002c36) are different surfaces, not competing implementations of the same thing.

Why the note is worth the edit: the two titles read alike, and a batch merge pass could take the landed receipt-reading work for the end of this problem. It is not.

  • fix(cron): let scheduled jobs read their own delivery receipts #190598 is pull: whether a scheduled job may query its own run receipts and message IDs through the cron tool (src/cron/delivery.ts, src/cron/isolated-agent/*, src/gateway/server-methods/cron-runs.ts).
  • This PR is push: the settled failure-alert outcome in the text an operator sees without asking — the repair brief in the owner conversation and the in-app fallback notice (src/cron/service/failure-alerts.ts, notification-dispatch.ts, timer-outcomes.ts, failure-repair-brief.ts).

Verified against source rather than titles:

  • commits?path=<f>&sha=main&since=2026-10-30T14:41:53Z (this head's date) returns 0 for all seven files in this PR's diff: failure-alerts.ts, failure-repair-brief.ts, notification-dispatch.ts, timer-outcomes.ts, service.failure-repair.test.ts, failure-alerts.outcome.test.ts, failure-repair-brief.test.ts.
  • Main has taken 29 src/cron landings since this head; the newest of them, 266002c36, changes 28 files and intersects this PR's seven in 0 places.
  • GitHub agrees: mergeable: MERGEABLE, and the diff is behaviourally independent.

No code change, no push, no re-review. Labels stay proof: sufficient / rating: 🦞 diamond lobster / status: 👀 ready for maintainer look; closingIssuesReferences re-checked after the edit: empty.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (no code change; head stays c26ca18d10b) — merge-order tiebreaker corrected

One assertion under Risk and Compatibility went stale at 2026-11-02T04:01Z and was replaced, not deleted: it recommended landing this PR first because #189953 was still status: 📣 needs proof. #189953 has since moved to proof: sufficient / status: 👀 ready for maintainer look, and its two merge-risk: 🚨 labels (message-delivery, security-boundary) were dropped in the same pass — so that tiebreaker no longer exists.

The collision itself is still real, so it was re-derived from both PR patches rather than from file names:

No code, diff, label, or head change. State re-checked after the edit: mergeable: true / clean (the brief unstable was the edited-triggered auto-response and PR context and evidence runs, both now success), closingIssuesReferences empty, commits/c26ca18d10b/status = success with openclaw/ci-gate, openclaw/dependency-review and openclaw/security-sensitive-review all success, and no failing check in gh pr checks. Labels unchanged: proof: sufficient / rating: 🦞 diamond lobster / status: 👀 ready for maintainer look.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (head stays c26ca18d10b) — collision numbering put on one basis

Re-checked every cross-reference and count in this body against current data, then corrected the one line that could not be verified as written.

Corrected — the merge-order bullet mixed numbering bases: it gave #189953's failure-alerts.ts hunks as old lines 169-216 and 368-373 (mixed: 216 is that PR's new-side start) and this PR's as 392, 497, 541 and 577 (all new-side starts, while labelled old). A reader comparing the two ranges was comparing one side of each hunk header. Now stated from the shared base file, both PRs on the same basis: #189953 starts at 169, 199, 210, 368; this PR at 392, 495, 536, 570; nearest pair 19 base lines apart (373 → 392). The transportFailureAlert collision ranges were relabelled base lines 236-245 / 242-247 — the values were already base-side. Conclusion unchanged: one hunk collides, not two files.

Re-verified, no edit needed

  • Path drift: main-side commits since c26ca18d10b against each of the seven touched paths — service.failure-repair.test.ts, failure-alerts.outcome.test.ts, failure-alerts.ts, failure-repair-brief.test.ts, failure-repair-brief.ts, notification-dispatch.ts, timer-outcomes.ts — all 0. (Main itself moved >100 commits in the window; the bullet's claim is per-path, not repo-wide.)
  • Head/LOC: 8 commits, 7 files, +247/−6 = the body's production +71/−4 + tests +176/−2.
  • fix(cron): owner-targeted automation failure alerts go to the last chat, not the owner #189953 is still open at c4e527ec0 with proof: sufficient / status: 👀 ready for maintainer look and no merge-risk label, and its notification-dispatch.ts hunk still appends { privateFallback } at enqueueCronNotification(...) — the one-hunk rebase described above is still the actual overlap.
  • fix(cron): let scheduled jobs read their own delivery receipts #190598 landed on main as 266002c36f ("let scheduled jobs read their own delivery receipts"), and touched none of the seven paths.
  • [Bug]: Failure alerts for delivery.target "owner" automations resolve the session's last route instead of the owner DM #189947 remains open as an issue (P1, impact: security, clawsweeper:linked-pr-open) — closingIssuesReferences on this PR is [], so merging this PR closes nothing.
  • No new findings: no review threads and no reviewer comments since 2026-11-02T04:51Z; the only non-green check on head is a superseded auto-response run from 2026-10-31T09:50Z, and mergeStateStatus is CLEAN.
  • Checked the other open cron PR that shares failure-alerts.ts (feat(cron): configurable default delivery and failure destinations #185848, configurable default delivery/failure destinations): it adds route selection at three config layers and composes none of the settled delivery outcome into operator text, so it neither overlaps this change nor makes it unnecessary — no body note warranted while it is still unlabeled for proof.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Landing-ready handoff (no code change; head stays c26ca18d10b)

Re-verified this round against current data. Nothing needed fixing: reviews is empty, inline review comments are empty, and no timeline event has landed on this PR since the last pass. So this note only removes the three things a maintainer would otherwise have to check before clicking merge.

1. State is final. proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, mergeable: true / mergeable_state: clean, not a draft. 8 commits, 7 files, +247/−6 (production +71/−4 in 4 files, tests +176/−2 in 3 files). The real behavior proof that was the only blocker was accepted on the live channel-less Gateway run recorded under Evidence; no further proof is being added.

2. The one non-green rollup entry is repo noise, not this PR. statusCheckRollup is 218 entries: 83 success, 133 skipped, 1 neutral, and exactly one auto-response = CANCELLED (run 41190304343, pull_request_target, cancelled at 2026-10-31T09:50:28Z with zero executed steps). It is not a gate and does not need re-running: the Auto response workflow mass-cancels its own queued runs on every push (seven completed cancelled entries inside six seconds of its current run list), open sibling #189953 carries the same single CANCELLED entry, and recently merged cron PRs landed while carrying SKIPPED entries from the same workflow. CI is effectively all green here.

3. The large base gap is harmless, so no rebase is needed to merge. main is 2039 commits ahead of this PR's base 8bc6317099, but across all seven paths this diff touches — service/failure-alerts.ts, service/notification-dispatch.ts, service/timer-outcomes.ts, service/failure-repair-brief.ts, service/failure-repair-brief.test.ts, service/failure-alerts.outcome.test.ts, service.failure-repair.test.ts — main-side commits since 2026-10-30 number 0, confirmed per path. The cron work that did land meanwhile (#190727 failure observations, #190598 delivery receipts, #190904 account adoption, #190462 shared run assertion) touches service/timer-execution.ts, isolated-agent/*, store/*, types.ts and gateway files, none of which this PR edits, and none of which implements this outcome-in-text behavior. The only PRs referencing issue #186990 remain this one plus the Doctor-side pair #188946 / #189881 in different files; no competing implementation exists.

4. The only real decision left is merge order with #189953. Both are now proof-complete, so there is no proof-based tiebreaker (P1 there, P2 here). Their overlap is one hunk: both edit the transportFailureAlert fallback call — this PR replaces params.payload.text ?? "" with the joined delivery-outcome note, #189953 appends a { privateFallback } argument to the same enqueueCronNotification(...) call. Whichever lands second takes that one-hunk rebase; combining them is mechanical (joined note and the argument), and this branch will re-run the five gate suites before pushing if #189953 lands first. Issue #186990 stays open until this lands; the route-selection report #189947 is separate work.

Nothing here requires action from the contributor side. A maintainer merge is the next step.

@Linux2010

Linux2010 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Still the only open cron delivery brief fix — re-checked against main today (head stays c26ca18d10b)

State is unchanged from the landing-ready handoff: proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, mergeable: true / mergeable_state: clean, reviews: 0, inline review_comments: 0. Rollup is 218 entries — 83 success, 133 skipped, and the two non-skipped non-successes are repo noise (auto-response CANCELLED, CodeQL NEUTRAL), not gates on this diff.

What is new is the base moving, so here is the supersession question a batch-merge pass would otherwise have to re-derive, answered with the counts rather than with titles:

No code change, no rebase: the branch is 2130 commits behind main but GitHub merges the patch clean and every one of these seven paths is untouched on main, so integrating only for base distance would add churn without removing a risk.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Body maintenance (head stays c26ca18d10b) — #191570 landed, so the merge-order bullets were replaced with the merged-content result

Three statements under Risk and Compatibility went stale because #191570 ("honor explicit failure alert destinations before repair") merged at 2026-11-03T22:01:11Z as 57405d6f170, and #192399 landed aa49c2b7a6a at 2026-11-04T00:11:17Z. They were rewritten from current data, not deleted.

1. This PR is still necessary after their merge. Read from main's blobs, not from titles:

  • src/cron/service/failure-repair-brief.ts on main (3545 bytes, unchanged since c26ca18d10b) still hardcodes the reason-free sentence at L33 (one-shot) and L34 (consecutive-runs): … failed ${params.consecutiveErrors} consecutive runs. No failure alert was sent.
  • priorAlertDelivery and the (last failure-alert delivery attempt: …) note occur 0 times in main's failure-alerts.ts (blob b0c5b7f019a, 24361 bytes) and notification-dispatch.ts (9067 bytes). Control values on the same read: hasJobFailureDestination = 2 in failure-alerts.ts (so that blob really is post-fix(cron): honor explicit failure alert destinations before repair #191570), transportFailureAlert = 2 in notification-dispatch.ts, consecutive = 2 in the brief.

Their change decides whether an owned job's first failure requests repair; this change carries what happened to an alert that already settled. With their guard in place, an undelivered alert is still reported to the operator without its reason, which is what #186990 reports.

2. The merged content was run, not just diffed. MERGEABLE / CLEAN proves the text applies; it does not prove the combined behavior. Their four hunks over src/cron/service/failure-alerts.ts and src/cron/service.failure-repair.test.ts were applied onto this head with git apply (one hunk landed at +2 offset) and the five cron suites re-run: service.failure-repair, service/failure-repair-brief, failure-alerts.outcome, failure-alerts.account-routing, failure-alerts.persistence → 5 files / 75 tests passed, including this PR's two brief cases sitting next to their four destination-precedence cases. Baseline on this head alone: 5 files green. The simulated edits were then reverted; git status shows only the pre-existing unrelated src/cli/update-cli/update-command-service-drain.native.test.ts. No push, no rebase — the merge takes both feature sets as-is.

3. Why their applyError rework does not disturb this PR's tests. The helper's default job moved from failureAlert: { …, channel, to } to delivery: createTelegramDelivery(), and the new guard only inspects job.failureAlert and job.delivery.failureDestination. createTelegramDelivery() sets delivery.channel / delivery.to, never failureDestination, so that fixture stays repair-eligible — which is also why their landing kept the pre-existing repair cases green, and why the two brief cases added here assert the same notification kinds they did before.

Path drift, first non-zero in this lane: 3 of the 7 touched paths now have 1 main-side commit each since c26ca18d10b — failure-alerts.ts and service.failure-repair.test.ts (57405d6f170), timer-outcomes.ts (aa49c2b7a6a); the other four, including the new service/failure-repair-brief.test.ts, remain 0 (hist values otherwise identical to earlier rounds: 4 / 8 / 10 / 0). Symbols this PR imports are unchanged on main (CronFailureNotificationDelivery 4 = 4, delivery.failureDestination 2 = 2, SILENT_REPLY_TOKEN present).

No code, label, or head change. State after the body edit: open, mergeable: true / clean, proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, reviews: 0, inline review comments 0, closingIssuesReferences empty, and /commits/c26ca18d10b…/status state=success with ci-gate, dependency-review and security-sensitive-review all green. A re-review was not requested: the reviewed head is still this head, and the durable review's Findings: None verdict is unaffected by a body-only correction.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Re-verification against main 3caeb92ac30 (head stays c26ca18d10b, no code change)

mergeable came back null / unknown on this pass — GitHub is still recomputing it while main moves — so the merge was proved independently instead of waiting on that field.

1. The patch applies onto current main content. All six files this PR modifies were fetched at ref=main and their blob SHAs still equal what git hash-object reports after main advanced to 3caeb92ac30 (service.failure-repair.test.ts 1f5dbbc6479, failure-alerts.outcome.test.ts cc6bebbcb7c, failure-alerts.ts b0c5b7f019a, failure-repair-brief.ts bf188b15507, notification-dispatch.ts d984b040e52, timer-outcomes.ts 1d6dc592f0a). Against those exact contents, git apply --check -v exits 0 with offsets only, no fuzz, no rejected hunk: the service.failure-repair.test.ts block lands at +86, the three later failure-alerts.ts hunks at +11 each, and the timer-outcomes.ts call-site hunk at +8; the new src/cron/service/failure-repair-brief.test.ts is created. The real git apply then yields 175 insertions / 6 deletions across the six modified files, and with the new 72-line suite that is 247/6 overall — exactly the body's LOC split (production +71/−4 in 4 files, tests +176/−2 in 3 files), so nothing in the diff was dropped by the offsets.

2. The gap is still live on main, so this PR is still necessary. Main's src/cron/service/failure-repair-brief.ts (bf188b15507, 3545 bytes — identical to the last three rounds) still renders the reason-free sentence, with No failure alert was sent present 2× and last failure-alert delivery attempt, priorAlertDelivery and renderSettledFailureAlertDeliveryNote present 0 times across all four source files this PR touches.

3. Drift since the 11-04 pass is three cron-adjacent merges, none on these paths. 0671d2e8b07 (#191643, service.trigger-eval.test.ts + trigger-script.test.ts), f517164d87e (#192550, already covered in the body) and 35d964dca0e (#192982). Per-path main-side commit counts since c26ca18d10b are unchanged — 1 / 0 / 1 / 0 / 0 / 0 / 1, still the same two commits (57405d6f170, aa49c2b7a6a). #192550's session-run.ts hunk adds terminalOutcome and errorClassification (optional fields on the session-event outcome) and classifies why the run failed; this PR reports why the alert never reached the operator, so it neither collides with nor subsumes this change.

4. Why #192982 does not put this PR's +176 test lines at merge risk — the one thing here that could have bitten after the merge rather than before it. test/vitest/vitest.declared-inputs.ts maps a single file read (src/hooks/install.test.ts → test/fixtures/hooks-install/tar-evil-id.tar) into vitest's watch graph; it does not enumerate test files, so a new suite needs no entry. And the absolute test-line ratchet is a PR-time gate: on the most recent completed CI push run for main (41918615753), job checks-fast-baseline-ratchets (126884862222) concluded skipped. scripts/check-test-lines-ratchet.mts compares total > ceiling against the branch's own committed config/test-lines-baseline.txt plus allocations, and this head passes that gate; landing cannot make main red on lines main's own merged PRs already paid for. No allocation file is needed here.

5. Gating suites green on head with node v26.12.1: src/cron/service/failure-repair-brief.test.ts, src/cron/service.failure-repair.test.ts, src/cron/service/failure-alerts.outcome.test.ts → 3 files passed, including never re-briefs inside a streak whose later alert delivery settles as failed.

6. Related: #186990 stays Related — checked, not inherited. That report lists three suggested fixes. This PR is item 2 only; item 1 (health/doctor output) is carried by #188946 and #189881, both still open, and item 3 (deduplicate identical briefs per incident) has no PR. Adding a Fixes keyword would auto-close an issue whose other two items are unresolved, so the reference and the body's scope line are correct as written.

No code, body, label, or head change. State at the close of this pass: open, mergeable recomputing (null/unknown) with the clean apply proved above, CI 55 pass / 0 fail / 59 skipping on c26ca18d10b, proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, P2, reviews 0 and inline review comments 0. No re-review requested: the reviewed head is still this head, the durable verdict is Findings: None, and a base advance does not change what was reviewed.

@Linux2010

Linux2010 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Body maintenance (head stays c26ca18d10b) — the two remaining same-file open PRs are now accounted for

Main advanced to 11953ebd190 since the last pass, and GitHub’s own answer for this head is now mergeable: MERGEABLE / mergeStateStatus: CLEAN — earlier in this pass it was still UNKNOWN and it resolved after the body edit. The content check agrees with it: all six files this PR modifies still hash to the exact blobs the 2026-11-04 git apply --check was run against (failure-alerts.ts b0c5b7f019a, notification-dispatch.ts d984b040e52, timer-outcomes.ts 1d6dc592f0a, failure-repair-brief.ts bf188b15507, service.failure-repair.test.ts 1f5dbbc6479, failure-alerts.outcome.test.ts cc6bebbcb7c). Unchanged inputs ⇒ the offsets-only clean apply from the 2026-11-04 pass carries over; the 14 main commits since then touch none of these paths.

What changed is one gap in Risk and Compatibility. The merge-order bullet covered #189953 only. Scanning every open PR that edits any of these 7 paths found two more, and a batch-merge pass would otherwise have to re-derive whether they matter:

Both were measured against main's current blobs rather than each PR's own base, because hunk headers across three different branch points are not comparable — that was the mistake to avoid here:

  • failure-alerts.ts (627 lines on main): feat(cron): configurable default delivery and failure destinations #185848's deepest edit is inside resolveFailureAlert (opens L103, route rework around L134-143); this PR's first edit is maybeEmitFailureAlert's parameter list at L393-395. ≈250 lines clear, no collision.
  • timer-outcomes.ts: feat(cron): add bounded command recovery and preserve-running maintenance #167081's single insertion is directly after const finish = () => { (main L251, hunk window L248-254); this PR inserts at L163-166 and at L277 in the finalizeCronFailureNotifications(...) argument list (hunk window L274-279). Same function, 20 lines clear of each other's 3-line context — git auto-merges, and the two features stay independent (theirs ends a recovered command run, ours reports why an alert never arrived).

Neither needs a merge-order decision today, so the bullet records the regions instead of a recommendation.

Gates re-run on head with node v26.12.1: src/cron/service/failure-repair-brief.test.ts, src/cron/service.failure-repair.test.ts, src/cron/service/failure-alerts.outcome.test.ts → 3 files / 48 tests passed.

One correction for whoever runs the gate line next: the second path is src/cron/service.failure-repair.test.ts (dotted, at src/cron/), not src/cron/service/failure-repair.test.ts. A mistyped path is not an error for vitest run — it silently runs fewer files and still exits 0 (my first pass this round reported 2 files / 18 tests before the path was fixed), which is exactly the false-green this lane should not hand a maintainer.

No code, label, or head change; no rebase and no re-review request — the reviewed head is still this head and the durable verdict is Findings: None. State at the close of this pass: open, proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, P2, reviews 0, inline review comments 0, CI 55 pass / 0 fail / 59 skipping on c26ca18d10b, mergeable: MERGEABLE / mergeStateStatus: CLEAN.

@Linux2010

Copy link
Copy Markdown
Contributor Author

11-05 pass (head stays c26ca18d10b) — the one open interaction, #193063, is now closed as behavior rather than as a clean apply

No finding to fix this round: reviews is empty, inline review comments are empty, reviewThreads is 0, and every check run on c26ca18d10b is completed with conclusion success or skipped. GitHub's own answer for this head is mergeable: MERGEABLE / mergeStateStatus: CLEAN (it returned UNKNOWN at 01:01Z while main was recomputing and resolved on the re-check). Labels are unchanged: proof: sufficient, rating: 🦞 diamond lobster, status: 👀 ready for maintainer look, P2, size: M.

Drift is nil since the pass that recorded #193063. Main advanced again (730b60991ee → a1f99240c83 at 01:46Z) and touched none of this PR's paths: on current main failure-alerts.ts is still b0c5b7f019a, notification-dispatch.ts d984b040e52, failure-repair-brief.ts bf188b15507, service.failure-repair.test.ts 1f5dbbc6479, failure-alerts.outcome.test.ts cc6bebbcb7c, and timer-outcomes.ts is still the post-#193063 d436e9805b4 that the last bullet already accounted for.

The merge was proven against the real ancestor, not against hunk numbers. git merge-file with this head's timer-outcomes.ts (5afdf97b576b5), main's (d436e9805b4) and the patch's base blob (c391a60507aa6, present in the local object store) exits 0 with no conflict markers, and the merged file keeps both sides — delete job.state.admissionDeferred; at merged L120, const priorAlertDelivery = failureNotificationDeliveryFromJobState(job); at L168, priorAlertDelivery, in the finalizeCronFailureNotifications(...) argument list at L283.

And the interaction is a non-event behaviorally, which is the part a clean apply cannot show. #193063 stops deferred jobs retrying by handling them early in src/cron/store/run-finalization.worker.ts: it finishes the receipt with CRON_ADMISSION_DEFERRED_RECEIPT_ERROR (L104), records the back-off in job.state.admissionDeferred (L127-137), and then continues at L154 — before applyOutcomeToAuthoritativeJob(...) at L156, which is the call that owns this run's failure bookkeeping and notification routing. A deferred run therefore never settles a failure alert and never becomes a repair request: it cannot produce the operator text this PR rewords, and it is not a second settlement path that could bypass priorAlertDelivery. Nothing here needs a code change; the case that would have mattered — a deferred run emitting an unexplained brief — is excluded by that continue.

Gates re-run on head with node v26.12.1: the three named files (src/cron/service/failure-repair-brief.test.ts, src/cron/service.failure-repair.test.ts, src/cron/service/failure-alerts.outcome.test.ts) → 3 files / 48 tests, and the direct consumers (src/cron/service/timer-outcomes.regression.test.ts, src/cron/service/failure-alerts.persistence.test.ts, src/cron/service/failure-alerts.account-routing.test.ts) → 3 files / 60 tests. All green.

Body now carries these two bullets under Risk and Compatibility. No code, label, or head change; no rebase and no re-review request — the reviewed head is still this head and the durable verdict is Findings: None. This PR is landing-ready as recorded; the only remaining step is a maintainer merge (this fork has no push right on openclaw/openclaw, so it cannot be landed from here).

@Linux2010

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 24, 2026
@Linux2010

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 24, 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

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: S status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant