← Back to PRs

#13643: feat(slack): add agent-specific persona support for messages

by cathrynlavery open 2026-02-10 20:00 View on GitHub →
channel: slack commands
## Summary Enables agents to have custom display identities (name, emoji, avatar) when sending Slack messages via `chat:write.customize`. This allows multi-agent systems to visually differentiate between agents in Slack channels. ## Changes - Add `persona.ts` module to resolve agent identity into Slack-compatible persona fields - Thread `agentId` through the full delivery pipeline — heartbeat, cron, CLI agent, gateway, and route-reply paths - Support `username`, `icon_emoji`, and `icon_url` customization per agent - **Graceful scope fallback**: if `chat:write.customize` scope is missing, catches the error, logs a warning, and retries without persona fields — no hard failure ## How It Works 1. `resolveSlackPersona(cfg, agentId)` looks up agent identity from config 2. Normalizes emoji formats (shortcodes → `:name:`, unicode passthrough) 3. Prioritizes avatar URLs over emoji for higher fidelity icons 4. Only attaches persona when at least one field is configured 5. If Slack rejects persona fields due to missing scope, falls back to default bot identity for the rest of the message ## Requirements - Requires `chat:write.customize` scope in Slack workspace for custom identity - Works without the scope — gracefully degrades to default bot appearance ## Known Limitations (follow-up) - Media captions via `files.uploadV2` don't support persona fields (only subsequent `chat.postMessage` chunks get custom identity) - No validation on username length or persona field content - Unicode emoji in `icon_emoji` is passed through as-is (Slack behavior may vary) ## Test Plan - [ ] Verify agents with configured identity use custom username in Slack - [ ] Test emoji icon formats (shortcode, unicode, colonized) - [ ] Confirm avatar URLs override emoji when both are present - [ ] Ensure messages without agent identity use default bot appearance - [ ] Validate thread replies maintain persona consistency - [ ] Test graceful degradation when chat:write.customize scope is missing - [ ] Verify heartbeat, cron, and CLI delivery paths all activate persona

Most Similar PRs