Skip to content

fix: cron job message delivery fails with Action send requires a target#6

Open
newtontech wants to merge 173 commits intomainfrom
fix/issue-27898
Open

fix: cron job message delivery fails with Action send requires a target#6
newtontech wants to merge 173 commits intomainfrom
fix/issue-27898

Conversation

@newtontech
Copy link
Owner

Summary

Fixes an issue where cron jobs fail to deliver messages because the target parameter is not properly passed to the message send action.

Changes

  • Fixed the shouldDeliverExternally logic in sendSubagentAnnounceDirectly to only be true when there is actually a deliverable target present

Root Cause

The issue was in src/agents/subagent-announce.ts where shouldDeliverExternally was set to true even when there was no valid delivery target (directTo was empty). This caused the gateway agent to be called with deliver=true but without a proper target, leading to the "Action send requires a target" error.

The fix ensures that shouldDeliverExternally is only true when hasDeliverableDirectTarget is true, which requires both a valid channel and a valid target to be present.

Testing

  • Verified the fix resolves the reported issue
  • No test infrastructure changes needed

This PR is intended to be merged into openclaw/openclaw:main

Fixes openclaw#27898

Sid-Qin and others added 30 commits February 26, 2026 13:40
Add a grace timer after markRunComplete so the typing controller
cleans up even when markDispatchIdle is never called, preventing
indefinite typing keepalive loops in cron and announce flows.

Made-with: Cursor
(cherry picked from commit 684eaf2)
When Telegram rejects native command registration for excessive commands, progressively retry with fewer commands instead of hard-failing startup.

Made-with: Cursor
(cherry picked from commit a02c404)
Prevent gateway startup failures when plugins.entries contains stale or removed plugin ids by downgrading unknown entry keys from validation errors to warnings.

Made-with: Cursor
(cherry picked from commit 34ef28c)
Introduce a sessions cleanup flag to prune entries whose transcript files are missing and surface the exact remediation command from doctor to resolve missing-transcript deadlocks.

Made-with: Cursor
(cherry picked from commit 690d3d5)
Azure OpenAI endpoints were not recognized by shouldForceResponsesStore(),
causing store=false to be sent with all Azure Responses API requests.
This broke multi-turn conversations because previous_response_id referenced
responses that Azure never stored.

Add "azure-openai-responses" to the provider whitelist and
*.openai.azure.com to the URL check in isDirectOpenAIBaseUrl().

Fixes openclaw#27497

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 185f381)
When connecting via shared gateway token (no device identity),
the operator scopes were being cleared, causing API operations
to fail with 'missing scope' errors.

This fix preserves scopes when sharedAuthOk is true, allowing
headless/API operator clients to retain their requested scopes.

Fixes openclaw#27494

(cherry picked from commit c71c894)
Guard sendMessageSlack against NO_REPLY tokens reaching the Slack API,
which caused truncated push notifications before the reply filter could
intercept them.

Made-with: Cursor
(cherry picked from commit fab9b52)
Landed follow-up for openclaw#27535 and aligned shared-auth gateway expectations after openclaw#27498.

Co-authored-by: kevinWangSheng <118158941+kevinWangSheng@users.noreply.github.com>
Reworks browser relay CORS handling for extension-origin preflight and JSON responses, adds regression tests, and updates changelog.
Landed from contributor @miloudbelarebia (PR openclaw#23962).

Co-authored-by: Miloud Belarebia <miloudbelarebia@users.noreply.github.com>
…aw#27286)

* fix(gateway): allow cron commands to use gateway.remote.token

* fix(gateway): make local remote-token fallback effective

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
… routes

Align relay HTTP /json auth with websocket auth by accepting query-param tokens, add regression coverage, and update changelog.
Landed from contributor @Sid-Qin (PR openclaw#26015).

Co-authored-by: SidQin-cyber <sidqin0410@gmail.com>
Flush pending extension request timers/rejections during relay shutdown and document in changelog.
Landed from contributor @kevinWangSheng (PR openclaw#24142).

Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
…ndling

Bind relay WS message handling before onopen and add non-blocking connect.challenge response support without forcing handshake waits on current relay protocol.
Landed from contributor @pandego (PR openclaw#22571).

Co-authored-by: pandego <7780875+pandego@users.noreply.github.com>
Add shared per-port relay initialization dedupe so concurrent callers await a single startup lifecycle, with regression coverage and changelog entry.
Landed from contributor @HOYALIM (PR openclaw#21277).

Co-authored-by: Ho Lim <subhoya@gmail.com>
Guard malformed percent-encoding in relay target routes and browser dispatcher params, add regression tests, and update changelog.
Landed from contributor @Yida-Dev (PR openclaw#11880).

Co-authored-by: Yida-Dev <reyifeijun@gmail.com>
* Changelog: credit session path fixes

* test(gemini-oauth): cover npm global shim credential discovery

* fix(gemini-oauth): resolve npm global shim install roots
shakkernerd and others added 30 commits February 26, 2026 17:10
- Use wss:// scheme when TLS is enabled (specifically for bind=lan)
- Load TLS runtime to get certificate fingerprint
- Pass fingerprint to probeGatewayStatus for self-signed cert trust
Added Jonathan Taylor's contributions and contact links.
The config schema validates provider api fields against ModelApiSchema,
but openai-codex-responses was missing from the allowed values. This
forces users to set api: "openai-responses" for the openai-codex
provider, which routes requests to api.openai.com/v1/responses instead
of chatgpt.com/backend-api/codex/responses, causing HTTP 401 errors
because Codex OAuth tokens lack api.responses.write scope for the
standard OpenAI Responses endpoint.

The runtime already supports openai-codex-responses throughout: model
registry, stream dispatch (streamOpenAICodexResponses), and provider
detection (OPENAI_MODEL_APIS set). Only the config schema was missing
the literal.
Fixes openclaw#27674

The TUI was erasing already-streamed assistant text when tool calls
were triggered. This happened because the finalize() method in
TuiStreamAssembler was not using the protectBoundaryDrops option
when updating run state.

Now finalize() applies the same boundary drop protection as
ingestDelta(), ensuring that streamed text before tool calls is
preserved when the final payload drops earlier content blocks.
… dispatch

Several call sites of deliverOutboundPayloads() were not passing the
sessionKey parameter, causing the internal message:sent hook to never
fire (the guard `if (!sessionKeyForInternalHooks) return` in deliver.ts
silently skipped the triggerInternalHook call).

Fixed call sites:
- commands/agent/delivery.ts (agent loop replies — main fix)
- infra/heartbeat-runner.ts (heartbeat OK + alert delivery)
- infra/outbound/message.ts (message tool sends)
- cron/isolated-agent/delivery-dispatch.ts (cron job delivery)
- gateway/server-node-events.ts (node event forwarding)

The sessionKey parameter already existed in DeliverOutboundPayloadsCoreParams
and was used by deliver.ts to emit the message:sent internal hook event,
but was simply not being passed from most callers.
…very

Fixes openclaw#27898

The issue was in sendSubagentAnnounceDirectly where shouldDeliverExternally
was set to true even when there was no valid delivery target (directTo was
empty). This caused the gateway agent to be called with deliver=true but
without a proper target, leading to the 'Action send requires a target' error.

The fix ensures that shouldDeliverExternally is only true when
hasDeliverableDirectTarget is true, which requires both a valid channel
and a valid target to be present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron jobs: Message delivery fails with 'Action send requires a target'