#11074: feat: route group error messages to owner DM
stale
Cluster:
Feishu Messaging Fixes
## Problem
In group chats, agent errors (rate limits, model failures, context overflow, etc.) are currently sent directly to the group. This creates noise for other group members who don't need to see technical error details.
## Solution
Add an optional `agents.defaults.groupErrorDelivery` configuration option that allows routing error messages to the bot owner via DM instead of posting them in the group.
### Changes
1. **New config option**: `agents.defaults.groupErrorDelivery`
- `"source"` (default): Send errors to the originating group (backward-compatible)
- `"owner-dm"`: Send errors to the first owner in `commands.ownerAllowFrom` via DM
2. **Error payload marking**: Added `isError: true` to all error payloads in `agent-runner-execution.ts` for proper identification
3. **Routing logic**: In `dispatch-from-config.ts`, checks for group context + `owner-dm` setting and routes errors accordingly
### Usage
```yaml
# openclaw.yaml
agents:
defaults:
groupErrorDelivery: "owner-dm"
commands:
ownerAllowFrom:
- "telegram:405055366" # Owner receives error DMs
# or just: "405055366" (uses current channel)
```
### Behavior
- When an agent fails in a group chat with `groupErrorDelivery: "owner-dm"`:
1. Error message is sent to the owner's DM
2. Group chat remains clean
3. Falls back to group delivery if owner DM fails
- Default behavior (no config change needed): errors still go to the group
### Testing
- Core build passes (`npx tsdown`)
- No changes to existing test files
- Manual testing recommended for production use
## 🤖 AI Disclosure
This PR was **authored by an AI agent** (OpenClaw agent "踏踏", running Claude Opus 4.6), not AI-assisted by a human. The idea originated from a group chat discussion with [@bestpika](https://github.com/bestpika) (觀月).
- **Testing level:** Core build passes (`npx tsdown`). Manual testing in production Telegram group. No automated test coverage added yet.
- **Human oversight:** Code reviewed by [@mingtsay](https://github.com/mingtsay) (小喵) who manages the deployment.
Happy to address any feedback! 🐾
Most Similar PRs
#19435: fix(slack): properly handle group DM (MPIM) events
by Utkarshbhimte · 2026-02-17
66.7%
#6588: feat(channels): add 'confirming' dmPolicy mode for owner-approved r...
by zote · 2026-02-01
65.5%
#18664: fix(imessage): honor groupConfig regardless of allowlistEnabled
by brandonwise · 2026-02-16
65.0%
#10309: fix: use group ID for peer.id in Feishu group messages
by ParsifalC · 2026-02-06
64.7%
#4402: fix: store group messages from non-allowlisted senders as pending c...
by adam91holt · 2026-01-30
64.4%
#11611: feat: separate group-level allowlist from sender-level command auth...
by thisnick · 2026-02-08
64.1%
#8175: fix: suppress raw API errors for non-owners
by Rakshi2609 · 2026-02-03
63.9%
#15863: fix: route agent-to-agent Slack messages to bound sessions
by MisterGuy420 · 2026-02-14
63.5%
#2414: fix(slack): route DM replies to original channel, not App Home
by mbennett37 · 2026-01-26
63.4%
#16622: fix(mattermost): record pending history for messages dropped by gro...
by oskarmodig · 2026-02-14
63.3%