Skip to content

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

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

fix(discord): exclude '*' wildcard from unresolvedChannels count#32816
Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Sid-Qin:fix/discord-wildcard-unresolved-channels-32517

Conversation

@Sid-Qin
Copy link
Copy Markdown
Contributor

@Sid-Qin Sid-Qin commented Mar 3, 2026

Summary

  • Problem: collectDiscordAuditChannelIds counts the * wildcard key as an unresolved channel, causing doctor and channels status --probe to emit a false positive warning: "Some configured guild channels are not numeric IDs (unresolvedChannels=1)".
  • Why it matters: Users who correctly configure "*": { "allow": true } to allow all channels in a guild see a spurious warning that implies their config is broken.
  • What changed: The wildcard key * is now excluded from the unresolved count in collectDiscordAuditChannelIds. A wildcardCount is subtracted from the non-numeric keys total.
  • What did NOT change (scope boundary): The allowlist logic in provider.allowlist.ts already handles * correctly. Only the audit/diagnostic path is fixed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

openclaw doctor and channels status --probe no longer report unresolvedChannels=1 when the only non-numeric channel key is the * wildcard.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS / Linux
  • Runtime: Node.js 22+

Steps

  1. Configure channels.discord.guilds.<id>.channels with "*": { "allow": true }
  2. Run openclaw doctor or channels status --probe
  3. Observe no false positive unresolvedChannels warning

Expected

  • No warning about unresolved channels when only * wildcard is used

Actual

  • Before: Warning: "Some configured guild channels are not numeric IDs (unresolvedChannels=1)"
  • After: No warning; unresolvedChannels is 0

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

2 tests pass:

  • Existing test confirms non-numeric named keys (e.g. general) still count as unresolved
  • New test confirms * wildcard-only config yields unresolvedChannels: 0

Human Verification (required)

  • Verified scenarios: Wildcard-only guild, mixed wildcard + numeric, mixed wildcard + named + numeric
  • Edge cases checked: Empty guilds, disabled channels with wildcard
  • What you did not verify: Live openclaw doctor output against a real Discord server

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert: Revert the 3-line change in src/discord/audit.ts
  • Files/config to restore: src/discord/audit.ts

Risks and Mitigations

  • Risk: None — this is a purely diagnostic change that removes a false positive
    • Mitigation: N/A

The channel audit counted the '*' wildcard key as an unresolved channel,
producing a false positive warning in doctor/channels-status even though
'*' is a valid config meaning "allow all channels in this guild".

Closes openclaw#32517

Made-with: Cursor
@aisle-research-bot
Copy link
Copy Markdown

aisle-research-bot bot commented Mar 3, 2026

🤖 We're reviewing this PR with Aisle

We're running a security check on the changes in this PR now. This usually takes a few minutes. ⌛
We'll post the results here as soon as they're ready.

Progress:

  • Analysis
  • Triage
  • Finalization

Latest run failed. Keeping previous successful results. Trace ID: 019cb2eed75e8587cbe4ee4aa149d312.

Last updated on: 2026-03-03T09:02:15Z

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR fixes a false-positive diagnostic warning in collectDiscordAuditChannelIds where the * wildcard channel key was incorrectly counted as an unresolved (non-numeric) channel ID.

The fix: Two lines added to audit.ts subtract the wildcard count from the unresolvedChannels total, guarded with Math.max(0, …) for safety. This removes the spurious warning when users correctly configure "*": { "allow": true } to allow all channels in a guild.

Test coverage: New test scenarios validate both the wildcard-only case and a mixed wildcard + numeric ID case. All tests pass. The fix is minimal, well-scoped to the diagnostic path, and has no impact on runtime channel permission auditing.

Confidence Score: 5/5

  • Safe to merge — minimal diagnostic-only change with no impact on runtime behavior or permissions logic.
  • This PR removes a false-positive warning with a two-line fix in a diagnostic code path. The fix is correct, well-tested, and has zero impact on channel permission auditing or any production logic. No functional regressions possible.
  • No files require special attention.

Last reviewed commit: e39291d

@thewilloftheshadow
Copy link
Copy Markdown
Member

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

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