Skip to content

Heartbeat ACK overrides normal reply when gateway poll and user message arrive simultaneously #50797

Description

@nicolas-hey

Bug Description

When the Gateway internal heartbeat poll and a user message arrive in the same processing cycle, the heartbeat ACK (HEARTBEAT_OK) overrides the normal reply. The user only receives HEARTBEAT_OK and the actual reply is lost.

Steps to Reproduce

  1. User sends a message to the agent
  2. At approximately the same time, the Gateway internal heartbeat poll fires
  3. Agent responds with HEARTBEAT_OK instead of the actual reply
  4. User sees no response or only HEARTBEAT_OK

Observed Behavior

  • On 2026-03-20 ~00:55 (topic 9566): Long reply about "vibe coding learning resources" was truncated. Error: "No response generated. Please try again"
  • On 2026-03-20 ~10:58 (topic 9566): User sent "ok" — only received HEARTBEAT_OK, actual reply was not sent

System Status

  • OS: macOS 26.3.1 (arm64) · Node 25.8.0
  • Heartbeat: 6h (main agent configured via HEARTBEAT.md)
  • Sessions: 39 active
  • Current session model: MiniMax-M2.7 / Default: gpt-5.4

Analysis

The Gateway has an internal system-level heartbeat mechanism that is independent of the user-configured HEARTBEAT.md cron. When this heartbeat poll arrives simultaneously with a user message in the same processing cycle, the heartbeat ACK takes priority over the normal reply, effectively suppressing it.

The two heartbeat systems are:

  1. HEARTBEAT.md cron (user-configured, 3/9/15/21 points) — this is what the user controls
  2. Gateway internal poll — system-level, not visible or configurable by the user

Expected Behavior

Heartbeat ACKs should not override or suppress normal replies. The two should be independent — a heartbeat poll should never cause a valid user-facing reply to be lost.

Suggested Fix Direction

  • Heartbeat responses should be handled in a separate context from user message responses
  • Or the gateway should queue heartbeat ACKs rather than letting them race with message responses
  • At minimum: log when this collision occurs so it can be diagnosed

Environment

  • OpenClaw version: 2026.3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions