[AI-assisted] Discord: fix bare guild ID misrouted as channel ID#12326
Merged
thewilloftheshadow merged 2 commits intoopenclaw:mainfrom Feb 13, 2026
Merged
Conversation
4333f7b to
927d054
Compare
Contributor
Author
|
Updated regression test per Greptile review feedback; bare numeric case now returns a realistic 404 from /channels/ and asserts the resolver throws, matching the actual failure mode from production logs. |
The channel allowlist parser matches bare numeric strings as channel IDs before checking for guild IDs, causing guild snowflakes to hit Discord's /channels/ endpoint (404). Prefix guild-only entries with 'guild:' so the parser routes them to the correct guild resolution path. Fixes both the monitor provider and onboarding wizard call sites. Adds regression tests.
927d054 to
288875a
Compare
Member
skyhawk14
pushed a commit
to skyhawk14/openclaw
that referenced
this pull request
Feb 13, 2026
zhangyang-crazy-one
pushed a commit
to zhangyang-crazy-one/openclaw
that referenced
this pull request
Feb 13, 2026
steipete
pushed a commit
to azade-c/openclaw
that referenced
this pull request
Feb 14, 2026
GwonHyeok
pushed a commit
to learners-superpumped/openclaw
that referenced
this pull request
Feb 15, 2026
cloud-neutral
pushed a commit
to cloud-neutral-toolkit/openclawbot.svc.plus
that referenced
this pull request
Feb 15, 2026
jiulingyun
added a commit
to jiulingyun/openclaw-cn
that referenced
this pull request
Feb 15, 2026
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
Due to regex ordering in
parseDiscordChannelInput, bare numeric guild IDs were matched as channel IDs. This caused the resolver to call Discord's/channels/<guildId>endpoint, which 404s, and the entire channel resolution would fall back to raw config entries.Prefixing guild-only entries with
guild:ensures the parser skips the channel regex and routes them correctly.Repro Steps
channels.discord.guildswith a numeric guild ID and no specific channel keysdiscord channel resolve failed; using config entries. Discord API /channels/<guildId> failed (404): Unknown ChannelRoot Cause
In
resolve-channels.ts, two regexes both match bare numeric strings:^(?:channel:|discord:)?(\d+)$(channel — fires first)^(?:guild:|server:)?(\d+)$(guild — never reached for bare numbers)Because of the ordering of the regex parsing on the Discord config, bare guild IDs hit the channel path. Prefixing with
guild:makes it skip the channel regex (which doesn't recognizeguild:as a valid prefix) and land on the correct guild regex.Behavior Changes
guild:at both call sites (monitor provider + onboarding wizard)guild:prefix was already supportedTests
pnpm build && pnpm check && pnpm test— all greenAI-Assisted
discord channel resolve failed; using config entries. Discord API /channels/<guildId> failed (404): Unknown Channel)provider.tsintoparseDiscordChannelInputand seeing the regex ordering issueonboarding/discord.ts) with the same patternSign-Off
Greptile Overview
Greptile Summary
This change prefixes guild-only Discord allowlist entries with
guild:at the two call sites that generate inputs forresolveDiscordChannelAllowlist()(the Discord monitor provider and the onboarding wizard). This avoids an ambiguity inparseDiscordChannelInput()where bare numeric strings match the channel-id regex before the guild-id regex, causing numeric guild IDs to be treated as channel IDs.A couple regression tests were added in
src/discord/resolve-channels.test.tsto coverguild:-prefixed resolution and to document the bare-numeric ambiguity.Confidence Score: 4/5
/channels/<id>, so it doesn’t protect against the real 404-driven fallback described in the PR.(2/5) Greptile learns from your feedback when you react with thumbs up/down!