Skip to content

fix(discord): exclude '*' wildcard from unresolvedChannels audit count#32608

Closed
CloveSVG wants to merge 1 commit intoopenclaw:mainfrom
CloveSVG:fix/discord-wildcard-unresolved-channels
Closed

fix(discord): exclude '*' wildcard from unresolvedChannels audit count#32608
CloveSVG wants to merge 1 commit intoopenclaw:mainfrom
CloveSVG:fix/discord-wildcard-unresolved-channels

Conversation

@CloveSVG
Copy link
Copy Markdown

@CloveSVG CloveSVG commented Mar 3, 2026

Summary

Fixes #32517

openclaw doctor and channels status --probe report a false positive warning when users configure "*" as a wildcard key in guild channels:

Some configured guild channels are not numeric IDs (unresolvedChannels=1).

Root Cause

In listConfiguredGuildChannelKeys, every non-numeric key was included — including "*" — so it got counted as an unresolved channel ID in collectDiscordAuditChannelIds.

The "*" key is a valid config meaning "allow all channels in the guild" and is already handled correctly by allowlist logic elsewhere. It is not an actual Discord channel ID and should never be audited.

Fix

Skip "*" in listConfiguredGuildChannelKeys before it enters the key set, so it's excluded from both channelIds and the unresolvedChannels count.

// Skip wildcard keys (e.g. "*" meaning "all channels") — they are valid
// config but are not real channel IDs and should not be audited.
if (channelId === "*") {
  continue;
}

Tests

Added two new test cases:

  • Guild with numeric IDs + "*" wildcard → unresolvedChannels: 0
  • Guild with only "*" wildcard → channelIds: [], unresolvedChannels: 0

The permission audit in `collectDiscordAuditChannelIds` was counting the
`"*"` wildcard key as an unresolved channel ID, causing a false positive
warning in `openclaw doctor` and `channels status --probe`:

  Some configured guild channels are not numeric IDs (unresolvedChannels=1).

The `"*"` key is a valid config meaning "allow all channels in the guild"
and is already handled correctly by allowlist logic elsewhere. It is not
an actual channel ID and should never be sent to the Discord API for
permission checks.

Fix: skip `"*"` in `listConfiguredGuildChannelKeys` so it is excluded
from both `channelIds` and the `unresolvedChannels` count.

Adds two test cases covering the wildcard-with-numeric-ids and
wildcard-only configurations.

Fixes #32517
@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord size: S labels Mar 3, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR fixes a false-positive warning in openclaw doctor / channels status --probe that occurred when users included a "*" wildcard key in their guild channel configuration. The fix is minimal and correct: a single early-continue guard in listConfiguredGuildChannelKeys (before the shouldAuditChannelConfig check) prevents "*" from ever entering the channel-ID set or inflating the unresolvedChannels count.

  • The placement of the guard is intentional and correct — "*" should be excluded regardless of its allow value because it is never a real Discord channel ID.
  • The existing space-trim (String(key).trim()) means a key like " * " is also handled safely.
  • Two well-scoped test cases are added, covering the mixed (numeric + wildcard) and wildcard-only scenarios with the right assertions on both channelIds and unresolvedChannels.

Confidence Score: 5/5

  • This PR is safe to merge — it is a narrow, well-tested bug fix with no side-effects on existing behaviour.
  • The change is a single 4-line guard in one function, directly addresses the root cause described in the issue, is covered by two new targeted tests, and does not affect any code paths that don't involve the "*" key.
  • No files require special attention.

Last reviewed commit: 7c2d0bb

Jah-yee added a commit to Jah-yee/openclaw that referenced this pull request Mar 3, 2026
Issue openclaw#32608: Wildcard '*' in guild channels should not be counted
as unresolved channel ID since it's a valid config meaning 'allow all'.
Jah-yee added a commit to Jah-yee/openclaw that referenced this pull request Mar 3, 2026
Issue openclaw#32608: Wildcard '*' in guild channels should not be counted
as unresolved channel ID since it's a valid config meaning 'allow all'.
@thewilloftheshadow
Copy link
Copy Markdown
Member

Superseded by #33125 (includes the Discord wildcard audit fix). Please use that PR instead.

@CloveSVG CloveSVG deleted the fix/discord-wildcard-unresolved-channels branch March 7, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord: false positive 'unresolvedChannels' warning when using '*' wildcard in guild channels

2 participants