Skip to content

fix(slack): extract text from bot message attachments when text is empty#1

Merged
Jimmy-xuzimo merged 7 commits intomainfrom
fix/podman-allowed-origins
Feb 26, 2026
Merged

fix(slack): extract text from bot message attachments when text is empty#1
Jimmy-xuzimo merged 7 commits intomainfrom
fix/podman-allowed-origins

Conversation

@Jimmy-xuzimo
Copy link
Owner

Summary

Problem: Bot messages in Slack with empty text property but content in attachments don't trigger agent sessions, even when allowBots: true is set in channel config.

Why it matters: Monitoring webhooks (Prometheus Alertmanager, Gatus, etc.) often send Slack messages with empty text and all content in attachments. The agent should be able to react to these alerts when allowBots: true.

What changed: Added extraction of text from bot message attachments (attachments[].text or attachments[].fallback) when the message text is empty. This is now included in the rawBody calculation for bot messages.

What did NOT change (scope boundary):

  • Non-bot messages are unaffected
  • The existing resolveSlackAttachmentContent function behavior for forwarded messages is unchanged
  • Bot messages with existing text continue to work as before

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

Before: Bot messages with text: "" and content in attachments were silently ignored. No session was created.

After: When allowBots: true, bot messages now extract text from attachments[].text or attachments[].fallback when message text is empty, allowing these messages to trigger agent sessions.

Security Impact

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)

Repro + Verification

  1. Configure Slack channel with allowBots: true
  2. Send a bot message with empty text but with attachments containing text (like Prometheus Alertmanager webhook)
  3. Verify: Agent session is created and message content is processed

Expected

  • Bot messages with empty text but attachment content trigger sessions when allowBots: true
  • Message body contains the extracted attachment text

Actual

  • All 16 existing tests in prepare.test.ts pass
  • Fix enables processing of monitoring webhook alerts via Slack bot messages

Evidence

  • Test verification
  • Code review

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)

Risks and Mitigations

  • Minimal risk: Only extracts text from attachments for bot messages that already pass the allowBots check
  • No changes to non-bot message handling

- Add 'google' to the list of reasoning tag providers in provider-utils.ts
- This fixes issue openclaw#26551 where google provider (used by gemini-api-key auth) was not being recognized for reasoning tag filtering
- Add corresponding test case for google provider
- Fix issue openclaw#26643 where cache hit rate shows >100% (e.g., 1142%)
- Use Math.min(100, ...) to cap the percentage display
- This is a display-only fix for edge cases where cacheRead exceeds tokens used
- Fix issue openclaw#27533 where xAI grok thinking output leaks to users
- Add 'xai' to the list of reasoning tag providers in provider-utils.ts
- Add test case for xai provider
- Fix issue openclaw#27530 where openclaw skills list --json outputs malformed JSON
- The emoji field contained raw ANSI terminal escape sequences
- Added regex to strip ANSI codes from emoji field when JSON output is requested
- Disabled eslint rule for the regex pattern (intentional control char match)
- Fix issue openclaw#27473 where gateway fails to start after Podman installation
- Added dangerouslyAllowHostHeaderOriginFallback to the default openclaw.json
  generated by setup-podman.sh
- This is needed because Podman/rootless containers bind to non-loopback
  addresses, triggering the origin check
Fix issue openclaw#27616: Bot messages with empty text property but content in
attachments don't trigger sessions, even when allowBots: true is set.

When monitoring webhooks (Prometheus Alertmanager, Gatus, etc.) send Slack
messages with empty text and content in attachments[].text or
attachments[].fallback, the message was being silently dropped because
rawBody was empty.

This fix adds botMessageAttachmentText extraction for bot messages with
empty text but non-empty attachments, allowing these messages to be
processed by the agent when allowBots: true.
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Jimmy-xuzimo Jimmy-xuzimo merged commit e22affd into main Feb 26, 2026
Jimmy-xuzimo pushed a commit that referenced this pull request Mar 2, 2026
… and docs (openclaw#16761)

Add inline file attachment support for sessions_spawn (subagent runtime only):

- Schema: attachments[] (name, content, encoding, mimeType) and attachAs.mountPath hint
- Materialization: files written to .openclaw/attachments/<uuid>/ with manifest.json
- Validation: strict base64 decode, filename checks, size limits, duplicate detection
- Transcript redaction: sanitizeToolCallInputs redacts attachment content from persisted transcripts
- Lifecycle cleanup: safeRemoveAttachmentsDir with symlink-safe path containment check
- Config: tools.sessions_spawn.attachments (enabled, maxFiles, maxFileBytes, maxTotalBytes, retainOnSessionKeep)
- Registry: attachmentsDir/attachmentsRootDir/retainAttachmentsOnKeep on SubagentRunRecord
- ACP rejection: attachments rejected for runtime=acp with clear error message
- Docs: updated tools/index.md, concepts/session-tool.md, configuration-reference.md
- Tests: 85 new/updated tests across 5 test files

Fixes:
- Guard fs.rm in materialization catch block with try/catch (review concern #1)
- Remove unreachable fallback in safeRemoveAttachmentsDir (review concern openclaw#7)
- Move attachment cleanup out of retry path to avoid timing issues with announce loop

Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
Co-authored-by: napetrov <napetrov@users.noreply.github.com>
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.

Slack: Bot messages with empty text property don't trigger sessions

1 participant