Skip to content

[Bug]: Heartbeat-driven agent replies leave pendingFinalDelivery stuck, blocking subsequent heartbeats #83184

Closed

Description

@agocs

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

runHeartbeatOnce writes lastHeartbeatText / lastHeartbeatSentAt after a successful send but never nulls the pendingFinalDelivery* fields, so any heartbeat-driven agent run that previously set pendingFinalDelivery: true leaves the session permanently stuck on the get-reply redelivery short-circuit.

Steps to reproduce

  1. Drive the heartbeat path until getReplyFromConfig produces a substantive (non-HEARTBEAT_OK) text payload. The reply-agent path (src/auto-reply/reply/agent-runner.ts:2169) sets pendingFinalDelivery: true on the session at the end of substantive runs regardless of trigger.
  2. Let the heartbeat finish: sendDurableMessageBatch succeeds and runHeartbeatOnce writes lastHeartbeatText / lastHeartbeatSentAt (src/infra/heartbeat-runner.ts:2011-2022).
  3. Wait for the next heartbeat tick.

Expected behavior

After step 2, pendingFinalDelivery* is cleared (the same way the user-message dispatch path does it via clearPendingFinalDeliveryAfterSuccess at src/auto-reply/reply/dispatch-from-config.ts:365-391, called from :1671). Subsequent heartbeats observe a clean session and invoke the agent normally.

Actual behavior

pendingFinalDelivery remains true indefinitely. On the next heartbeat, the get-reply fast path treats the session as having an unresolved final delivery and short-circuits before invoking the agent. The user observes silent loss: no notifications, no model calls, no errors surfaced.

OpenClaw version

Verified affected: 2026.5.7 through 2026.5.16-beta.2. Diagnosis applies to current main (2026.5.17).

Operating system

Linux (Docker deployment).

Install method

docker

Model

NOT_ENOUGH_INFO (model-independent; bug is in core heartbeat send path).

Provider / routing chain

NOT_ENOUGH_INFO (provider-independent).

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Code-level diagnosis (paths against openclaw/openclaw main):

src/auto-reply/reply/agent-runner.ts:2169
  Sets `pendingFinalDelivery: true` at the end of every substantive agent run,
  regardless of trigger source (user message vs heartbeat).

src/auto-reply/reply/dispatch-from-config.ts:365-391
  Defines `clearPendingFinalDeliveryAfterSuccess` which nulls all seven
  pendingFinalDelivery* fields plus refreshes updatedAt.

src/auto-reply/reply/dispatch-from-config.ts:1671
  Calls `clearPendingFinalDeliveryAfterSuccess` after a successful
  user-message-driven dispatch. The heartbeat path has no equivalent call.

src/infra/heartbeat-runner.ts:1979-2022
  Heartbeat send path. On success it writes `lastHeartbeatText` and
  `lastHeartbeatSentAt` via `updateSessionStore`, but never clears any of
  the seven `pendingFinalDelivery*` fields. This is the entire bug.

Local out-of-band workaround in our deployment: a cron job at */10 minutes
that nulls the stuck fields when `pendingFinalDeliveryText` matches
`lastHeartbeatText`. The cron consistently fires after every active-hours
heartbeat that produces substantive text, confirming the bug is fully
deterministic on the affected versions.

Impact and severity

  • Affected: any deployment whose heartbeat-driven agent runs ever produce substantive (non-HEARTBEAT_OK) text. Heartbeat-only setups silently lose every subsequent heartbeat after the first substantive run.
  • Severity: High. No user-visible error path; the agent simply stops responding to heartbeats and no model calls are made.
  • Frequency: Deterministic. Every heartbeat that produces substantive text leaves the session stuck.
  • Consequence: Missed notifications, missed model invocations, no surfaced error. Detection requires inspecting the session store directly.

Additional information

Suggested fix: extend the existing updateSessionStore call at src/infra/heartbeat-runner.ts:2011-2022 to also null the seven pendingFinalDelivery* fields, mirroring clearPendingFinalDeliveryAfterSuccess. A regression test seeding pendingFinalDelivery: true + a heartbeat-ack pendingFinalDeliveryText (so the heartbeat-defer check at :1328 does not short-circuit), running runHeartbeatOnce with a substantive reply, and asserting all seven fields are undefined afterward reproduces the bug and pins the fix.

PR follow-up will be linked here.

Activity

  1. clawsweeper commented on May 17, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 18, 2026, 7:35 PM ET / 23:35 UTC.

    Summary
    Keep open: current main and latest release still have the heartbeat send-success write without pending-final cleanup, and the linked closing PR remains open rather than merged.

    Reproducibility: yes. at source level: current main stores substantive heartbeat output as pendingFinalDelivery, then records visible heartbeat send success without clearing those fields. I did not run a writable fixture because this review is read-only.

    Root-cause cluster
    Relationship: canonical
    Canonical: #83184
    Summary: This issue is the canonical report for the heartbeat send-success pendingFinalDelivery cleanup gap; one open PR is the candidate fix, and broader retry-bound work is adjacent.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    No new ClawSweeper fix PR should be queued because the issue already has an open closing implementation lane at #83187.

    Review details

    Best possible solution:

    Land #83187 or an equivalent heartbeat cleanup with full pending-final field parity and regression coverage, while leaving broader retry-bound work to #85743.

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

    Yes, at source level: current main stores substantive heartbeat output as pendingFinalDelivery, then records visible heartbeat send success without clearing those fields. I did not run a writable fixture because this review is read-only.

    Is this the best way to solve the issue?

    Yes, clearing pending-final state in the heartbeat send-success owner path is the narrow maintainable fix for this issue. The linked PR is the implementation lane, while stale orphan replay caps belong to the adjacent follow-up.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    Codex review notes: model internal, reasoning high; reviewed against a7b52ecad90b.

    Label changes

    Label justifications:

    • P1: A successful substantive heartbeat can deterministically leave session state stuck and stop later heartbeat-driven notifications or model calls.
    • impact:message-loss: Subsequent heartbeat alerts or updates can be silently skipped, blocked, or replayed from stale pending-delivery state.
    • impact:session-state: The central failure is durable pendingFinalDelivery session state remaining set after heartbeat delivery succeeds.
    Evidence reviewed

    What I checked:

    • Repository policy read: Root AGENTS.md was read fully and applied to the source-history, linked-PR, and no-duplicate-fix-lane parts of this review. (AGENTS.md:1, a7b52ecad90b)
    • Current main heartbeat send-success gap: After sendDurableMessageBatch succeeds, runHeartbeatOnce records lastHeartbeatText and lastHeartbeatSentAt but does not clear pendingFinalDelivery or related recovery fields. (src/infra/heartbeat-runner.ts:2117, a7b52ecad90b)
    • Current main creates pending final delivery for heartbeat text: The shared reply-agent path stores substantive heartbeat output as pendingFinalDelivery with pendingFinalDeliveryText, making the missing heartbeat cleanup reachable. (src/auto-reply/reply/agent-runner.ts:2553, a7b52ecad90b)
    • Sibling success cleanup contract: The normal dispatch success helper clears the pendingFinalDelivery field family, including pendingFinalDeliveryIntentId, after successful final delivery. (src/auto-reply/reply/dispatch-from-config.ts:732, a7b52ecad90b)
    • Fast-path source reproduction support: The current fast-path test keeps non-ack heartbeat pending delivery set, matching the source-level stuck-state path when send-success cleanup is absent. (src/auto-reply/reply/get-reply.fast-path.test.ts:300, a7b52ecad90b)
    • Latest release still affected: v2026.6.8 has the same lastHeartbeatText/lastHeartbeatSentAt write without pendingFinalDelivery cleanup; git grep found pendingFinalDelivery references only in the heartbeat preflight/defer check for that file at the tag. (src/infra/heartbeat-runner.ts:2075, 844f405ac1be)

    Likely related people:

    • Mert Başar: Commit c240e71 added the durable pending-final delivery paths across the central agent-runner, dispatch, get-reply, and heartbeat-runner files involved here. (role: introduced durable pending-final delivery behavior; confidence: high; commits: c240e718e91e; files: src/auto-reply/reply/agent-runner.ts, src/auto-reply/reply/dispatch-from-config.ts, src/auto-reply/reply/get-reply.ts)
    • Peter Steinberger: Commit 1c1253e changed heartbeat pending-replay ack policy and adjacent fast-path tests for the same pending-final state family. (role: adjacent heartbeat replay contributor; confidence: high; commits: 1c1253e5af33; files: src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/get-reply.fast-path.test.ts)
    • Martin Kessler: Commit d00e764 changed pending final replay behavior across get-reply, its fast-path tests, and heartbeat-runner. (role: recent heartbeat pending-delivery contributor; confidence: high; commits: d00e764e6655; files: src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/get-reply.fast-path.test.ts, src/infra/heartbeat-runner.ts)
    • Josh Avant: Commit 3643de4 changed the heartbeat branch around suppressed commitment delivery near the missing cleanup surface. (role: recent heartbeat send-state contributor; confidence: medium; commits: 3643de4ba7b6; files: src/infra/heartbeat-runner.ts, src/infra/heartbeat-runner.commitments.test.ts)
    • agocs: The linked open PR adds the heartbeat post-send cleanup and regression test for this issue. (role: proposed fix author; confidence: high; commits: e2f3d73e9687; files: src/infra/heartbeat-runner.ts, src/infra/heartbeat-runner.clears-pending-final-delivery.test.ts)
    How this review workflow works
    • 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.
  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.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on May 17, 2026
  3. fanispoulinakisai-boop commented on May 20, 2026

    @fanispoulinakisai-boop

    Confirming this bug is still active and reproducing on OpenClaw 2026.5.18 (clean npm install -g openclaw@2026.5.18, macOS 26.5, Node v25.6.0).

    Two production incidents (~24h apart, same machine, same agent)

    Incident 1 — 2026-05-18 17:09 → 2026-05-19 01:40 Athens

    • Successful midday heartbeat Telegram delivery at 17:09.
    • Subsequent 30-min heartbeat ticks all fired on schedule (visible in gateway.log) but produced zero Telegram outbound.
    • After 8h, sessions.json showed pendingFinalDelivery: true, pendingFinalDeliveryAttemptCount: 17, pendingFinalDeliveryLastError: null, pendingFinalDeliveryText containing the exact text already delivered at 17:09.
    • Manually deleting the 6 pendingFinalDelivery* keys from agent:main:main immediately restored normal heartbeat behavior.

    Incident 2 — 2026-05-19 17:10 → 2026-05-20 04:46 Athens (~12h later, post-5.18 update)

    • Successful midday heartbeat Telegram delivery at 17:10 (msg 8711, ran on openai-codex/gpt-5.5).
    • Subsequent ticks at 17:39, 18:09, 18:39, 19:09, 19:39, 20:09, 20:39, 21:09, 21:39, 22:09, 22:39, 23:09, 23:39, 00:09, 00:39, 01:09, 01:39, 02:09, 02:39, 03:09, 03:39, 04:09, 04:39 — all fired, zero Telegram deliveries.
    • sessions.json at 04:46 showed pendingFinalDelivery: true, pendingFinalDeliveryText matching prior lastHeartbeatText (same-text correlation as in the original report).
    • Manual clear restored function.

    Confirmation of file:line citations

    Reading the v2026.5.18 source confirms the diagnosis as reported in the original issue:

    • Trigger site: src/auto-reply/reply/agent-runner.ts:2151-2162 writes the 7 pendingFinalDelivery* keys to the session store whenever getReplyFromConfig produces non-token reply text. The stripHeartbeatToken ack-check at 2142-2150 only filters pure HEARTBEAT_OK token replies.
    • Missing clear site: src/infra/heartbeat-runner.ts:1979-2022 — the heartbeat outbound path updates lastHeartbeatText, lastHeartbeatSentAt, updatedAt, then calls markCommitmentsStatus / updateTaskTimestamps. It never undefines the pendingFinalDelivery* keys.
    • Reachable clear logic that the heartbeat path bypasses: src/agents/agent-command.ts:1538-1559 clears the same keys after deliverAgentCommandResult returns deliverySucceeded === true. Heartbeat-runner does not go through deliverAgentCommandResult — it calls sendDurableMessageBatch directly — so the clear is unreachable from heartbeat ticks.

    On PR #83503 / changelog wording

    The 2026.5.18 changelog includes:

    "Release stability: recover stale session diagnostics and Codex OAuth fallback state so stuck runs and reused refresh tokens clear without blocking follow-up work."

    For anyone landing here from that line: PR #83503's diff touched src/agents/auth-profiles/oauth.ts, profiles.ts, model-auth.ts, commands/sessions*, commands/models/list.status*, and src/logging/diagnostic*. It does NOT touch heartbeat-runner.ts, agent-runner.ts, or agent-command.ts. The "stuck runs" scope in #83503 is OAuth-fallback / idle queued embedded-run recovery — separate from this issue. Confirming this issue (#83184) is still the correct open ticket on 2026.5.18.

    Suggested fix (matching the original reporter's pointer)

    Extend the existing updateSessionStore block in heartbeat-runner.ts:2011-2022 to also undefined the 7 pendingFinalDelivery* keys after a verified-successful sendDurableMessageBatch send, mirroring agent-command.ts:1548-1551:

    store[sessionKey] = {
      ...current,
      lastHeartbeatText: normalized.text,
      lastHeartbeatSentAt: startedAt,
      pendingFinalDelivery: undefined,
      pendingFinalDeliveryText: undefined,
      pendingFinalDeliveryCreatedAt: undefined,
      pendingFinalDeliveryLastAttemptAt: undefined,
      pendingFinalDeliveryAttemptCount: undefined,
      pendingFinalDeliveryLastError: undefined,
      pendingFinalDeliveryContext: undefined,
    };

    Happy to share full sessions.json snapshots or gateway log excerpts from either incident if useful for testing the fix.

  4. Staasy commented on May 23, 2026

    @Staasy

    Hit this in production on 2026.5.12 (hourly heartbeat, session: main, openai-codex/gpt-5.4). Two additions not yet in this thread: a second route that creates the stuck pendingFinalDelivery, and why nothing ever recovers it — both still present at latest.

    1. A second route: an interrupted/aborted run, not a successful send

    The OP route is "successful send never clears". In our incident the run never succeeded. The model emitted a short non-HEARTBEAT_OK preamble, then the embedded run went silent (cf. #85251) and was force-aborted by stuck-session recovery:

    [diagnostic] stalled session: sessionKey=agent:main:main state=processing
      reason=active_work_without_progress classification=stalled_agent_run activeWorkKind=embedded_run
    [diagnostic] stuck session recovery: action=abort_embedded_run aborted=true drained=true
      forceCleared=false released=0
    

    The abort left the in-flight preamble as pendingFinalDelivery (pendingFinalDeliveryCreatedAt == endedAt == abort time) and the session ended status: "timeout". So besides the successful-send path, the abort/timeout path also produces the stuck state — and here the run never reaches clearPendingFinalDeliveryAfterSuccess at all.

    2. Why it never recovers, even across a gateway restart

    The give-up / cleanup paths in src/agents/main-session-restart-recovery.ts are gated on status === "running":

    • markSessionFailed returns early unless entry.status === "running" (it would otherwise clear all pendingFinalDelivery*).
    • recoverStore only processes entries with status === "running" && abortedLastRun === true.

    A session left in status: "timeout" matches neither, so post-restart recovery skips it entirely. Combined with the unbounded heartbeat retry in get-reply.ts (no cap — see #85743) and stripHeartbeatToken classifying any non-HEARTBEAT_OK text as deliverable content (shouldSkip: false), the orphan retries once per heartbeat tick forever.

    Our session while wedged:

    {
      "status": "timeout",
      "pendingFinalDelivery": true,
      "pendingFinalDeliveryAttemptCount": 110,
      "pendingFinalDeliveryLastAttemptAt": "<created + ~109.8h>",
      "pendingFinalDeliveryLastError": null
    }

    110 attempts over ~109.8h = exactly one retry per hourly heartbeat ⇒ 4.5 days of silently dead heartbeat across one gateway restart, until the fields were cleared manually.

    Version confirmation

    The relevant code is unchanged at v2026.5.20 (latest stable) and v2026.5.22-beta.1: markSessionFailed / recoverStore still gate on status === "running", and the get-reply.ts heartbeat retry still has no attempt/age cap. #80357 (which closed #79258) only skips the durable write when output strips to an ack-only HEARTBEAT_OK, so a non-ack preamble from an interrupted run is not covered.

    Suggestion

    The give-up logic should also handle terminal non-running states (timeout, aborted), and/or the attempt cap / TTL proposed in #85743 should apply regardless of content classification — so a single transient interruption (e.g. #85251) can't wedge the heartbeat session indefinitely.

  5. added
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    on May 24, 2026
  6. pfrederiksen commented on May 26, 2026

    @pfrederiksen
    Contributor

    Additional field evidence: heartbeat warning after Codex timeout/client-close cascade

    Observed on OpenClaw 2026.5.22 (a374c3a), Node v22.22.2, Linux/systemd user gateway, Telegram group heartbeat target, Codex app-server runtime with openai/gpt-5.5.

    User-visible symptom

    Telegram showed the heartbeat failure banner twice:

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

    The main chat session stayed available, but the heartbeat itself did not produce HEARTBEAT_OK or an alert.

    Local log signature

    The failures lined up with a long-running Codex app-server turn timing out, then the client being retired/closed and subsequent lanes failing immediately:

    2026-05-25T23:42:11Z [agent/embedded] codex app-server client retired after timed-out turn
    2026-05-25T23:42:11Z [agent/embedded] embedded run failover decision: stage=assistant decision=fallback_model reason=timeout from=openai-codex/gpt-5.5
    2026-05-25T23:42:11Z [diagnostic] lane task error: lane=main durationMs=1821068 error="FailoverError: LLM request timed out."
    2026-05-25T23:42:12Z Embedded agent failed before reply: LLM request timed out.
    2026-05-25T23:42:59Z [agents/harness] Codex agent harness failed; not falling back to embedded PI backend
    2026-05-25T23:42:59Z [diagnostic] lane task error: lane=main durationMs=36591 error="Error: codex app-server client is closed"
    2026-05-25T23:42:59Z Embedded agent failed before reply: codex app-server client is closed
    

    A second similar incident occurred shortly afterward:

    2026-05-26T00:13:12Z [agent/embedded] codex app-server client retired after timed-out turn
    2026-05-26T00:13:12Z [agent/embedded] embedded run failover decision: stage=assistant decision=fallback_model reason=timeout from=openai-codex/gpt-5.5
    2026-05-26T00:13:12Z [diagnostic] lane task error: lane=main durationMs=1846750 error="FailoverError: LLM request timed out."
    2026-05-26T00:13:47Z [diagnostic] lane task error: lane=main durationMs=23081 error="Error: codex app-server client is closed"
    2026-05-26T00:13:47Z Embedded agent failed before reply: codex app-server client is closed
    

    Mitigation being tested

    I changed the heartbeat config to reduce coupling with the busy main/group session:

    {
      "heartbeat": {
        "lightContext": true,
        "isolatedSession": true,
        "skipWhenBusy": true,
        "timeoutSeconds": 120
      }
    }

    Hot reload accepted the config:

    2026-05-26T00:15:29Z [reload] config change detected; evaluating reload (agents.defaults.heartbeat.lightContext, agents.defaults.heartbeat.isolatedSession, agents.defaults.heartbeat.skipWhenBusy, agents.defaults.heartbeat.timeoutSeconds)
    2026-05-26T00:15:29Z [reload] config hot reload applied (agents.defaults.heartbeat.lightContext, agents.defaults.heartbeat.isolatedSession, agents.defaults.heartbeat.skipWhenBusy, agents.defaults.heartbeat.timeoutSeconds)
    

    After restart, the gateway was active/running and logs only showed:

    2026-05-26T00:21:17Z [heartbeat] started
    

    No immediate LLM request timed out, client is closed, or heartbeat-failed lines after restart yet. I’ll update if the next scheduled heartbeat still fails.

    This seems related to this issue because the user-visible failure is heartbeat-specific, but the proximate cause looks like the Codex app-server timeout/client-close cascade described in #85251.

  7. aw-stevens commented on May 27, 2026

    @aw-stevens

    Confirming on 2026.5.26 — different trigger context (main-session heartbeat + small model)

    Confirming this is still live on 2026.5.26 (latest stable). Our setup differs from the Telegram/target-delivery reports above, which may help separate the core pendingFinalDelivery bug from the delivery-specific symptoms:

    Config

    gateway heartbeat, isolatedSession: false (main session), target: slack, ackMaxChars: 0, model claude-haiku-4-5 via OpenRouter. The agent runs several periodic "programs" per tick.

    Trigger (differs from above)

    The heartbeat's final reply intermittently includes non-HEARTBEAT_OK text — a small model leaking a sentence of preamble (e.g. "Excellent. Program 1 complete. The heartbeat contract is to return HEARTBEAT_OK…") around the token. Since stripHeartbeatToken only treats a pure HEARTBEAT_OK as an ack — and ackMaxChars: 0 means no other short reply qualifies — that preamble counts as substantive → sets pendingFinalDelivery*, which the send-success path then never clears (the gap this issue tracks).

    Failure (main-session)

    Every subsequent tick logs [heartbeat] using explicit accountId then silently dead-ends — no model turn, no run_started — while the replay path increments pendingFinalDeliveryAttemptCount. The tick still advances heartbeatTaskState (consistent with #79479's stamp-on-skip), so it looks like it ran. Observed in our session store:

    pendingFinalDelivery: true
    pendingFinalDeliveryText: "Excellent. Program 1 complete. …"
    pendingFinalDeliveryAttemptCount: 7
    pendingFinalDeliveryCreatedAt: (~6 days earlier — a stale entry from a prior run)
    

    Clean isolation test (recoverable-but-not-durable)

    Delete the pendingFinalDelivery* keys + restart → the next main-session tick dispatches a real run. But that run emits non-ack text again → re-sets pendingFinalDelivery → the following tick dead-ends again. So one manual clear buys exactly one tick. This rules out scheduler/session-routing root causes: dispatch works the instant the stale state is gone.

    Workaround that avoids it entirely

    heartbeat.isolatedSession: true — a fresh session per tick carries no pendingFinalDelivery, so the replay never fires (cost: loses main-session context injection). May be worth noting for others until #83187 lands.

    PR #83187's clear-on-success would fix our case directly. A complementary ackMaxChars-aware ack check (so a short non-token reply also clears — per the #85743 discussion) would harden it against small models that don't reliably emit the bare token.

  8. fanispoulinakisai-boop commented on May 29, 2026

    @fanispoulinakisai-boop

    Still reproducing on 2026.5.20 (e510042), macOS, openai/gpt-5.5 on the main session (agent:main:main).

    Fresh data from a long-running instance, in case the elapsed scale helps:

    • pendingFinalDeliveryCreatedAt: 2026-05-27 10:10:04 (a successful morning heartbeat send)
    • pendingFinalDeliveryLastAttemptAt: 2026-05-30 01:09:23 (still firing)
    • pendingFinalDeliveryAttemptCount: 123
    • pendingFinalDeliveryLastError: null

    That's ~126 elapsed 30-min ticks over ~3 days vs attemptCount 123 (the small gap = the handful of ticks that re-delivered then re-stuck). User-visible symptom: the agent re-pushes the same cached morning message once per day past the quiet-hours boundary, and never runs a fresh turn again — so midday/evening check-ins silently stopped on 2026-05-28 with zero error and zero new model sessions on disk. The ~1s send-after-trigger latency confirms it's a cached redelivery, not a real turn.

    Can confirm @aw-stevens's note: heartbeat.isolatedSession: true sidesteps it (fresh session per tick carries no pendingFinalDelivery), and a manual clear of the pendingFinalDelivery* keys is recoverable-but-not-durable — the next successful send re-sets it. Still no auto-clear/TTL as of 2026.5.20.

  9. aw-stevens commented on Jun 9, 2026

    @aw-stevens

    Was ... there an older version of OC that didn't suffer from this I can pin? Genuinely confused how more of the community isn't popping off about this, given the standard heartbeat in main session config feels basically unusable for us.

    Switching to gpt-5-mini did solve the initial issue of CoT leaking into final messages that should have been an ack (planting the pendingLastReply poison). But for alerts during heartbeat runs, where the OC response contract literally says "for alerts, do not include HEARTBEAT_OK; return only the alert text." -- the agent honors that contract exactly, sends just the substantive text via --announce path, then OC poisons the session. So it really doesn't seem like there's any sort of workaround on the behavioral harness engineering front ... but maybe I'm missing something?

    [Update] My new workaround: created a custom plugin to just clear the pendingFinalReply poison pill up on every send -- effectively just recreating the fix from #83187 but via hooks/utilities available in the SDK 🤷‍♂️

  10. danashburn commented on Jun 12, 2026

    @danashburn

    Cross-referencing from #89115: the same clear-after-success ordering family is still live on 2026.6.5 in the interactive reply path, and the relevant dispatch block is unchanged in the published 2026.6.6-beta.2 tarball. Fresh production trace and a new compaction-adjacent trigger datapoint here: #89115 (comment)

    #83187 still looks like the right fix for this heartbeat path. A maintainer review of it (or #89130 / #90229 for the reply path) would be appreciated.

  11. locked as resolved and limited conversation to collaborators on Jul 18, 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:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions