fix(cron): prevent duplicate delivery for isolated jobs with announce mode#15739
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 13, 2026
Merged
Conversation
… mode When an isolated cron job delivers its output via deliverOutboundPayloads or the subagent announce flow, the finish handler in executeJobCore unconditionally posts a summary to the main agent session and wakes it via requestHeartbeatNow. The main agent then generates a second response that is also delivered to the target channel, resulting in duplicate messages with different content. Add a `delivered` flag to RunCronAgentTurnResult that is set to true when the isolated run successfully delivers its output. In executeJobCore, skip the enqueueSystemEvent + requestHeartbeatNow call when the flag is set, preventing the main agent from waking up and double-posting. Fixes openclaw#15692
a355115 to
38e2e2f
Compare
Contributor
|
Landed via temp rebase onto main. Thanks @widingmarcus-cyber! |
steipete
added a commit
to azade-c/openclaw
that referenced
this pull request
Feb 14, 2026
GwonHyeok
pushed a commit
to learners-superpumped/openclaw
that referenced
this pull request
Feb 15, 2026
cloud-neutral
pushed a commit
to cloud-neutral-toolkit/openclawbot.svc.plus
that referenced
this pull request
Feb 15, 2026
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.
fix(cron): prevent duplicate delivery for isolated jobs with announce mode
Fixes #15692
Problem
When an isolated cron job runs with
delivery.mode=announce, the output is delivered twice to the target channel with different content:deliverOutboundPayloads(structured content) orrunSubagentAnnounceFlow(text-based announce) → Message fix: add @lid format support and allowFrom wildcard handling #1executeJobCoreintimer.tsunconditionally callsenqueueSystemEvent+requestHeartbeatNow, which wakes the main agent. The main agent processes the system event, generates its own response, and delivers it → Message Login fails with 'WebSocket Error (socket hang up)' ECONNRESET #2Result: two messages with different content for a single cron run.
Root Cause
In
src/cron/service/timer.ts,executeJobCore()posts a summary to the main agent session after every isolated job, regardless of whether the isolated run already delivered its output:Fix
Add a
deliveredflag toRunCronAgentTurnResultthat tracks whether the isolated run already delivered its output. SkipenqueueSystemEvent+requestHeartbeatNowwhendelivered === true.Changed files:
src/cron/isolated-agent/run.ts,src/cron/service/state.ts,src/cron/service/timer.tsTesting
Greptile Overview
Greptile Summary
This PR adds a
deliveredflag to the isolated cron job execution result so the cron timer can avoid enqueueing a summary system event (and waking the main agent) when the isolated run has already delivered output to the target channel (via outbound payload delivery or the announce flow).Concretely:
src/cron/isolated-agent/run.tsnow tracks whether delivery happened and returns it.src/cron/service/state.tsextends therunIsolatedAgentJobdep return type to includedelivered.src/cron/service/timer.tsgatesenqueueSystemEvent+requestHeartbeatNowbehind!res.deliveredto prevent duplicate channel messages fordelivery.mode=announceisolated runs.Overall, the change is narrowly scoped to the cron isolated-run → main-session handoff logic and matches the stated root cause in #15692.
Confidence Score: 5/5
deliveredis only used to suppress a main-session wakeup when isolated delivery already occurred. The new flag is set only on successful delivery paths (outbound payload delivery or announce success) and is otherwise false/undefined, preserving prior behavior. No other call sites are affected beyond the cron service dependency return type and the single gating condition in the timer.Last reviewed commit: a355115
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)