Skip to content

Heartbeat fork bug still reproducing on 2026.5.26 — follow-up to #84332 (locked) #87595

Closed

Description

@danielcrick

Follow-up to #84332 (locked, can't comment) — heartbeat fork bug is still firing on 2026.5.26. Commit cce0049 either didn't ship in this release or isn't catching the case.

Original bug closed as fixed via PR #83647 on 2026-05-19. I upgraded from 2026.5.3-1 to 2026.5.26 last night (2026-05-27 ~18:41 BST). Same behaviour.

Mitigation we're running

Local LaunchAgent com.openclaw.paige.fork-watchdog polls ps every 60s for claude --resume processes. When exactly two are present it SIGTERMs the younger one. Source: bin/fork-watchdog.py in our workspace.

Since the upgrade the watchdog has detected and killed 15 forks in ~15 hours of active WhatsApp use (Paige is on a WhatsApp DM channel through the gateway).

Version

OpenClaw 2026.5.26 (10ad3aa)

Frequency

  • 15 forks killed, 2026-05-27T19:30 BST → 2026-05-28T09:32 BST
  • Roughly one per hour of active use
  • No idle gaps long enough to claim the bug was "off" at any point

First three forks post-upgrade

[2026-05-27T19:30:34] FORK DETECTED: keep PID 26708 (etime 10:13), kill PID 27029 (etime 00:18)
[2026-05-27T19:45:36] FORK DETECTED: keep PID 26708 (etime 25:15), kill PID 28004 (etime 00:12)
[2026-05-27T20:45:42] FORK DETECTED: keep PID 29055 (etime 11:59), kill PID 29408 (etime 00:18)

Most recent three

[2026-05-28T08:30:58] FORK DETECTED: keep PID 50161 (etime 00:58), kill PID 50197 (etime 00:32)
[2026-05-28T08:54:01] FORK DETECTED: keep PID 50500 (etime 13:04), kill PID 51179 (etime 00:16)
[2026-05-28T09:32:05] FORK DETECTED: keep PID 50500 (etime 51:08), kill PID 52422 (etime 00:48)

Killed PID etime is always seconds-to-a-minute. Kept PID is always the older one with real conversation context — same shape as the original bug.

Asks

  1. Can you confirm whether commit cce0049 actually shipped in 2026.5.26? A quick release-notes check should answer it. If it didn't ship, that explains everything and I'll wait for the next tagged release.
  2. If cce0049 IS in 2026.5.26 — there's a code path it isn't catching. Happy to share the full watchdog log, the gateway log windows around each fork event, or run a small repro script. Tell me what would be most useful.

Without the watchdog this is end-user-visible: duplicated replies, context-amnesia replies on busy threads. With it, the duplicates get killed within 60s but the underlying spawn is still happening every ~hour.

Appreciated the quick turnaround on the original — happy to help debug this round too.

— Dan

Activity

  1. clawsweeper commented on May 28, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Close as implemented on current main: the merged heartbeat scheduler/reply-admission fix now defers scheduled heartbeats behind same-agent active work and converts heartbeat admission races into retryable busy skips, which addresses the reported parallel Claude live-session fork path.

    I found the merged PR that appears to have closed this: #88970: fix #85871: [Bug]: Heartbeat scheduler silently fails to fire on 5.20 and all 5.x versions (regression from 4.23).

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Close as current-main implemented and ask for a new report or reopen only with fork logs from a build containing PR #88970's fix.

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

    No high-confidence failing current-main reproduction was established; the old failure path is source-reproducible from the issue logs and PR #88970's admission-race fix, while current main now contains the relevant guards.

    Is this the best way to solve the issue?

    Yes; the implemented fix is at the correct scheduler/reply-admission boundary because heartbeat background work now retries when the session or same-agent lane is busy instead of spawning or counting a skipped model turn as complete.

    Security review:

    Security review: This issue is not a security-sensitive report and no PR diff is under review.

    AGENTS.md: found and applied where relevant.

    What I checked:

    • Default DM routing shares the main session key: Direct-message routes default to dmScope "main", so a WhatsApp DM without explicit per-peer scoping resolves to the agent main session rather than an independent channel session. (src/routing/session-key.ts:223, 86a28636fa80)
    • Scheduled heartbeat same-agent deferral exists on current main: Current heartbeat runner skips scheduled heartbeats with requests-in-flight when any same-agent reply or embedded run is active, while preserving immediate/manual wake semantics. (src/infra/heartbeat-runner.ts:1373, 86a28636fa80)
    • Heartbeat admission race no longer counts as ran: If getReplyFromConfig returns no heartbeat response because reply-lane admission skipped on active-run, the runner now returns the retryable requests-in-flight skip instead of ok-empty/ran. (src/infra/heartbeat-runner.ts:1811, 86a28636fa80)
    • Heartbeat turns drop rather than competing for an active reply slot: Reply admission returns active-run for heartbeat turns when the session slot is already owned, and the caller records that admission snapshot for heartbeat cleanup. (src/auto-reply/reply/reply-turn-admission.ts:82, 86a28636fa80)
    • Non-Slack direct turns remain behind the active operation: Dispatch admission waits on the session's active reply operation for non-Slack direct turns; adjacent coverage verifies a Telegram direct turn stays blocked while its session has an active operation. (src/auto-reply/reply/dispatch-from-config.ts:1356, 86a28636fa80)
    • Regression tests cover busy heartbeat skips: Tests cover same-agent active reply runs, resolved-session active runs, isolated heartbeat active runs, and active embedded-run pre-dispatch deferral returning requests-in-flight without calling reply dispatch. (src/infra/heartbeat-runner.skips-busy-session-lane.test.ts:260, 86a28636fa80)

    Likely related people:

    Codex review notes: model internal, reasoning high; reviewed against 86a28636fa80; fix evidence: merged PR #88970, commit 2196ea29304a, main fix timestamp 2026-06-16T06:17:37Z.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    on May 28, 2026
  3. added
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jun 15, 2026
  4. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions