Skip to content

fix(cron): enable completion direct send for text-only announce delivery#29151

Merged
Takhoffman merged 1 commit intoopenclaw:mainfrom
DennisGoldfinger:fix/cron-announce-delivery
Feb 28, 2026
Merged

fix(cron): enable completion direct send for text-only announce delivery#29151
Takhoffman merged 1 commit intoopenclaw:mainfrom
DennisGoldfinger:fix/cron-announce-delivery

Conversation

@DennisGoldfinger
Copy link
Contributor

Summary

Fix text-only cron announce delivery silently dropping messages.

When a cron job fires and the agent responds with plain text, the output is routed through the announce flow but never reaches the user. The root cause: cron's call to runSubagentAnnounceFlow doesn't set expectsCompletionMessage, so it defaults to false. This gates out the completion direct send path in sendSubagentAnnounceDirectly, causing the flow to fall through to the trigger/agent injection path — which injects an internal system message into an idle main agent session where it's silently consumed.

The fix is to set expectsCompletionMessage: true on the cron announce call, matching what spawned subagents already do (via subagent-spawn.ts line 192). This enables:

  • Direct-first dispatch strategy (instead of queue-first, which fails when the main agent is idle)
  • The completion direct send path, which delivers the user-facing message via callGateway({ method: "send" }) to the target channel

Also strips the "✅ Subagent main finished" status header from cron completion messages — cron output is a standalone message, not a subagent result report.

Changes

  • src/cron/isolated-agent/delivery-dispatch.ts: set expectsCompletionMessage: true on the runSubagentAnnounceFlow call
  • src/agents/subagent-announce.ts: skip subagent status header in buildCompletionDeliveryMessage when announceType === "cron job"
  • Two test files: assert expectsCompletionMessage is true in announce call args

Test plan

  • pnpm test src/agents/subagent-announce — 66 tests pass
  • pnpm test src/cron/isolated-agent — 79 tests pass
  • Live-tested: cron job with text-only announce delivery to Slack channel — message arrives clean, no subagent header

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Feb 27, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Fixed text-only cron announce delivery silently dropping messages by enabling direct-first dispatch strategy.

The root cause was that cron's call to runSubagentAnnounceFlow didn't set expectsCompletionMessage, defaulting to false. This caused the dispatch logic to use queue-first strategy (injecting a system message into the idle main agent session where it was silently consumed) instead of direct-first strategy (sending via callGateway({ method: "send" })).

Changes:

  • Set expectsCompletionMessage: true in src/cron/isolated-agent/delivery-dispatch.ts:315 to match spawned subagent behavior
  • Skip "✅ Subagent main finished" status header for cron completions in src/agents/subagent-announce.ts:80-83 since cron output is a standalone message, not a subagent result report
  • Updated tests to assert expectsCompletionMessage: true

The fix aligns cron behavior with regular spawned subagents (which set expectsCompletionMessage: true by default in src/agents/subagent-spawn.ts:192) and ensures completion messages reach users directly.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses the root cause of silently dropped cron messages by enabling the direct-first dispatch strategy. The implementation is consistent with existing patterns for spawned subagents, includes appropriate test coverage (66 + 79 tests passing), and was live-tested successfully. The early return in buildCompletionDeliveryMessage for cron jobs is correct since the outcome is always "ok" at announce time. No breaking changes or edge cases identified.
  • No files require special attention

Last reviewed commit: 48485f4

@Takhoffman Takhoffman merged commit 3096837 into openclaw:main Feb 28, 2026
29 checks passed
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Feb 28, 2026
* main: (31 commits)
  fix(browser): resolve correct targetId in navigate response after renderer swap (openclaw#25326)
  fix: sed escaping and UID mismatch in Podman Quadlet setup (openclaw#26414)
  fix(cron): pass heartbeat target=last for main-session cron jobs (openclaw#28508) (openclaw#28583)
  fix(cron): disable messaging tool when delivery.mode is none (openclaw#21808) (openclaw#21896)
  fix: clear delivery routing state when creating isolated cron sessions (openclaw#27778)
  fix(cron): avoid marking queued announce paths as delivered (openclaw#29716)
  fix(cron): enable completion direct send for text-only announce delivery (openclaw#29151)
  fix(cron): force main-target system events onto main session (openclaw#28898)
  fix(cron): condition requireExplicitMessageTarget on resolved delivery (openclaw#28017)
  feat(cron): add --account flag for multi-account delivery routing (openclaw#26284)
  fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs (openclaw#19541)
  fix: sandbox browser docker no-sandbox rollout (openclaw#29879) (thanks @Lukavyi)
  GitHub: add regression bug issue template and routing (openclaw#29864) thanks @Takhoffman
  feat(feishu): add chat info/member tool (openclaw#14674)
  feat(feishu): add markdown tables, positional insert, color_text, and table ops (openclaw#29411)
  feat(feishu): add parent/root inbound context for quote support (openclaw#18529)
  fix: land android onboarding and voice reliability updates (openclaw#29796)
  fix(android-voice): rotate playback token per assistant reply
  fix(android-voice): retry talk config after transient failures
  fix(android-voice): cancel in-flight speech when speaker muted
  ...
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
nsd97 pushed a commit to nsd97/openclaw that referenced this pull request Feb 28, 2026
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
…ery (openclaw#29151)

Cherry-pick from upstream openclaw/openclaw 3096837.
Passes expectsCompletionMessage and announceType to the subagent
announce flow so cron output is sent directly via completion path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…ery (openclaw#29151)

Cherry-pick from upstream openclaw/openclaw 3096837.
Passes expectsCompletionMessage and announceType to the subagent
announce flow so cron output is sent directly via completion path.
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants