Skip to content

fix(heartbeat): select failure wording from prepared work - #153573

Merged
roboclaw-bot merged 25 commits into
openclaw:mainfrom
juyterman1000:fix/issue-153543-heartbeat-crosschannel
Oct 1, 2026
Merged

roboclaw-bot merged 25 commits into
openclaw:mainfrom
juyterman1000:fix/issue-153543-heartbeat-crosschannel

Conversation

@juyterman1000

@juyterman1000 juyterman1000 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

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. isHeartbeat retains 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 ccc07f0049bf main 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; replacing isHeartbeat would 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 9013a8cb02f7

Main #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 a479a53f2b2ec5e0273e9b38821026de0c8eed9c before 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 36933376215 passed at ccc07f0049bf; it is not relabeled as new-head CI. Fresh CI and review are required for 9013a8cb02f7. 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.

@clawsweeper

clawsweeper Bot commented Sep 20, 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 triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. size: S and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Sep 20, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:31 PM ET / 22:31 UTC (Revision 47).

ClawSweeper review

What this changes

The 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
Reviewed head: 9013a8cb02f714abd0efda221370470fd9914577

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful Gateway boundary proof, preserved integration behavior, and no blocking code findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The pinned base-to-head diff adds a wording decision without changing heartbeat execution classification, routing, visibility, accounting, or stored state.
Complete failure forwarding: Thrown-error rendering reads the prepared option, returned terminal failures forward it, and delivery normalization replaces generic text only when heartbeat wording was selected. Visibility continues to depend on isHeartbeat.
Conflict resolution and proof continuity: Raw head records confirm parents ccc07f0 and dd2a7ba, with tree a479a53f2b2ec5e0273e9b38821026de0c8eed9c matching the reported integration validation. Tree-entry comparisons confirm unchanged repaired production blobs and event-recovery tests. Main’s background-check copy is preserved. The supplied GitHub test merge is stale and was not used to infer merge-result regressions.
Findings None None.
Security None None.

How this fits together

OpenClaw’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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +30, Tests +83. Total +113 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 38 8 +30
Tests 5 95 12 +83
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 133 20 +113

Review metrics

Metric Value Why it matters
Production versus test growth Production net +30 lines; tests and support net +83 lines The production growth carries a distinct prepared wording fact while preserving heartbeat execution semantics.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs misleading failure notices for queued background work without changing delivery destinations or core availability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Paired isolated Gateway runs exercise the changed preparation-to-delivery path through ingress and wake RPC, showing corrected event wording, two same-session recovery replies, and a periodic control. The repaired production and event-recovery blobs remain unchanged after integration; reported exact-tree focused validation covers the updated periodic copy. No stored-data contract changes.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The shared failure-wording change affects notices visible in Telegram; existing Gateway boundary proof is sufficient for this review.

Evidence

What I checked:

  • Pinned introduced change: The pinned base-to-head diff adds a wording decision without changing heartbeat execution classification, routing, visibility, accounting, or stored state. (src/infra/heartbeat-runner-execution.ts:590, 9013a8cb02f7)
  • Complete failure forwarding: Thrown-error rendering reads the prepared option, returned terminal failures forward it, and delivery normalization replaces generic text only when heartbeat wording was selected. Visibility continues to depend on isHeartbeat. (src/auto-reply/reply/agent-runner-execution.ts:433, 9013a8cb02f7)
  • Conflict resolution and proof continuity: Raw head records confirm parents ccc07f0 and dd2a7ba, with tree a479a53f2b2ec5e0273e9b38821026de0c8eed9c matching the reported integration validation. Tree-entry comparisons confirm unchanged repaired production blobs and event-recovery tests. Main’s background-check copy is preserved. The supplied GitHub test merge is stale and was not used to infer merge-result regressions. (9013a8cb02f7)
  • Delivered behavior proof: The captured proof comment fix(heartbeat): select failure wording from prepared work #153573 (comment) reports paired actual isolated Gateway runs through QA Lab ingress and wake RPC, using a local HTTP provider and synthetic HTTP channel. Manual wake selecting exec work changes from incorrect heartbeat wording to generic wording; both same-session recovery controls and the periodic-monitor control pass. Before: 4 passes, 1 failure; after: 5 passes. This is the root policy’s accepted mock-Gateway boundary route, not authenticated Telegram evidence. (src/infra/heartbeat-runner-run.ts:115, ccc07f0049bf)
  • Current-main and release necessity: At fetched main, preparation still lacks the wording decision and delivery normalization still unconditionally rewrites generic agent failures. The inspected v2026.9.7 normalization path has the same unconditional replacement. The merged wording-only PR fix(heartbeat): avoid unverified chat availability claims #162869 does not implement selected-work classification. (src/infra/heartbeat-delivery-normalization.ts:167, 6335fb76d785)
  • Regression and test-scope review: The selected-work table covers monitor, cron, coalesced exec/cron, background-task, and scheduled-task precedence through preparation and final delivery. Returned-terminal coverage checks generic wording remains visible. The browser change retains geometry assertions and uses the existing layout-settlement helper; no visual production change or timeout increase remains. Reported integrated validation passed 96 focused cases; this read-only review did not execute tests. (src/infra/heartbeat-runner.tool-response.test.ts:370, 9013a8cb02f7)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (46 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T13:41:41.820Z sha 92c2a83 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn
  • reviewed 2026-09-30T03:17:48.835Z sha b2b4860 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn
  • reviewed 2026-09-30T03:48:09.389Z sha 35ed1e1 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn
  • reviewed 2026-09-30T04:29:52.553Z sha c980515 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn
  • reviewed 2026-10-01T01:37:11.354Z sha aba3746 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn | [P2] Pass the wording choice into terminal-run failure replies
  • reviewed 2026-10-01T02:49:43.231Z sha 26e1aef :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn | [P2] Pass the wording choice into terminal-run failure replies | [P3] Synchronize admission instead of extending the polling budget
  • reviewed 2026-10-01T04:09:55.391Z sha 17f4b21 :: needs real behavior proof before merge. :: [P2] Choose failure wording from the work selected for this turn | [P2] Pass the wording choice into terminal-run failure replies | [P3] Synchronize lifecycle completion instead of extending wait budgets
  • reviewed 2026-10-01T22:17:15.332Z sha ccc07f0 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 20, 2026
@juyterman1000

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Sep 20, 2026
@juyterman1000

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 20, 2026
@juyterman1000

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@juyterman1000

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

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.
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.
@juyterman1000

Copy link
Copy Markdown
Contributor Author

CI status on 92c2a8383e: 129 passing, 4 failing — all timeouts, none related to this diff

This PR changes 13 files, +110/-25, confined to src/auto-reply/reply/ and src/infra/heartbeat-*. Every remaining failure is a timeout, not an assertion, and none is reachable from that diff.

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
@juyterman1000

Copy link
Copy Markdown
Contributor Author

preflight is failing on PRs: .ci-harness/scripts/ci-build-manifest.mjs is never materialized

Heads up that this looks like a CI regression affecting pull requests generally, not something specific to this branch.

Error: Cannot find module '/home/runner/work/openclaw/openclaw/.ci-harness/scripts/ci-build-manifest.mjs'
##[error]Process completed with exit code 1.

Reproduced on two unrelated PRs:

preflight dies before the matrix expands, so the run ends with only ~24 checks and ci-gate red.

Likely cause. .github/workflows/ci.yml invokes the script from the harness:

1451:  node "${manifest_node_args[@]}" .ci-harness/scripts/ci-build-manifest.mjs

but the harness is populated from an explicit pathspec allowlist, and scripts/ci-build-manifest.mjs does not appear in any of them. For kind == "preflight" the allowlist is:

768:  pathspecs = [".github/actions", *node_setup_scripts]
771:  elif kind == "preflight":
772:      pathspecs += ["scripts/lib/release-context.mjs", "scripts/lib/release-version.mjs"]

with node_setup_scripts = ("scripts/lib/pnpm-lockfile-documents.mjs",). The same omission applies to the sparse-checkout branch below it. Adding scripts/ci-build-manifest.mjs (plus anything it imports) to the preflight pathspecs would presumably restore it.

Main pushes are green, which may be why this hasn't surfaced — the failure appears to be confined to the PR path.

Worth noting this can't be fixed from a PR: pull_request runs the workflow from the base branch, so a change to ci.yml in a contributor branch has no effect on the workflow that actually executes.

For context on this PR: the ci.yml here is byte-identical to upstream/main, and the change itself is 13 files under src/auto-reply/reply/ and src/infra/heartbeat-* (+108/-19). @steipete — flagging since it blocks every PR rather than just this one.

@juyterman1000

Copy link
Copy Markdown
Contributor Author

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:

823:  if kind in ("preflight", "manual"):
824:      checkout_selected_ref()
825:      if kind == "preflight" and resolve_ref("HEAD") == os.environ["WORKFLOW_SHA"]:
826:          checkout_harness(os.environ["WORKFLOW_SHA"])
827:      return

On a pull request those two revisions are never equal:

  • WORKFLOW_SHA for this run was 8ee69f26672c53ebc6b974ba1d629481c3d931ca, which is the PR merge commit (Merge b2b4860fd1 into b2cda56898).
  • checkout_selected_ref() leaves HEAD at the PR head, b2b4860fd1.

So checkout_harness() is skipped, .ci-harness/ is never created, and the later step fails:

1451:  node "${manifest_node_args[@]}" .ci-harness/scripts/ci-build-manifest.mjs
→ Error: Cannot find module '.../.ci-harness/scripts/ci-build-manifest.mjs'

On a push to main HEAD == WORKFLOW_SHA, checkout_harness() runs, and the manifest resolves — which matches main being green while PRs fail. The manifest invocation arrived in 9d75a8fe87 (#161534); the harness checkout it depends on is gated to the equal-revision case only.

I should also retract a second claim from that comment: pull_request runs the workflow from the merge ref, so a contributor branch can change ci.yml and have it take effect. I'm deliberately not doing that here — a one-line change to a 6k-line security-sensitive workflow, bundled into an unrelated heartbeat PR and unverifiable against the workflow guard suite locally, is not a change I should be making on your behalf.

Still reproducible on #161571 as well as here.

@juyterman1000

Copy link
Copy Markdown
Contributor Author

Resolved upstream by 6c07ebfaf47 ("ci: export the manifest builder into the preflight harness") plus the lint follow-up df2a29cac9a. preflight is passing across PRs again, and this branch is merged up to it.

One retraction to set straight: my second comment was wrong to blame the resolve_ref("HEAD") == WORKFLOW_SHA gate, and wrong to walk back the pathspec explanation in my first comment. The actual fix is the allowlist, in both places the first comment pointed at:

+ preflight_scripts = (
+     "scripts/ci-build-manifest.mjs",
+     "scripts/lib/release-context.mjs",
+     "scripts/lib/release-version.mjs",
+ )
- pathspecs += ["scripts/lib/release-context.mjs", "scripts/lib/release-version.mjs"]
+ pathspecs += preflight_scripts
+ elif kind == "preflight":
+     sparse_paths += [f"/{path}" for path in preflight_scripts]

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.

@roboclaw-bot

roboclaw-bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Maintainer follow-up at 9013a8cb02f714abd0efda221370470fd9914577: source review and focused conflict proof passed; final CI/review gates are pending.

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.

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Maintainer repair and delivered-text proof

The 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. isHeartbeat continues to own execution class, visibility, suppression, and accounting.

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 proof

Ran 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 17f4b21aa5b42b69136c5cf5da58a2d88c2ed138; the repaired source is bound to incremental patch SHA256 0e3e97d06cf68a27e9ff6b37c079cad7ed21ec78f68b034ce1a9a02adc44dfec. Source hashes were verified again on resume. This was run on October 1, 2026, around 2:01–2:05 a.m. PDT; it is preserved paired evidence, not a new execution at publication time.

The fixture seeds a conversation through channel ingress, injects a failing immediate exec event, verifies a same-session reply, invokes the public wake RPC with mode: now and exec-completion work, verifies another same-session reply, and forces the persisted heartbeat monitor as the periodic control.

Scenario Before Repaired candidate
Immediate exec-event failure Generic failure, pass Generic failure, pass
Reply after that failed event Same session replies, pass Same session replies, pass
Manual wake selects exec-completion work Incorrect heartbeat wording, fail Generic failure, pass
Reply after the manual exec failure Same session replies, pass Same session replies, pass
Periodic monitor failure Heartbeat wording, pass Heartbeat wording, pass

Observed regression text before:

⚠️ Heartbeat check failed before it could produce an update. The main chat session remains available.

Observed delivered text after:

⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

{"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 node /private/tmp/pr153573-gateway-proof.mjs original-manual-exec and the same driver with candidate-manual-exec, with each source built before its respective run. The helper imports the checked-in QA Lab API; it does not replace the heartbeat runner or error renderer. The earlier untagged interval fixture was invalid as a cron-work reproduction and is excluded. No authenticated provider or Telegram Test Server run is claimed; this exercises channel-visible delivery under the repository’s mock-Gateway proof route. It does not establish a fix for the separate cross-channel routing report in #153543, which should remain open.

Focused validation and scope

The 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 openai/codex commit 064c6b8c737f5b41d171fdda80bd9ef10ad06eb3 (0.158.0): codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:386-433, turn.rs:33-38,549, and codex-rs/app-server/src/bespoke_event_handling.rs:1311-1345,1601-1627. Failed turn status/error and non-retrying error notifications converge on the shared repaired owners.

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

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@Patrick-Erichsen @juyterman1000 — I resumed the authorized landing follow-through for ccc07f0049bf. Main advanced with #162869, changing the canonical periodic-heartbeat failure copy. The only merge conflict is the exec-event recovery assertion in src/infra/heartbeat-runner.tool-response.test.ts. I am preparing an ancestry-preserving merge that keeps this PR’s generic event wording and useHeartbeatFailureCopy: false assertion while preserving main’s new background-check wording for periodic checks. Existing paired Gateway proof remains evidence for the unchanged selected-work behavior; I will check the affected integrated tests and native gates before publication. I will recheck the remote head immediately before any branch update and stop rather than overwrite a newer push.

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]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

The merge conflict is resolved at 9013a8cb02f714abd0efda221370470fd9914577, preserving contributor ancestry and the reviewed selected-work production code. Main’s new background-check failure copy is retained for periodic checks; selected event failures remain generic. The exact integrated tree passed 96 focused tests in four files on sanitized AWS. Updated evidence and timing are in the PR body; the prior paired Gateway proof remains valid for unchanged behavior. Please review this exact head and its conflict-resolution delta; no CI bypass requested.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

3 participants