fix(discord): report unresolved token refs at startup#82009
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Source inspection shows a documented Discord token SecretRef reaches Real behavior proof Next step before merge Security Review detailsBest possible solution: Approve and land this focused Discord diagnostic fix if the protected-label maintainer review agrees, while keeping the broader linked config-patch issue open for its separate remaining behavior. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows a documented Discord token SecretRef reaches Is this the best way to solve the issue? Yes. The patch keeps the change inside the Discord plugin boundary, reuses the existing credential-status helper, and adds focused coverage for both the diagnostic path and active runtime-snapshot resolution. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e1d69bc43307. |
994a593 to
d46a688
Compare
Treat configured-but-unresolved Discord token refs as configured so gateway startup reaches the explicit SecretRef resolution error instead of silently classifying the account as unconfigured. Also cover runtime snapshot resolution for active Discord token refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d46a688 to
f6bb520
Compare
|
Verification for f6bb520: Behavior addressed: Discord accounts with configured but unresolved bot-token SecretRefs are treated as configured for startup selection, then fail loudly before provider startup with an actionable resolver error instead of being silently skipped as unconfigured. |
steipete
left a comment
There was a problem hiding this comment.
Reviewed the final code-only branch after rebase. Codex review and focused Discord/secrets regression proof are clean.
Treat configured-but-unresolved Discord token refs as configured so gateway startup reaches the explicit SecretRef resolution error instead of silently classifying the account as unconfigured. Also cover runtime snapshot resolution for active Discord token refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat configured-but-unresolved Discord token refs as configured so gateway startup reaches the explicit SecretRef resolution error instead of silently classifying the account as unconfigured. Also cover runtime snapshot resolution for active Discord token refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat configured-but-unresolved Discord token refs as configured so gateway startup reaches the explicit SecretRef resolution error instead of silently classifying the account as unconfigured. Also cover runtime snapshot resolution for active Discord token refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat configured-but-unresolved Discord token refs as configured so gateway startup reaches the explicit SecretRef resolution error instead of silently classifying the account as unconfigured. Also cover runtime snapshot resolution for active Discord token refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Addresses the Discord token SecretRef diagnostics/runtime-snapshot portion of #81926.
Real behavior proof
Behavior or issue addressed: A configured-but-unresolved Discord token SecretRef now reaches the gateway startup path and fails with an explicit SecretRef runtime-snapshot error before any Discord probe/provider starts, instead of being reported as merely unconfigured.
Real environment tested: WSL Ubuntu-24.04 worktree
/root/src/openclaw-branches/fix-discord-token-ref-diagnostics-81926, branch commit994a593, using livetsximports of the production Discord plugin and secrets runtime modules.Exact steps or command run after this patch: Ran a live production-path script that resolves the Discord account, calls
discordPlugin.config.isConfigured, invokesdiscordPlugin.gateway.startAccount, and prepares a secrets runtime snapshot withDISCORD_BOT_TOKENin env.$ pnpm exec tsx --eval '...production-path script importing extensions/discord/src/channel.ts and src/secrets/runtime.ts...'Evidence after fix: Copied live terminal output from the changed branch:
Observed result after fix: The unresolved SecretRef is now startup-configured (
isConfigured=true) and throws the explicit runtime-snapshot error before startup proceeds; when the env ref is available to the secrets runtime, the same Discord token ref resolves toruntime-discord-token.What was not tested: None
Validation
pnpm exec vitest run extensions/discord/src/shared.test.ts extensions/discord/src/channel.test.ts extensions/discord/src/token.test.ts src/secrets/runtime-discord-surface.test.ts --config test/vitest/vitest.runtime-config.config.tspnpm check:changed