Skip to content

fix(cron): pass agent identity through delivery path (#16218)#16242

Merged
steipete merged 2 commits intoopenclaw:mainfrom
robbyczgw-cla:fix/16218-cron-delivery-identity
Feb 14, 2026
Merged

fix(cron): pass agent identity through delivery path (#16218)#16242
steipete merged 2 commits intoopenclaw:mainfrom
robbyczgw-cla:fix/16218-cron-delivery-identity

Conversation

@robbyczgw-cla
Copy link
Contributor

@robbyczgw-cla robbyczgw-cla commented Feb 14, 2026

Summary

This PR fixes cron outbound delivery so agent identity is preserved end-to-end when sending through deliverOutboundPayloads. Cron-generated messages were being delivered without the configured agent persona (name/avatar/emoji), which caused anonymous/default bot presentation in Slack.

Problem

Cron delivery for isolated agent runs was successfully producing outbound payloads, but those messages appeared as the default app/bot identity instead of the configured agent identity. In practice, this made scheduled agent reports look like generic system posts rather than messages from the intended agent persona.

Root cause

Identity fields were not threaded through the outbound delivery plumbing:

  • deliverOutboundPayloads did not accept/pass username, icon_url, icon_emoji
  • createChannelHandler / createPluginHandler did not forward identity values into channel adapters
  • Cron runner (src/cron/isolated-agent/run.ts) did not resolve and attach identity for outbound structured delivery

Solution

I implemented minimal, targeted plumbing across the delivery path:

// src/infra/outbound/deliver.ts
export async function deliverOutboundPayloads(params: {
  ...
  username?: string;
  icon_url?: string;
  icon_emoji?: string;
})

These fields are now forwarded into:

  • createChannelHandler(...)
  • createPluginHandler(...)
  • sendPayload, sendText, and sendMedia adapter calls

Cron path now resolves and supplies identity:

const agentIdentity = resolveAgentIdentity(cfgWithAgentDefaults, agentId);
const identityAvatar = agentIdentity?.avatar?.trim();

await deliverOutboundPayloads({
  ...,
  username: agentIdentity?.name?.trim() || undefined,
  icon_url: identityAvatar?.startsWith("http") ? identityAvatar : undefined,
  icon_emoji: !identityAvatar?.startsWith("http")
    ? agentIdentity?.emoji?.trim() || undefined
    : undefined,
});

Slack outbound/send was also updated to accept and pass customize fields to chat.postMessage when present.

Before / After

  • Before: cron outbound messages often appeared as default bot identity (anonymous/generic)
  • After: cron outbound messages carry configured agent identity (name + avatar/emoji) when available

Edge cases considered

  • Identity fields are optional and only applied when present
  • icon_emoji is only sent when icon_url is absent
  • Non-HTTP avatar values do not incorrectly populate icon_url
  • Non-Slack channels remain unaffected unless they choose to consume the new optional context fields

Testing

  • npm run lint passes cleanly
  • Scope intentionally minimal (5 files)
  • Existing delivery behavior remains unchanged except identity threading

AI Disclosure

This PR was prepared with AI assistance. I reviewed the code path, implemented the changes, and validated lint locally before opening the PR.

Greptile Overview

Greptile Summary

This PR adds agent identity threading (name, avatar, emoji) through the outbound delivery pipeline to fix cron-generated messages appearing as the default bot identity instead of the configured agent persona in Slack.

Key changes:

  • Added optional username, icon_url, and icon_emoji parameters to ChannelOutboundContext type
  • Threaded these parameters through deliverOutboundPayloads, createChannelHandler, and createPluginHandler in deliver.ts
  • Updated Slack outbound adapter (sendText and sendMedia) to accept and forward identity fields to sendMessageSlack
  • Modified sendMessageSlack to conditionally include identity fields in chat.postMessage calls
  • Cron isolated agent runner now resolves agent identity and supplies it during outbound delivery

Implementation quality:
The implementation correctly ensures mutual exclusivity between icon_url and icon_emoji (Slack only accepts one). The avatar URL validation using startsWith("http") is simple but effective. All parameters are optional and only applied when present, maintaining backward compatibility. The changes are minimal and focused, affecting only 5 files.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are minimal, well-scoped, and follow a clear pattern. The identity fields are optional and properly threaded through the delivery pipeline without affecting existing behavior. The mutual exclusivity logic for icon_url and icon_emoji is correct according to Slack's API requirements. Other channels properly ignore these optional fields. No breaking changes or risky refactoring.
  • No files require special attention

Last reviewed commit: 0bc773b

@openclaw-barnacle openclaw-barnacle bot added channel: slack Channel integration: slack size: S experienced-contributor Contributor with 10+ merged PRs labels Feb 14, 2026
@robbyczgw-cla robbyczgw-cla force-pushed the fix/16218-cron-delivery-identity branch from 0bc773b to 49e6379 Compare February 14, 2026 14:29
@steipete steipete self-assigned this Feb 14, 2026
@robbyczgw-cla robbyczgw-cla force-pushed the fix/16218-cron-delivery-identity branch from 49e6379 to 4bc5949 Compare February 14, 2026 14:40
robbyczgw-cla and others added 2 commits February 14, 2026 15:55
Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218
@steipete steipete force-pushed the fix/16218-cron-delivery-identity branch from 4bc5949 to dfc3553 Compare February 14, 2026 15:02
@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation size: M and removed size: S labels Feb 14, 2026
@steipete steipete merged commit 09e1cbc into openclaw:main Feb 14, 2026
25 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm check, pnpm check:docs, pnpm test, pnpm build
  • Land commit: dfc3553
  • Merge commit: 09e1cbc

Thanks @robbyczgw-cla!

hamidzr pushed a commit to hamidzr/openclaw that referenced this pull request Feb 14, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
openperf pushed a commit to openperf/moltbot that referenced this pull request Feb 14, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
openperf pushed a commit to openperf/moltbot that referenced this pull request Feb 14, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
mverrilli pushed a commit to mverrilli/openclaw that referenced this pull request Feb 14, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
Benkei-dev pushed a commit to Benkei-dev/openclaw that referenced this pull request Feb 15, 2026
…openclaw#16242)

* fix(cron): pass agent identity through delivery path

Cron delivery messages now include agent identity (name, avatar) in
outbound messages. Identity fields are passed best-effort for Slack
(graceful fallback if chat:write.customize scope is missing).

Fixes openclaw#16218

* fix: fix Slack cron delivery identity (openclaw#16242) (thanks @robbyczgw-cla)

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack docs Improvements or additions to documentation experienced-contributor Contributor with 10+ merged PRs size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments