feat: enhanced Discord thread management#215
Open
howie wants to merge 7 commits intoopenabdev:mainfrom
Open
Conversation
Adds `auto_archive_duration` to `DiscordConfig` with a default of 1440 (OneDay). Validates at config load time that the value is one of 60/1440/4320/10080. Passes the configured value through `Handler` to `get_or_create_thread` and converts it to the appropriate `AutoArchiveDuration` enum variant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add per-channel configuration overrides via `[discord.channels."ID"]`
TOML sections. Each channel can independently override:
- require_mention: when false, any message triggers the bot (direct mode)
- ignore_other_mentions: skip messages mentioning other users/bots
- auto_archive_duration: per-channel thread archive duration
- thread_name_mode: per-channel thread naming strategy
New global defaults on DiscordConfig: require_mention (true),
ignore_other_mentions (false), thread_name_mode ("truncate").
Channel overrides fall back to global defaults when not set.
Validation of auto_archive_duration also applies to channel overrides.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use parent_channel_id (not thread ID) for per-channel config resolution - Remove unused effective_* methods from DiscordConfig (logic is inline in Handler) - Cache channel_override lookup to avoid repeated HashMap access Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When thread_name_mode is set to "generated" (global or per-channel), sends a short naming prompt to the ACP session after thread creation and renames the thread via Discord API before the main response. Falls back to the truncated name on any failure (timeout, error). Includes config validation for thread_name_mode values at load time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Run LLM thread naming after main prompt completes in a tokio::spawn task instead of blocking before stream_prompt. This avoids: - Holding the pool write-lock during the naming request - Delaying the user's response while a name is generated - The naming prompt appearing before the user's real message in session history - Add "Do not use any tools" to naming prompt to prevent tool-use overhead - Strip quotes and markdown formatting from generated names Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… options - config.toml.example: add require_mention, ignore_other_mentions, thread_name_mode, and per-channel override examples - values.yaml: add discord.autoArchiveDuration, requireMention, ignoreOtherMentions, threadNameMode, and channels map - configmap.yaml: template per-channel config with range loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 11, 2026
Collaborator
|
This is a large feature with per-channel config, direct mode, and background thread naming. Could you please create a Discord discussion thread and add the link to this PR description? This helps with design review and community feedback for bigger features. Thanks! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Inspired by OpenClaw Discord Workflow, adds advanced thread management features to improve the Discord experience for multi-user environments.
Closes #188
New Features
auto_archive_durationto 60 (1h), 1440 (1d), 4320 (3d), or 10080 (1w). Previously hardcoded to 1 day.[discord.channels."<ID>"]sections in config.require_mention = false) — Any message in the channel triggers a thread, no @mention needed. Ideal for dedicated bot channels.ignore_other_mentions = true) — Skip messages that mention other bots/users but not this bot. Prevents false triggers in multi-bot environments.thread_name_mode = "generated") — After the main prompt completes, a background task asks the agent for a short title and renames the thread. Falls back to truncated name on failure (10s timeout).Config Example
Files Changed
src/config.rs—ChannelConfigstruct, new fields onDiscordConfig, validationsrc/discord.rs— Per-channel config resolution, direct mode, ignore logic, background thread namingsrc/main.rs— Pass new config fields to Handlerconfig.toml.example— Document all new optionscharts/openab/values.yaml— Helm values for new settingscharts/openab/templates/configmap.yaml— Template per-channel configKnown Limitations
with_connectionholds a global write lock during the naming request. Under high concurrent load withthread_name_mode = "generated", this may cause brief stalls for other threads.Test plan
auto_archive_duration = 60— verify threads archive after 1 hourrequire_mention = falseon a channel — verify any message creates a threadignore_other_mentions = true— verify messages mentioning other bots are skippedthread_name_mode = "generated"— verify thread gets renamed after first responseauto_archive_duration = 999) — verify startup fails with clear errorhelm templatewith new values — verify configmap output is correct🤖 Generated with Claude Code