Repository navigation
fix(heartbeat): select failure wording from prepared work - #153573
roboclaw-bot merged 25 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:31 PM ET / 22:31 UTC (Revision 47). ClawSweeper reviewWhat this changesThe PR selects failure wording from prepared heartbeat work, forwards that choice through error delivery, adds regressions, and synchronizes an existing browser layout test. Merge readiness✅ Ready for maintainer review The PR remains useful and has no actionable correctness findings. The conflict integration preserves the reviewed repair and main’s updated periodic-check wording; the existing Gateway proof remains applicable. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s heartbeat runner processes periodic checks and queued background work. Preparation selects the work, shared error handling creates failure notices, and dispatch delivers them under the existing heartbeat policy. flowchart TD
A[Periodic checks] --> C[Prepare selected work]
B[Queued background events] --> C
C --> D[Choose failure wording]
C --> E[Execute agent turn]
E --> F[Render failure notice]
D --> F
F --> G[Deliver under heartbeat policy]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +30, Tests +83. Total +113 across 13 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep wording selection with heartbeat preparation while preserving execution policy and tracking cross-channel routing separately. Do we have a high-confidence way to reproduce the issue? Yes: current-main source unconditionally converts generic failures after heartbeat-backed event work, and the supplied paired Gateway trace demonstrates the manual-wake trigger. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: preparation already owns work selection, so carrying its wording decision through existing failure owners is a narrow repair that preserves visibility and accounting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6335fb76d785. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (46 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…artbeat-crosschannel
The heartbeat typing controller starts a keepalive loop that re-invokes sendTyping every interval (6s by default) for as long as a run is in flight. The exact-count assertions in heartbeat-runner.typing.test.ts expect a single sendTyping call, so any run slower than the keepalive interval fails them: CI observed 2 calls and a slower local run observed 4. The first test alone takes ~88s, well past 6s. Pin agents.defaults.typingIntervalSeconds to 3600 in the test config so the keepalive cannot fire inside a run. This keeps the strict toHaveBeenCalledOnce/Times(1) assertions meaningful instead of relaxing them to "at least once", and leaves keepalive behavior covered by its own tests. The three "does not type" cases assert sendTyping is never called and are unaffected.
…artbeat-crosschannel
Main deflaked heartbeat-runner.typing.test.ts with faked setInterval and now asserts the keepalive refresh explicitly. The local interval pin added here is redundant under fake timers and contradicts that intent: it left the failure case and the "does not type" cases running at 3600s instead of the 6s default the file now expects. Restore the file to main's version.
…artbeat-crosschannel
CI status on
|
| Check | Failure | Type |
|---|---|---|
checks-node-changed-compact-large-34 |
src/infra/heartbeat-runner.isolated-session-mirror.test.ts — "heartbeat delivery confirmation was not observed" (×2) |
test/helpers/promise.ts timeout |
checks-node-changed-3 |
test/e2e/qa-lab/runtime/channel-progress-presentation.e2e.test.ts — "retires unphased Slack previews across tool-only assistant messages" |
Test timed out in 120000ms |
check-additional-extension-package-boundary |
extension package boundary check passed → then killed |
job timeout-minutes: 20, ran 20m14s |
openclaw/ci-gate ×2 |
aggregates of the above | — |
The heartbeat failure is not caused by this PR — verified by controlled experiment. I reverted all 13 changed files to main and re-ran that suite: it fails identically (6 failed | 2 passed both with and without the change). The two failing cases are also success paths ("queues a successful direct alert", "lets a reset clear awareness after delivery is identified"), while every behavioural change here is gated behind agentRunFailed, so it is inert on those paths.
check-additional-extension-package-boundary looks like a genuine CI budget issue rather than a flake. The check itself passes and the job is then killed at the 20-minute cap. Observed durations for that job on this branch: 12m53s (pass), 16m00s (pass), 20m11s (killed), 20m14s (killed). It prepares boundary artifacts for 125 plugins, so it appears to have grown into its own timeout. Raising timeout-minutes or routing that group to the larger runner would likely fix it, but that felt like a maintainer call rather than something to change from a feature PR.
Worth noting that five earlier failures on this branch were all resolved simply by merging main — 57f1abecc1 (static evidence fixtures), c136ec6314 (Gateway waiter lifetime + Bun plugin retention), and fc255f8588 (lazy sidebar hovercard readiness). Those deflakes landed upstream faster than the branch could pick them up.
As an external contributor I can't re-run jobs (Must have admin rights to Repository), so my only retry mechanism is force-pushing a new SHA, which re-runs the whole ~155-job matrix. @steipete — could you re-run the failed jobs instead? Happy to open separate issues for the boundary-job timeout and the isolated-session-mirror delivery timeout if that's useful.
…artbeat-crosschannel # Conflicts: # src/infra/heartbeat-runner.tool-response.test.ts
|
|
Correcting my previous comment — I pointed at the wrong line. The harness pathspec allowlist is not the cause. The actual gate is in the preflight branch of the Git-ownership step: On a pull request those two revisions are never equal:
So On a I should also retract a second claim from that comment: Still reproducible on #161571 as well as here. |
…artbeat-crosschannel
…artbeat-crosschannel
|
Resolved upstream by One retraction to set straight: my second comment was wrong to blame the The gate at line 825 was not modified, so it was never the cause. Apologies for the noise — the first diagnosis was correct and I should not have retracted it. |
|
Maintainer follow-up at The prepared-work wording decision, returned terminal-failure forwarding, and removal of unrelated deadline increases address the prior findings. The native ancestry-preserving merge resolves main #162869's test conflict while preserving generic event failures and main's new periodic background-check wording. The repaired production blobs are unchanged from ccc07f. Fresh sanitized AWS proof reconstructed exact tree a479a53f2b2ec5e0273e9b38821026de0c8eed9c and passed 96 tests in four files (142.62s): canonical copy/renderer, heartbeat dispatch/delivery, and returned-terminal outcomes. The environment was released and cleanup confirmed. No fork code ran on this host. Patrick's paired isolated Gateway proof remains the delivered-text/recovery evidence for unchanged behavior. It uses a mock HTTP provider and synthetic channel, not authenticated Telegram. The separate routing issue remains outside this repair. I updated the PR body with the integration evidence and requested exact-head ClawSweeper review. This is not a claim of completed merge or final CI success. The incoming ccc07f CI passed, but final-head gates are not waived. Earlier findings (resolved)At 17f4b21, wake-source-based copy selection and missing terminal forwarding mislabeled event failures; unrelated test timeout increases also remained. Patrick's repair resolved them. The old local correction draft was never published. ClawSweeper's ccc07f review accepted the paired proof and found no code defect, leaving only the conflict resolved by this integration. |
Maintainer repair and delivered-text proofThe repair records failure wording from the work selected by heartbeat preparation, then carries that one decision through thrown errors, returned terminal failures, and delivery normalization. Periodic tasks retain heartbeat wording even when an event caused the wake; queued exec, cron, and background work retain generic failure wording. This addresses all three findings and rank-up moves in the October 1 review: selected-work selection, terminal-result forwarding, and the three unrelated deadline increases. Those increases have been removed. The UI test keeps its existing geometry assertions and waits on the existing settled-layout helper. Paired Gateway proofRan the actual isolated Gateway with the existing QA Lab public API, a local mock OpenAI HTTP provider, and the synthetic QA channel HTTP bus. The before source is The fixture seeds a conversation through channel ingress, injects a failing immediate exec event, verifies a same-session reply, invokes the public
Observed regression text before:
Observed delivered text after:
{"runtime":"actual isolated Gateway","provider":"local mock-openai HTTP","channel":"synthetic qa-channel HTTP bus","before":{"passed":4,"failed":1,"failedCase":"exec work selected on manual wake"},"after":{"passed":5,"failed":0},"sameSessionRecoveryControls":2,"periodicMonitorControl":true,"sourceHashesVerified":true,"cleanup":{"before":"confirmed-stopped","after":"confirmed-stopped","errors":[]}}The Gateway driver was Focused validation and scopeThe frozen candidate passed 23 heartbeat owner/delivery cases, 24 renderer/Pi cases, 134 shared execution/provider-failure cases, 49 Codex collector/projector cases, 11 cron admission cases, one swarm integration case, and 32 browser E2E cases. Core types, selected test-type graphs, changed-path formatting, and changed-path lint passed. Original-source regressions were captured first: six selected-work cases and one returned-terminal case failed for the intended wording defect. Production delta is +38/-8 (net +30); tests/test support +91/-10 (net +81). The net-neutral attempt removed the source-only helper and its mirrored tests, duplicate turn-option plumbing, and unreachable heartbeat plumbing in the non-heartbeat core branch. The remaining growth carries the distinct wording fact without changing heartbeat visibility. No config, env, schema, persistence, dependency, or protocol-version change. Codex dependency contract inspected directly at Known separate diagnostic: the original-order placement reclaim suite showed 30/31 passing while its unchanged one-second final case passed in isolation. This does not justify increasing the timeout; the root cause remains a placement/lifecycle follow-up. Current main already contains an owner-synchronization improvement for the separate swarm test, which native integration must preserve. Fresh canonical autoreview passed scoped-clean at the configured P0 threshold (Codex gpt-5.6-sol/high). The full changed-file gate passed on October1 at22:03UTC, including all27 core test graphs, lint, dead exports and storage/architecture guards. The repair is now committed with a mechanical main refresh; all13 final PR file hashes are identical to the tested source, and current main’s swarm/lifecycle synchronization is preserved. New exact-head CI and native landing gates remain required. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@Patrick-Erichsen @juyterman1000 — I resumed the authorized landing follow-through for |
Merge main to resolve the event-recovery test conflict from the canonical heartbeat-copy update. Keep generic failure wording for prepared event work and preserve the new background-check wording for periodic checks. Co-authored-by: Patrick-Erichsen <[email protected]>
|
@clawsweeper re-review The merge conflict is resolved at |
|
🦞👀 Re-review progress:
|
What Problem This Solves
A heartbeat wake can select queued exec, cron, or background work. When that selected work fails, the existing runner can label it as a failed periodic heartbeat check. This repairs the delivered failure wording while preserving the run’s heartbeat execution semantics.
User Impact
Queued work gets the ordinary request-failure message, and a periodic monitor still gets heartbeat wording. The existing chat remains usable after either failure. This addresses one symptom reported in #153543; separate cross-channel routing remains outside this repair, so that issue should remain open.
Why This Change Was Made
Heartbeat preparation owns the selected-work decision. It now prepares one failure-wording fact and passes it through thrown errors, returned terminal failures, and delivery normalization.
isHeartbeatretains visibility, suppression, and accounting ownership. Scheduled-task selection takes precedence over the event that woke the runner.Removed the source-only helper, duplicate turn-option plumbing, unreachable non-heartbeat core handling, and three unrelated timeout increases. The existing browser geometry test uses its established layout-settlement helper.
Evidence
Paired actual isolated Gateway runs use the same QA Lab driver, a local mock OpenAI HTTP provider, and a synthetic QA channel HTTP bus. Original-head source has one wrong delivered-message result with four controls passing; repaired source passes all five, including both same-session recovery replies and the periodic-monitor control. This is the repository’s mock-Gateway proof route, not authenticated provider/Telegram proof. Captured before/after results and exact source custody are in Patrick’s maintainer proof comment.
Focused validation passed:23 heartbeat cases,24 renderer/Pi cases,134 shared execution/provider-failure cases,49 Codex collector/projector cases,11 cron cases,1 swarm integration case, and32 browser E2E cases. Six selected-work regressions and one returned-terminal regression fail on the pre-repair source. Fresh canonical autoreview is scoped-clean at P0. The full changed-file gate passed, including27 core test type graphs, production types, lint, dead exports and selected storage/architecture checks.
At the earlier
ccc07f0049bfmain integration, all13 changed files remained byte-identical to Patrick’s tested candidate. Production+38/-8(net+30); tests/test support+91/-10(net+81). The added fact is necessary to distinguish failure wording from execution class; replacingisHeartbeatwould change suppression/accounting behavior. No configuration, environment, schema, persistent-store, dependency, or protocol-version change.Known separate follow-up: the original-order placement reclaim suite had30/31 passes, with its unchanged one-second final case passing in isolation. Its cause remains unproven; no timeout was increased. Current main’s separate swarm owner-synchronization repair is preserved.
Conflict integration at
9013a8cb02f7Main #162869 changed the canonical heartbeat failure text and conflicted with one exec-event recovery assertion. The ancestry-preserving merge keeps generic wording for selected event work and preserves main’s new background-check wording and renderer tests. The selected-work production logic and event-recovery test remain byte-identical to
ccc07f0049bf.A fresh sanitized AWS proof run recreated the integration and verified exact tree
a479a53f2b2ec5e0273e9b38821026de0c8eed9cbefore running 96 passing tests in four files: canonical copy/renderer 53 cases (33.10s), heartbeat delivery 23 cases (76.11s), returned-terminal results 20 cases (29.29s); total runner wall 142.62s. The heartbeat file exercises preparation, dispatch, queue retention, and final delivery; its composition is the reason for the higher cost. The AWS lease was released after completion. No fork code ran on the Team host.Incoming-head CI run
36933376215passed atccc07f0049bf; it is not relabeled as new-head CI. Fresh CI and review are required for9013a8cb02f7. No admin exception or check bypass.AI Assistance
AI-assisted maintainer review and owner-boundary repair, preserving @juyterman1000’s original contribution. Review included current/stable source, callers and siblings, direct pinned Codex source inspection, paired delivered-output proof, focused regressions, and canonical autoreview.