Skip to content

fix(cron): stopped session turns trigger failure alerts - #192550

Merged
vincentkoc merged 4 commits into
mainfrom
fix/cron-session-cancellation-takeover-20261104
Nov 4, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix/cron-session-cancellation-takeover-20261104

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #192549

What Problem This Solves

Stopping a scheduled turn through its session can count as a failure and trigger an unwanted repair or failure alert.

User Impact

Stopped, restarted, and superseded scheduled turns use the existing interruption policy. Genuine deadline timeouts and stalled executions retain failure semantics. Restart guidance tells the parent how to inspect and continue retained child work without mistaking a stopped execution for a yielded pause or transferring workspace ownership.

Why This Change Was Made

The session-event owner recorded cancellation as a string while cron examined a different, still-live caller signal. Preserve the canonical terminal outcome before asynchronous settlement and cleanup, then pass its classification to cron. Scheduler policy and access rules stay with their current owners; no schema or configuration change is required.

Evidence

Candidate: 467e75e55a7cf9aaee047bd62614ce2b3e9ff2d6; tree: c7fcf2358b9f6f58e42a26078cd063ca3501d013; source base: 8cb23492d6ed97d2c72eda35178fb298c40ea17c.

Independent Codex P0-P2 source review passed for the original production patch. A bounded independent final-head review found frozen supersession was still misclassified; that finding is repaired and the reviewer verified the final source/test tree with no remaining P0-P2 finding. The controller matrix now also asserts supersession with an un-aborted signal. Source review does not establish runtime behavior.

Formatting and diff checks pass. Exact-head PR CI passed all selected jobs, including build, production/test types, lint, guards, UI, all three PostgreSQL conformance shards and the affected runtime regressions. No local dependency-backed test execution was attempted.

Actual Bun-backed CI proof: controller matrix passes 20/20 cases including user stop, restart, ordinary/frozen supersession, timeout and stall. Session-event handoff passes 24/24 cases including passive restart-drain outcomes. Public Stop boundary passes the real sessions.abort-to-Cron test: no failure incident, no alert, zero error streak and no extra repair turn. The containing two files pass 105/105 tests.

The earlier fixture and stale passive-drain expectation failures were repaired. Current PR CI also passes UI; no inherited-failure waiver is needed. Exact-head ClawSweeper review reports no findings and no before-merge moves. Synthetic Gateway proof does not establish deployed or live-provider behavior.

Production delta: +67 lines, for the canonical terminal fact and its propagation. Tests: +156 lines, including the cases file excluded from the counted test-line ratchet. No alternate scheduler policy, state schema, or configuration surface is added.

The separate stale-target diagnostic gap is recorded in #192560; the historical incident does not establish which authority guard fired.

No Team deployment, restart, or live-account proof is claimed. This fixes a proven classification defect; it does not establish that every historical thread failure had this cause.

Landed by squash as f517164d87e5affe87afab6e23b48ef934ca3a48 after exact-head required CI and review passed. Deployment remains separate.

@vincentkoc vincentkoc self-assigned this Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 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 gateway Gateway runtime size: M labels Nov 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head d906f57. This is the controller terminal-outcome repair for stopped scheduled session turns; exact-head CI is running. No automation repair or merge lane is requested.

@clawsweeper

clawsweeper Bot commented Nov 4, 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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR carries controller terminal outcomes into Cron settlement so intentional interruptions avoid failure alerts while timeouts and stalls remain failures.

Example: Stop a scheduled turn in agent:main:dashboard:stopped-cron with failureAlert.after set to 1.

  • Before: The controller stops, but Cron can increment consecutiveErrors and request a repair or alert.
  • After: Cron records an interruption without incrementing the failure streak or opening a failure incident.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair is coherent and supported by reported passing boundary regressions; supplied behavior evidence remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; supplied evidence covers real controller and scheduler owners with synthetic inference, including sessions.abort, while direct CI log inspection was blocked by sandbox network policy.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Stopping scheduled session work can trigger unwanted failure alerts or repair turns.
Reason: The maintainer-authored direction restores the existing quiet-interruption contract and preserves genuine failure semantics.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a current cancellation-classification defect using the existing owners, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 467e75e55a7cf9aaee047bd62614ce2b3e9ff2d6

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A shipped Gateway/model demonstration and failing-base execution are not supplied; the reported regression coverage uses synthetic inference.
Agent review details

How this fits together

Scheduled conversation jobs enter ordinary session admission; the controller owns execution termination, the session-event receipt carries its outcome, and Cron applies scheduling and notification policy.

flowchart LR
  A[Scheduled job] --> B[Session admission]
  B --> C[Reply controller]
  C --> D[Session event receipt]
  D --> E[Cron settlement]
  E --> F[Run history and notification policy]
Loading

Technical review

Best possible solution:

Preserve controller-owned terminal facts through the receipt and let existing Cron interruption policy decide failure accounting and notifications.

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

Current-main source establishes the path from controller cancellation to a live caller signal and unclassified Cron error; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch repairs the producer-to-consumer contract using existing terminal classification and scheduler policy, with no unnecessary owner, persistent state, or configuration surface.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Session-event settlement keeps the original intent (753a7a5: Ordinary session execution became the owner of immediate notifications, including cancellation and exact reply-operation settlement.)
  • Scheduled conversation settlement keeps the original intent (3d2f7ca: Scheduled conversation work must join ordinary session admission and remain running until its controller settles.)
  • Restart guidance changes intended behavior with a stated reason (9344233: Root requesters reconcile interrupted work after restart; the documentation correction also reflects the later SIGKILL recovery implemented by fix: diagnose wedged gateways and resume sessions after SIGKILL #190964.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +138, Tests +85, Docs +4, Other +2. Total +229 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 145 7 +138
Tests 2 86 1 +85
Docs 1 8 4 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 9 241 12 +229

Review metrics

Metric Value Why it matters
Production versus regression growth Net production +67 lines; tests +156 lines. Growth carries canonical terminal facts through existing owners and covers distinct controller, restart-drain, and public Stop boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: False failure accounting and unwanted repair turns affect intentionally stopped scheduled work, without evidence of a widespread outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (1 earlier review cycle)
  • reviewed 2026-11-04T05:16:30.020Z sha d906f57 :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 1:11 AM ET / 06:11 UTC (Revision 2).

@vincentkoc
vincentkoc marked this pull request as ready for review November 4, 2026 05:56
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 467e75e55a7cf9aaee047bd62614ce2b3e9ff2d6, read-only; no repair or merge lane.

The prior rank-up requests are addressed: exact-head PR CI passed the six-mode real-controller terminal matrix (including frozen supersession), passive restart-drain occurrence preservation, and the real sessions.abort regression showing no failure incident or alert. These logs are Bun-backed CI proof. All production/test types, lint and build pass. The earlier missing delivery-fence type diagnostic and counted-test allocation were repaired; no failure is attributed solely by job name. Three PostgreSQL conformance jobs are still running.

The frozen-supersession classification and stale restart-drain expectation were repaired after independent review/CI. The separate stale-target diagnostic gap is #192560. No Team deployment or live-account proof is claimed.

@clawsweeper

clawsweeper Bot commented Nov 4, 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. labels Nov 4, 2026
@clawsweeper clawsweeper Bot 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 Nov 4, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) November 4, 2026 06:18
@vincentkoc
vincentkoc merged commit f517164 into main Nov 4, 2026
243 of 313 checks passed
@vincentkoc
vincentkoc deleted the fix/cron-session-cancellation-takeover-20261104 branch November 4, 2026 06:19
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
)

* fix(cron): keep stopped session turns out of failure alerts

* test(cron): supply the scheduled delivery fence

* fix(cron): preserve cancellation during frozen supersession

* test(cron): assert restart-drain cancellation semantics
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 gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

Stopped session automations can trigger failure alerts and repair turns

1 participant