fix: drop heartbeat runs that arrive while another run is active#12786
fix: drop heartbeat runs that arrive while another run is active#12786mcaxtr wants to merge 3 commits intoopenclaw:mainfrom
Conversation
|
@greptile review |
|
@greptile review |
Additional Comments (1)
In This can be fixed by ensuring the steered early-return triggers the same completion signal as other exits (e.g. call Prompt To Fix With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/agent-runner.ts
Line: 162:179
Comment:
**Inconsistent run completion**
In `steered && !shouldFollowup` early-return you call `typing.cleanup()` and return, but never call `typing.markRunComplete()`. The new heartbeat drop path explicitly calls `markRunComplete()` before cleanup, and the function’s normal exits rely on the `finally` to do this. If `markRunComplete()` is required to release typing/run bookkeeping, this branch can leave the controller in an inconsistent state.
This can be fixed by ensuring the steered early-return triggers the same completion signal as other exits (e.g. call `typing.markRunComplete()` before `cleanup()`, or structure it so it flows through the `finally`).
How can I resolve this? If you propose a fix, please make it concise. |
|
@greptile review |
0a44471 to
f907bd6
Compare
f907bd6 to
4c0e258
Compare
4c0e258 to
2fe4c3c
Compare
9b29efd to
31d9a86
Compare
bfc1ccb to
f92900f
Compare
9336c84 to
6d89a29
Compare
6d89a29 to
c054172
Compare
|
Closing as AI-assisted stale-fix triage. Linked issue #8063 ("[Bug]: Heartbeat sends multiple response branches due to followup-runner and delivery-mirror") is currently CLOSED and was closed on 2026-02-24T04:26:28Z with state reason NOT_PLANNED. If the underlying bug is still reproducible on current main, please reopen this PR (or open a new focused fix PR) and reference both #8063 and #12786 for fast re-triage. |
|
Closed after AI-assisted stale-fix triage (closed issue duplicate/stale fix). |
Summary
Fixes #8063
When a heartbeat run arrives while another agent run is already active for the same session, it was being enqueued as a followup. When the followup queue later drained, the stale heartbeat produced a duplicate agent run — sending extra response branches to the user.
This change adds an early-return guard in
runReplyAgentthat silently drops heartbeat runs whenisActiveis true, before they reach the enqueue path. The next heartbeat interval will independently re-check the session.Test plan
undefined, no enqueue) whenisActive: trueisActive: trueisActive: falsepnpm build && pnpm checkpassGreptile Overview
Greptile Summary
This change adds a guard in
src/auto-reply/reply/agent-runner.tsto silently drop heartbeat-triggered runs when another run is already active for the same session, preventing stale heartbeat followups from being enqueued and later producing duplicate agent runs/extra response branches (fix for #8063). It also adds a focused vitest suite that asserts: (1) heartbeat+active returnsundefinedand does not enqueue, (2) non-heartbeat+active still enqueues, and (3) heartbeat+inactive proceeds to execute normally.Confidence Score: 5/5
typing.markRunComplete()calls.