feat(discord): allow opt-in auto-threading for free-response channels - #27969
Closed
0xjackyang wants to merge 1 commit into
Closed
0xjackyang wants to merge 1 commit into
0xjackyang wants to merge 1 commit into
Conversation
Adds opt-in DISCORD_AUTO_THREAD_FREE_RESPONSE_CHANNELS / discord.auto_thread_free_response_channels. Default empty → existing free-response=inline behavior preserved. Refactors channel-id parsing into a single helper that handles str/list/scalar including YAML bare numerics (subsumes the recent bare-numeric coercion fix).
Contributor
|
Competes with existing cluster: #17564 (feat: threaded free-response channels), #19131 (same feature, closed), #26074 (decouple auto_thread from free_response), #27651 (same override, marked dupe of #13958). Consider consolidating — #26074 is the most recent active contender with a different approach (skip-thread env var vs. new channel list). |
Contributor
Author
|
Thanks for the cluster pointer @alt-glitch. Closing in favor of #17564 — same approach (preserve current inline default, add explicit per-channel opt-in for auto-thread on free-response channels). No need to maintain two duplicate PRs for the same direction. Will add support on #17564. |
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.
Problem
discord.free_response_channelslets operators turn off the mentionrequirement for designated channels so the bot responds inline. Today
free-response → inline-only is treated as doctrine
(#12728,
fix(discord): keep free-response channels inline,fix(discord): free-response channels skip auto-threading).For some real deployments that's the wrong default. Consider a "lounge"
or "sandbox" channel where the bot is conversational without mention,
but each user turn benefits from being isolated in its own thread —
concurrent users don't talk over each other's tool calls, and per-thread
context stays clean. The current path to get that requires reverting to
require_mention=true, which defeats the point of free-response.Fix
Add an opt-in YAML key
discord.auto_thread_free_response_channels(+ matching
DISCORD_AUTO_THREAD_FREE_RESPONSE_CHANNELSenv var).Defaults to empty / off → existing "free-response = inline" behavior is
preserved for every existing operator. When a parent channel is listed,
that channel still auto-threads on each user-initiated turn while
remaining free-response (no mention required).
Supports
*wildcard, same convention asallowed_channels.Refactor (small, isolated)
Extracts Discord channel-id parsing into
_parse_discord_channel_setwhich accepts str / list / tuple / set / frozenset / scalar (including
YAML bare numerics like
1491973769726791812). This is a strictsuperset of the existing
_discord_free_response_channelsparser andincidentally subsumes the recent bare-numeric coercion fix.
_discord_channel_set_from_env_or_config(env_var, config_key)consolidates the env-takes-precedence-over-config pattern used by every
channel-id config.
Test
test_free_response_channel_can_auto_thread_when_configuredcovers thenew behavior: with
DISCORD_FREE_RESPONSE_CHANNELS=789andDISCORD_AUTO_THREAD_FREE_RESPONSE_CHANNELS=789, a message arriving inchannel 789 auto-creates a thread before being handled.
Scope
3 files. Default behavior unchanged for every existing operator. No
config schema change beyond one new opt-in key.