fix(discord): resolve channel ID in guildId/channelId config format#26144
Closed
Sid-Qin wants to merge 2 commits intoopenclaw:mainfrom
Closed
fix(discord): resolve channel ID in guildId/channelId config format#26144Sid-Qin wants to merge 2 commits intoopenclaw:mainfrom
Sid-Qin wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Closes openclaw#26139 parseDiscordChannelInput always assigned the channel portion to `channel` (name-based matching) even when both guild and channel were numeric IDs. This caused `resolveDiscordChannelAllowlist` to skip the direct ID lookup path and fall through to name matching, which failed because no channel is named with a numeric string. When the channel portion is a pure numeric string, return `channelId` instead of `channel` so the resolver uses `fetchChannel` for direct ID-based resolution.
Co-authored-by: Cursor <[email protected]>
|
This pull request has been automatically marked as stale due to inactivity. |
18 tasks
Member
|
Superseded by #33142 which consolidates the fixes from this PR. Closing this in favor of that PR. |
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
guilds.<guildId>.channels.<channelId>inopenclaw.json, the gateway fails to resolve the channel and logschannels unresolved. Channel names work, but channel IDs do not.parseDiscordChannelInputinsrc/discord/resolve-channels.tsnow checks whether the channel portion of aguildId/channelIdinput is a numeric string. If so, it returnschannelId(triggering direct ID lookup via/channels/<id>) instead ofchannel(which triggers name-based matching that fails for numeric strings).guildId/channel-name,Guild Name/channel-name), guild-only resolution,<#id>mention format, andchannel:/guild:prefix formats are all untouched.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
guilds.<guildId>.channels.<channelId>config entries now resolve correctly instead of producingchannels unresolvedlog warnings and silently ignoring the per-channel settings.Security Impact (required)
NoNoNo(the/channels/<id>fetch path already existed; this fix routes to it correctly)NoNoRepro + Verification
Environment
Steps
openclaw.jsonwith a numeric channel ID under a guild:Expected
[discord] channels resolved: <guild_id>/<channel_id>→<guild_id>/<channel_id>Actual
[discord] channels unresolved: <guild_id>/<channel_id>[discord] channels resolved: <guild_id>/<channel_id>→<guild_id>/<channel_id>Evidence
Root cause in
parseDiscordChannelInput(line 63-64 before fix):Fix (3 lines added):
Test added:
resolves guildId/channelId when both are numeric IDs— verifies theguildId/channelIdformat triggers/channels/<id>fetch and returns correct resolution.All 5 tests pass:
Human Verification (required)
guildId/channelIdnow resolves via direct ID lookup; existing name-based resolution still worksguild:prefix); mixedguildId/channel-namestill uses name matchingCompatibility / Migration
YesNoNoFailure Recovery (if this breaks)
src/discord/resolve-channels.tsRisks and Mitigations
None — the change only adds a numeric check before the existing fallback path. All prior behavior is preserved for non-numeric channel identifiers.
Greptile Summary
Fixed channel resolution when both guild and channel are specified as numeric IDs in
guildId/channelIdformat. Before this change,parseDiscordChannelInputwould incorrectly treat the numeric channel portion as a channel name, causing name-based lookup to fail. The fix adds a numeric check on the channel portion - when both parts are numeric, it now returnschannelIdto trigger direct ID lookup via/channels/<id>instead of name-based matching.Confidence Score: 5/5
Last reviewed commit: 5a6db6b