-
-
Notifications
You must be signed in to change notification settings - Fork 69.6k
Tool subsystem fails to resolve SecretRefs for Discord token (message tool) #51263
Copy link
Copy link
Open
Description
Bug Description
The message tool fails to resolve SecretRefs when making proactive Discord API calls from non-Discord sessions (e.g., webchat, cron). The error is:
channels.discord.accounts.default.token: unresolved SecretRef "env:default:DISCORD_TOKEN_DEFAULT". Resolve this command against an active gateway runtime snapshot before reading it.
Environment
- OpenClaw version: 2026.3.13 (61d171a)
- OS: macOS (Darwin 25.3.0, arm64)
- Node: v25.6.1
- Secrets provider:
env(source:~/.openclaw/.env)
Steps to Reproduce
- Configure Discord tokens using SecretRefs with
source: "env"inopenclaw.json - Ensure env vars exist in
~/.openclaw/.env(e.g.,DISCORD_TOKEN_DEFAULT=...) - Start the gateway — Discord bots connect successfully (fetch-bot-identity completes for all accounts)
- From a webchat or cron session, call the
messagetool withaction: "channel-list"andchannel: "discord" - Observe the unresolved SecretRef error
Expected Behavior
The message tool should read from the gateway runtime snapshot (where secrets are already resolved), not the raw config file.
Actual Behavior
The tool subsystem reads the raw config containing the SecretRef object { source: "env", provider: "default", id: "DISCORD_TOKEN_DEFAULT" } instead of the resolved token value from the runtime snapshot.
Impact
- ✅ Discord inbound works — gateway receives and processes Discord messages normally
- ✅ Discord reply delivery works — the gateway channel layer uses the resolved snapshot
- ❌ Proactive
messagetool calls from non-Discord sessions fail (channel-list, send, search, etc.) - ❌
openclaw doctorreports the same error (also does not resolve against runtime snapshot) - ❌
openclaw secrets auditreports 0 unresolved refs (audit sees the env var exists) - ❌
openclaw secrets reloadcompletes successfully but does not fix the tool issue
Workaround Attempted
- Gateway restart (SIGUSR1) — does not fix
openclaw secrets reload— does not fix- Both confirm the gateway itself resolves secrets fine (bots connect), but the tool path remains broken
Additional Context
All four Discord accounts (default, brick, pixel, quill) are affected. The config uses the standard SecretRef format:
{
"token": {
"source": "env",
"provider": "default",
"id": "DISCORD_TOKEN_DEFAULT"
}
}The secrets provider is configured as:
{
"secrets": {
"providers": {
"default": { "source": "env" }
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.