fix(heartbeat): detect local exec completed/failed events in heartbeat prompt#26213
Closed
Sid-Qin wants to merge 1 commit into
Closed
fix(heartbeat): detect local exec completed/failed events in heartbeat prompt#26213Sid-Qin wants to merge 1 commit into
Sid-Qin wants to merge 1 commit into
Conversation
…t prompt isExecCompletionEvent only matched "exec finished" (node exec events) but missed "exec completed" and "exec failed" (local exec events from bash-tools.exec-runtime). This caused exec completion heartbeats to use the generic heartbeat prompt instead of the exec-specific one, leading the agent to misinterpret echoed command output as a new user message and generate duplicate replies. Closes openclaw#25959 Co-authored-by: Cursor <cursoragent@cursor.com>
|
This pull request has been automatically marked as stale due to inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isExecCompletionEventnow matches "exec completed" and "exec failed" (local exec events frombash-tools.exec-runtime) in addition to "exec finished" (node exec events)Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
When a background exec process completes, the agent now correctly uses the exec-specific prompt ("relay the command output to the user") instead of the generic heartbeat prompt. This prevents the agent from misinterpreting echoed command output as a new user request.
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
Actual (before fix)
Evidence
isExecCompletionEventdetects "Exec completed", "Exec failed", and "Exec finished"isCronSystemEventcorrectly rejects all three exec event formatsHuman Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
190455csrc/infra/heartbeat-events-filter.tsRisks and Mitigations
maybeNotifyOnExit—Exec completed/failed (id, exitLabel)— which is unlikely to appear in regular cron or user contentGreptile Summary
This PR fixes a bug where local exec completion events ("Exec completed" and "Exec failed") were misclassified as cron events, causing duplicate agent replies.
The fix updates
isExecCompletionEventinsrc/infra/heartbeat-events-filter.ts:86-93to detect all three exec event formats:Exec finished(node exec events fromserver-node-events.ts)Exec completed(local exec success frombash-tools.exec-runtime.ts:238)Exec failed(local exec failure frombash-tools.exec-runtime.ts:238)Key changes:
isExecCompletionEventto use case-insensitive matching for all three patternsisCronSystemEventtests to verify exec events are properly excludedImpact:
When a background exec completes, the heartbeat system (via
heartbeat-runner.ts:579-582) now correctly applies the exec-specific prompt instead of the generic cron prompt, preventing the agent from misinterpreting command output as new user requests.Confidence Score: 5/5
Last reviewed commit: 190455c