fix(hooks): skip duplicate delivery when hook agent turn uses announce flow#20199
Closed
zerone0x wants to merge 1 commit into
Closed
fix(hooks): skip duplicate delivery when hook agent turn uses announce flow#20199zerone0x wants to merge 1 commit into
zerone0x wants to merge 1 commit into
Conversation
19 tasks
This was referenced Feb 19, 2026
Mellowambience
added a commit
to Mellowambience/openclaw
that referenced
this pull request
Feb 20, 2026
…p NO_REPLY hook context pollution Fixes openclaw#21343 Related: openclaw#20242, openclaw#20199, openclaw#20678
…e flow When a hook agent turn delivers via the announce flow, skip enqueuing a system event to the main session and waking the heartbeat. This prevents duplicate messages being delivered to the target channel. This is the same pattern applied to the cron service in ea95e88 (#15692). Fixes #20196 Co-Authored-By: Claude <[email protected]>
zerone0x
force-pushed
the
fix/hooks-duplicate-delivery-20196
branch
from
February 20, 2026 11:02
a51eaaa to
a1025ca
Compare
6 tasks
3 tasks
Member
|
Thanks for pushing this forward. I’m closing this as a duplicate of #20678. The same hook-delivery root cause is covered there as part of the combined, merge-ready path. Your earlier contribution is still part of the attribution trail. If this boundary looks wrong in your repro, tell me and I can reopen review quickly. |
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
Fixes #20196
When a hook is triggered via
/hooks/agentwithdeliver: true, the response was being delivered twice — once through the announce flow and once through the main agent heartbeat.Changes
result.deliveredbefore callingenqueueSystemEvent()andrequestHeartbeatNow()This is the same pattern applied to the cron service in ea95e88 (#15692). The
RunCronAgentTurnResult.deliveredflag already documents this contract:The hooks handler simply needs to honor this flag.
🤖 Generated with Claude Code
Greptile Summary
Guards the hooks agent handler against duplicate message delivery by checking
result.deliveredbefore enqueuing a system event and triggering a heartbeat wake. This mirrors the existing pattern in the cron service timer (src/cron/service/timer.ts:541), whereres.deliveredis checked to avoid posting a summary to the main session when the isolated run already delivered output via the announce flow.enqueueSystemEvent()andrequestHeartbeatNow()inif (!result.delivered)to skip them when delivery already occurredcatchblock) is unchanged and continues to always surface failures — correct behaviordelivered: truepath was added; the existing e2e tests mock the isolated run result without adeliveredfield, so they continue to exercise the non-delivered pathConfidence Score: 4/5
deliveredflag returned byrunCronIsolatedAgentTurn. The only gap is the absence of a dedicated test for thedelivered: truepath in the hooks e2e tests, but the pattern is already tested in the cron service tests.Last reviewed commit: a51eaaa
Context used:
dashboard- CLAUDE.md (source)