openclaw - ✅(Solved) Fix Discord slash sessions fail elevated allowFrom resolution; sandbox explain reports channel as unknown [1 pull requests, 1 comments, 2 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#53621Fetched 2026-04-08 01:25:39
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

Discord slash sessions can fail elevated permission resolution even when tools.elevated.allowFrom.discord is configured correctly.

In the same setup, openclaw sandbox explain --session agent:main:discord:slash:<userId> can also misdiagnose the session as channel: (unknown), which sends debugging in the wrong direction.

This looks like the Discord counterpart of the already-reported Telegram slash/channel-unknown class of bug (for reference: #51245), but it affects elevated gating and sandbox explain output for Discord slash sessions.

Root Cause

This is easy to misdiagnose as a user config mistake, because the fix-it hints point at allowFrom keys even though the configured values are already present.

So the bug has two user-visible effects:

  • elevated slash flows do not work on Discord
  • diagnostics suggest the wrong root cause

Fix Action

Fix / Workaround

Local hotfix that restored behavior

A local hot patch restored expected behavior by adding a fallback that infers the provider/channel from SessionKey when provider metadata is missing, e.g. detecting :discord: in:

After that patch, sandbox explain changed from:

PR fix notes

PR #53804: fix(elevated): fall back to session key channel for Discord slash elevated resolution

Description (problem / solution / changelog)

Summary

When Discord slash sessions reach the elevated permission resolution path, ctx.Provider / sessionCtx.Provider can be empty. This causes the allowFrom lookup to fail even when tools.elevated.allowFrom.discord is correctly configured.

Changes

  1. New helper: inferChannelFromSessionKey() (src/routing/session-key-channel.ts)

    • Extracts the channel segment from agent session keys
    • e.g. agent:main:discord:slash:<id>"discord"
    • Only returns a value when the key has at least <channel>:<subtype> structure
  2. Runtime fix: get-reply-directives.ts

    • Falls back to inferChannelFromSessionKey(ctx.SessionKey) when both sessionCtx.Provider and ctx.Provider are empty
    • Ensures resolveElevatedPermissions() receives the correct provider
  3. Diagnostics fix: sandbox-explain.ts

    • resolveActiveChannel() now falls back to inferChannelFromSessionKey() when the session store and inferProviderFromSessionKey() both return nothing
    • Ensures openclaw sandbox explain shows channel: discord instead of channel: (unknown)

Related issues

  • Fixes #53621 (Discord slash elevated gating + sandbox explain misdiagnosis)
  • Discord counterpart of #51245 (Telegram slash sessions)
  • Related to #53198

Testing

Verified locally with hot patch on 2026.3.23-2:

  • Before patch: channel: (unknown), allowedByConfig: false
  • After patch: channel: discord, allowedByConfig: true
  • Discord slash elevated commands work correctly after fix

Changed files

  • src/auto-reply/reply/get-reply-directives.ts (modified, +5/-1)
  • src/commands/sandbox-explain.ts (modified, +7/-4)
  • src/routing/session-key-channel.ts (added, +37/-0)

Code Example

elevated is not available right now (runtime=direct).
Failing gates: allowFrom
Fix-it keys:
- tools.elevated.enabled
- tools.elevated.allowFrom.<provider>
- agents.list[].tools.elevated.enabled
- agents.list[].tools.elevated.allowFrom.<provider>

---

Elevated:
  enabled: true
  channel: (unknown)
  allowedByConfig: false

---

{
  "tools": {
    "elevated": {
      "enabled": true,
      "allowFrom": {
        "discord": ["957519555150901298"]
      }
    }
  },
  "commands": {
    "allowFrom": {
      "discord": ["957519555150901298"]
    }
  }
}

---

openclaw sandbox explain --session agent:main:discord:slash:<discord-user-id>

---

channel: (unknown)
allowedByConfig: false

---

channel: discord
allowedByConfig: true
RAW_BUFFERClick to expand / collapse

Summary

Discord slash sessions can fail elevated permission resolution even when tools.elevated.allowFrom.discord is configured correctly.

In the same setup, openclaw sandbox explain --session agent:main:discord:slash:<userId> can also misdiagnose the session as channel: (unknown), which sends debugging in the wrong direction.

This looks like the Discord counterpart of the already-reported Telegram slash/channel-unknown class of bug (for reference: #51245), but it affects elevated gating and sandbox explain output for Discord slash sessions.

Version

  • OpenClaw 2026.3.23-2

Expected behavior

For a Discord slash session such as:

  • agent:main:discord:slash:957519555150901298

OpenClaw should:

  1. Resolve the session provider/channel as discord
  2. Apply tools.elevated.allowFrom.discord
  3. Report the same provider/channel correctly in openclaw sandbox explain

Actual behavior

Even with the config set, Discord slash elevated access still fails with:

elevated is not available right now (runtime=direct).
Failing gates: allowFrom
Fix-it keys:
- tools.elevated.enabled
- tools.elevated.allowFrom.<provider>
- agents.list[].tools.elevated.enabled
- agents.list[].tools.elevated.allowFrom.<provider>

And sandbox explain shows:

Elevated:
  enabled: true
  channel: (unknown)
  allowedByConfig: false

Relevant config

{
  "tools": {
    "elevated": {
      "enabled": true,
      "allowFrom": {
        "discord": ["957519555150901298"]
      }
    }
  },
  "commands": {
    "allowFrom": {
      "discord": ["957519555150901298"]
    }
  }
}

Reproduction

  1. Configure:
    • tools.elevated.enabled = true
    • tools.elevated.allowFrom.discord = ["<discord-user-id>"]
    • commands.allowFrom.discord = ["<discord-user-id>"]
  2. Trigger a Discord slash session
  3. Request an elevated exec from that slash session
  4. Run:
openclaw sandbox explain --session agent:main:discord:slash:<discord-user-id>

Observed diagnosis mismatch

The main runtime bug appears to be that the elevated permission resolution path does not always receive the Discord provider for slash sessions.

Separately, sandbox explain appears to have its own channel/provider inference gap for session keys of the form:

  • agent:main:discord:slash:<userId>

So there seem to be two related issues:

  1. Runtime gating bug: provider/channel is missing in elevated permission resolution for Discord slash sessions
  2. Diagnostics bug: sandbox explain reports channel: (unknown) for the same session type

Local hotfix that restored behavior

A local hot patch restored expected behavior by adding a fallback that infers the provider/channel from SessionKey when provider metadata is missing, e.g. detecting :discord: in:

  • ctx.SessionKey in the runtime permission path
  • --session agent:main:discord:slash:<userId> in sandbox explain

After that patch, sandbox explain changed from:

channel: (unknown)
allowedByConfig: false

to:

channel: discord
allowedByConfig: true

Why this matters

This is easy to misdiagnose as a user config mistake, because the fix-it hints point at allowFrom keys even though the configured values are already present.

So the bug has two user-visible effects:

  • elevated slash flows do not work on Discord
  • diagnostics suggest the wrong root cause

extent analysis

Fix Plan

To resolve the issue, apply the following steps:

  • Update the elevated permission resolution path to infer the provider/channel from SessionKey when provider metadata is missing.
  • Modify the sandbox explain command to correctly infer the provider/channel from the session key.

Example code changes:

# In the elevated permission resolution path
if not provider:
    # Infer provider from SessionKey
    if ':discord:' in ctx.SessionKey:
        provider = 'discord'

# In the sandbox explain command
if '--session' in args:
    session_key = args[args.index('--session') + 1]
    if ':discord:' in session_key:
        channel = 'discord'

Configuration Changes

No configuration changes are required. Ensure that the tools.elevated.allowFrom.discord and commands.allowFrom.discord configurations are set correctly.

Verification

To verify the fix, run the following steps:

  1. Trigger a Discord slash session
  2. Request an elevated exec from that slash session
  3. Run openclaw sandbox explain --session agent:main:discord:slash:<discord-user-id>
  4. Verify that the output shows the correct provider/channel and allowedByConfig status.

Extra Tips

  • Ensure that the tools.elevated.enabled and commands.allowFrom.discord configurations are set to true.
  • Double-check that the discord-user-id is correctly configured in the tools.elevated.allowFrom.discord and commands.allowFrom.discord settings.

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

For a Discord slash session such as:

  • agent:main:discord:slash:957519555150901298

OpenClaw should:

  1. Resolve the session provider/channel as discord
  2. Apply tools.elevated.allowFrom.discord
  3. Report the same provider/channel correctly in openclaw sandbox explain

Still need to ship something?

×6

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

Back to top recommendations

TRENDING