← Back to PRs

#11074: feat: route group error messages to owner DM

by tata-meow open 2026-02-07 10:56 View on GitHub →
stale
## 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