Files
openclaw/src/infra
Christopher Agocs 305fa9c4dd fix(heartbeat): clear pendingFinalDelivery* on send success (#83187)
* fix(infra): clear pendingFinalDelivery* after successful heartbeat send

Heartbeat-driven agent runs can leave pendingFinalDelivery set on the
session; runHeartbeatOnce wrote lastHeartbeatText/lastHeartbeatSentAt on
send success but never cleared the recovery fields, so the next heartbeat
hit the get-reply redelivery short-circuit and skipped the agent. Extend
the existing post-success updateSessionStore block to null all seven
pendingFinalDelivery* fields, mirroring clearPendingFinalDeliveryAfterSuccess
in dispatch-from-config.ts.

Refs: https://github.com/openclaw/openclaw/issues/83184

* fix(heartbeat): clear pendingFinalDelivery* on duplicate-skip too

The duplicate-suppression branch returns before any send, so it never hit
the send-success clear, leaving pendingFinalDelivery* recovery state stuck
on a payload that was already delivered. Clear it there too, unconditionally
(mirroring the send-success path and the canonical
clearPendingFinalDeliveryAfterSuccess via a shared field set). A byte-equal
text match would no-op for responsePrefix-configured agents, since
agent-runner stores the pending text pre-normalization while the delivered
text re-adds the prefix; the duplicate check already proves the payload was
delivered, so the clear is unconditional. Adds a regression test covering
the prefix-divergence case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(telegram): drop unused markdown param in findRichMarkdownTableLineIndexes

Unblocks tsgo:prod (TS6133 'markdown' is declared but its value is never
read), which main currently fails after b3f315461b. The parameter was never
read inside the function; the sole caller already derives lines/fenceSpans.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(test): type heartbeat reply spy in pendingFinalDelivery clear tests

check:test-types failed: the extracted heartbeatDeps helper typed replySpy as
the generic ReturnType<typeof vi.fn>, which is not assignable to
getReplyFromConfig. Use the exported HeartbeatReplySpy type instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(heartbeat): clear pendingFinalDeliveryIntentId on delivery success

Add the eighth pending-final field to CLEARED_PENDING_FINAL_DELIVERY_FIELDS so
the heartbeat send-success and duplicate-skip paths match the canonical
clearPendingFinalDeliveryAfterSuccess cleanup; a delivered heartbeat no longer
leaves stale intent metadata behind. Seed and assert the field in both
regression cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkPieH67337ieQPWVXQgMD

* fix(heartbeat): only clear pendingFinalDelivery this run owns

The send-success and duplicate-skip clears retired any pendingFinalDelivery
unconditionally, so a heartbeat could erase an older, unsatisfied user-facing
final it never produced (e.g. a message_tool_only run that does not refresh
pending). Gate both clears on ownership via a shared helper: clear only when
pendingFinalDeliveryCreatedAt is at/after the run start. Add regression tests
covering the older-pending preserve case on both clear paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SkPieH67337ieQPWVXQgMD

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 16:54:45 -07:00
..
2026-06-04 03:17:57 -04:00
2026-06-05 01:51:27 +01:00
2026-06-04 02:55:39 -04:00
2026-06-04 03:24:36 -04:00
2026-06-04 03:42:18 -04:00
2026-06-04 03:22:42 -04:00
2026-06-04 03:42:18 -04:00
2026-06-15 19:34:16 +01:00
2026-06-04 03:11:12 -04:00
2026-06-04 03:17:57 -04:00