openclaw - ✅(Solved) Fix [Bug]: Discord owner auth ignores channels.discord.allowFrom, hiding owner-only tools [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63261Fetched 2026-04-09 07:56:08
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
cross-referenced ×2labeled ×2referenced ×2

In v2026.4.8, a Discord DM sender allowlisted via channels.discord.allowFrom can still resolve as senderIsOwner=false, which hides owner-only tools such as cron and gateway.

Root Cause

Severity: High, because owner-only tools are unavailable in Discord sessions.

Fix Action

Fix / Workaround

Observed owner-auth result before patch:

Observed owner-auth result after patching the Discord adapter:

PR fix notes

PR #63453: fix(discord): resolve allowFrom from top-level config for owner and DM auth

Description (problem / solution / changelog)

Problem

When openclaw doctor --fix or config normalization runs, it promotes channels.discord.dm.allowFrom to the canonical top-level channels.discord.allowFrom and removes the nested copy. Two Discord adapter call sites still only read from account.config.dm?.allowFrom, which is now empty after normalization:

  1. Owner authorization (shared.tsdiscordConfigAdapter.resolveAllowFrom): senderIsOwner resolves as false for allowlisted DM senders, hiding owner-only tools (cron, gateway).
  2. DM security policy (channel.tsresolveDiscordDmPolicy): the allowlist is invisible to the pairing/allowlist policy resolver.

Observed in the field — the sender is chat-authorized but not owner-authorized:

{ "ownerList": [], "senderIsOwner": false, "isAuthorizedSender": true }

Fix

Both call sites now read account.config.allowFrom ?? account.config.dm?.allowFrom, matching the pattern already used at channel.ts:452 (resolveDmAllowFrom).

Tests

Five unit tests covering:

  • Top-level allowFrom (post-normalization) is picked up
  • Top-level is preferred when both fields are present
  • Fallback to dm.allowFrom when top-level is absent (legacy configs)
  • Returns undefined when neither is set
  • Empty allowFrom: [] does not fall through to dm.allowFrom

Closes #63261

Changed files

  • extensions/discord/src/channel.ts (modified, +1/-1)
  • extensions/discord/src/shared.allowfrom.test.ts (added, +55/-0)
  • extensions/discord/src/shared.ts (modified, +2/-1)

PR #63515: fix: use top-level allowFrom for Discord owner auth resolution

Description (problem / solution / changelog)

Fix: Discord owner auth bypasses channels.discord.allowFrom whitelist

Bug

When Discord owner authentication is used, it bypasses the channels.discord.allowFrom whitelist. In discordConfigAdapter.resolveAllowFrom, only account.config.dm?.allowFrom was checked. When a user configures channels.discord.allowFrom at the top level (not under dm.), owner auth resolution ignores it, causing senderIsOwner=false and hiding owner-only tools like cron and gateway.

Fix

Changed resolveAllowFrom to check account.config.allowFrom first, falling back to account.config.dm?.allowFrom:

// Before (buggy):
resolveAllowFrom: (account: ResolvedDiscordAccount) => account.config.dm?.allowFrom,

// After (fixed):
resolveAllowFrom: (account: ResolvedDiscordAccount) =>
  account.config.allowFrom ?? account.config.dm?.allowFrom,

Impact

  • Before: Users allowlisted via top-level channels.discord.allowFrom but not under dm.allowFrom were chat-authorized but NOT owner-authorized
  • After: Owner auth correctly resolves from top-level allowFrom, restoring access to owner-only tools (cron, gateway, etc.)

Fixes #63261

Changed files

  • extensions/discord/src/shared.ts (modified, +2/-1)
  • src/agents/pi-tools.ts (modified, +5/-1)
  • src/agents/tool-policy.test.ts (modified, +24/-0)
  • src/agents/tool-policy.ts (modified, +19/-2)

Code Example

{
  "channels": {
    "discord": {
      "enabled": true,
      "dmPolicy": "pairing",
      "allowFrom": ["<DISCORD_USER_ID>"]
    }
  }
}

---

Relevant source paths:

- `extensions/discord/src/shared.ts`
- `src/config/channel-compat-normalization.ts`
- `src/auto-reply/command-auth.ts`
- `src/agents/tool-policy.ts`
- `src/agents/tools/cron-tool.ts`
- `src/agents/tools/gateway-tool.ts`

Discord currently resolves allow-from from the nested field only:


resolveAllowFrom: (account: ResolvedDiscordAccount) => account.config.dm?.allowFrom,


Config normalization treats top-level `allowFrom` as canonical and can remove the nested `dm.allowFrom` copy.

Observed owner-auth result before patch:


{
  "providerId": "discord",
  "ownerList": [],
  "senderId": "<DISCORD_USER_ID>",
  "senderIsOwner": false,
  "isAuthorizedSender": true,
  "from": "discord:user:<DISCORD_USER_ID>",
  "to": "discord:user:<DISCORD_TARGET_ID>"
}


Observed owner-auth result after patching the Discord adapter:


{
  "providerId": "discord",
  "ownerList": ["<DISCORD_USER_ID>"],
  "senderId": "<DISCORD_USER_ID>",
  "senderIsOwner": true,
  "isAuthorizedSender": true,
  "from": "discord:user:<DISCORD_USER_ID>",
  "to": "discord:user:<DISCORD_TARGET_ID>"
}


Minimal source fix:


resolveAllowFrom: (account: ResolvedDiscordAccount) =>
  account.config.allowFrom ?? account.config.dm?.allowFrom,
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

In v2026.4.8, a Discord DM sender allowlisted via channels.discord.allowFrom can still resolve as senderIsOwner=false, which hides owner-only tools such as cron and gateway.

Steps to reproduce

  1. Configure OpenClaw v2026.4.8 with Discord using dmPolicy: "pairing" and a top-level allowlist entry in channels.discord.allowFrom.
  2. Leave commands.ownerAllowFrom unset.
  3. Start OpenClaw and open a Discord DM/session from the allowlisted sender.
  4. Inspect owner authorization or the effective tool inventory for that session.
  5. Observe senderIsOwner=false, ownerList=[], and owner-only tools such as cron and gateway are missing.

Minimal config shape used for repro:

{
  "channels": {
    "discord": {
      "enabled": true,
      "dmPolicy": "pairing",
      "allowFrom": ["<DISCORD_USER_ID>"]
    }
  }
}

Expected behavior

The allowlisted Discord DM sender should resolve as owner, and owner-only tools should remain available in the session.

Actual behavior

The Discord session is chat-authorized but not owner-authorized, so owner-only tools are filtered out.

OpenClaw version

2026.4.8 (git tag v2026.4.8, commit abe7b2c4)

Operating system

macOS 15.7.3 (arm64)

Install method

Local source checkout / CLI wrapper launching dist/entry.js, gateway service running via LaunchAgent

Model

openai-codex/gpt-5.4

Provider / routing chain

Discord DM -> OpenClaw local gateway -> auto-reply/command-auth -> agent tool policy

Additional provider/model setup details

This bug occurs before model invocation, during owner authorization and tool gating. The model/provider does not appear to be causal.

Logs, screenshots, and evidence

Relevant source paths:

- `extensions/discord/src/shared.ts`
- `src/config/channel-compat-normalization.ts`
- `src/auto-reply/command-auth.ts`
- `src/agents/tool-policy.ts`
- `src/agents/tools/cron-tool.ts`
- `src/agents/tools/gateway-tool.ts`

Discord currently resolves allow-from from the nested field only:


resolveAllowFrom: (account: ResolvedDiscordAccount) => account.config.dm?.allowFrom,


Config normalization treats top-level `allowFrom` as canonical and can remove the nested `dm.allowFrom` copy.

Observed owner-auth result before patch:


{
  "providerId": "discord",
  "ownerList": [],
  "senderId": "<DISCORD_USER_ID>",
  "senderIsOwner": false,
  "isAuthorizedSender": true,
  "from": "discord:user:<DISCORD_USER_ID>",
  "to": "discord:user:<DISCORD_TARGET_ID>"
}


Observed owner-auth result after patching the Discord adapter:


{
  "providerId": "discord",
  "ownerList": ["<DISCORD_USER_ID>"],
  "senderId": "<DISCORD_USER_ID>",
  "senderIsOwner": true,
  "isAuthorizedSender": true,
  "from": "discord:user:<DISCORD_USER_ID>",
  "to": "discord:user:<DISCORD_TARGET_ID>"
}


Minimal source fix:


resolveAllowFrom: (account: ResolvedDiscordAccount) =>
  account.config.allowFrom ?? account.config.dm?.allowFrom,

Impact and severity

Affected: Discord DM/session senders allowlisted via channels.discord.allowFrom without a matching commands.ownerAllowFrom override.

Severity: High, because owner-only tools are unavailable in Discord sessions.

Frequency: Always observed with the configuration above.

Consequence: Admin workflows from Discord are blocked even though the session itself still works for chat.

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by updating the resolveAllowFrom function to check both the top-level allowFrom and the nested dm.allowFrom fields in the Discord account configuration.

Guidance

  • Review the resolveAllowFrom function in extensions/discord/src/shared.ts to ensure it checks both account.config.allowFrom and account.config.dm?.allowFrom.
  • Verify that the config normalization in src/config/channel-compat-normalization.ts does not remove the necessary allowFrom fields.
  • Test the fix by configuring OpenClaw with the minimal config shape provided and checking the owner authorization result for the allowlisted Discord DM sender.
  • Check the ownerList and senderIsOwner fields in the owner-auth result to ensure they are correctly set.

Example

The minimal source fix provided in the issue body can be used as a starting point:

resolveAllowFrom: (account: ResolvedDiscordAccount) =>
  account.config.allowFrom?? account.config.dm?.allowFrom,

This code checks both the top-level allowFrom and the nested dm.allowFrom fields and returns the first one that is truthy.

Notes

The fix assumes that the allowFrom fields are correctly configured in the Discord account settings. If the fields are not set or are set incorrectly, the fix may not work as expected.

Recommendation

Apply the workaround by updating the resolveAllowFrom function to check both allowFrom fields, as this should fix the issue and allow owner-only tools to be available in Discord sessions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The allowlisted Discord DM sender should resolve as owner, and owner-only tools should remain available in the session.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING