惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
The Cloudflare Blog
IT之家
IT之家
V
V2EX
雷峰网
雷峰网
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
A
About on SuperTechFans
B
Blog
月光博客
月光博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(discord): report unresolved token refs at startup (#8...
giodl73-repo · 2026-05-15 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -502,6 +502,22 @@ describe("discordPlugin outbound", () => {

502502

expect(runtimeMonitorDiscordProvider).not.toHaveBeenCalled();

503503

});

504504
505+

it("fails loudly before provider startup when a token SecretRef is configured but unresolved", async () => {

506+

const cfg = {

507+

channels: {

508+

discord: {

509+

token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },

510+

},

511+

},

512+

} as unknown as OpenClawConfig;

513+
514+

await expect(startDiscordAccount(cfg)).rejects.toThrow(

515+

'Discord bot token configured for account "default" is unavailable',

516+

);

517+

expect(probeDiscordMock).not.toHaveBeenCalled();

518+

expect(monitorDiscordProviderMock).not.toHaveBeenCalled();

519+

});

520+
505521

it("does not block Discord monitor startup on the startup probe", async () => {

506522

let resolveProbe:

507523

| ((value: {

Original file line numberDiff line numberDiff line change

@@ -651,6 +651,11 @@ export const discordPlugin: ChannelPlugin<ResolvedDiscordAccount, DiscordProbe>

651651

gateway: {

652652

startAccount: async (ctx) => {

653653

const account = ctx.account;

654+

if (account.tokenStatus === "configured_unavailable") {

655+

throw new Error(

656+

`Discord bot token configured for account "${account.accountId}" is unavailable; resolve SecretRefs against the active runtime snapshot before using this account.`,

657+

);

658+

}

654659

const startupDelayMs = resolveDiscordStartupDelayMs(ctx.cfg, account.accountId);

655660

if (startupDelayMs > 0) {

656661

ctx.log?.info(

Original file line numberDiff line numberDiff line change

@@ -63,7 +63,7 @@ describe("createDiscordPluginBase", () => {

6363

expect(plugin.config.isEnabled?.(workAccount, cfg)).toBe(true);

6464

});

6565
66-

it("describes unresolved SecretRef tokens without marking them startup-configured", () => {

66+

it("describes unresolved SecretRef tokens as startup-configured so startup reports the resolver error", () => {

6767

const plugin = createDiscordPluginBase({ setup: {} as never });

6868

const cfg = {

6969

channels: {

@@ -79,8 +79,8 @@ describe("createDiscordPluginBase", () => {

7979

expect(account.token).toBe("");

8080

expect(account.tokenSource).toBe("config");

8181

expect(account.tokenStatus).toBe("configured_unavailable");

82-

expect(plugin.config.isConfigured?.(account, cfg)).toBe(false);

83-

expect(described?.configured).toBe(false);

82+

expect(plugin.config.isConfigured?.(account, cfg)).toBe(true);

83+

expect(described?.configured).toBe(true);

8484

expect(described?.tokenStatus).toBe("configured_unavailable");

8585

});

8686

});

Original file line numberDiff line numberDiff line change

@@ -15,7 +15,11 @@ import {

1515

resolveDiscordAccountDisabledReason,

1616

type ResolvedDiscordAccount,

1717

} from "./accounts.js";

18-

import { getChatChannelMeta, type ChannelPlugin } from "./channel-api.js";

18+

import {

19+

getChatChannelMeta,

20+

resolveConfiguredFromCredentialStatuses,

21+

type ChannelPlugin,

22+

} from "./channel-api.js";

1923

import { DiscordChannelConfigSchema } from "./config-schema.js";

2024

import { normalizeCompatibilityConfig } from "./doctor-contract.js";

2125

import { DISCORD_LEGACY_CONFIG_RULES } from "./doctor-shared.js";

@@ -149,11 +153,13 @@ export function createDiscordPluginBase(params: {

149153

typeof env?.DISCORD_BOT_TOKEN === "string" && env.DISCORD_BOT_TOKEN.trim().length > 0,

150154

isEnabled: (account, cfg) => isDiscordAccountEnabledForRuntime(account, cfg),

151155

disabledReason: (account, cfg) => resolveDiscordAccountDisabledReason(account, cfg),

152-

isConfigured: (account) => Boolean(account.token?.trim()),

156+

isConfigured: (account) =>

157+

resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),

153158

describeAccount: (account) =>

154159

describeAccountSnapshot({

155160

account,

156-

configured: Boolean(account.token?.trim()),

161+

configured:

162+

resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),

157163

extra: {

158164

tokenSource: account.tokenSource,

159165

tokenStatus: account.tokenStatus,

Original file line numberDiff line numberDiff line change

@@ -9,6 +9,67 @@ import {

99

const { prepareSecretsRuntimeSnapshot } = setupSecretsRuntimeSnapshotTestHooks();

1010
1111

describe("secrets runtime snapshot discord surface", () => {

12+

it("resolves active Discord token refs for the default account", async () => {

13+

const topLevelSnapshot = await prepareSecretsRuntimeSnapshot({

14+

config: asConfig({

15+

channels: {

16+

discord: {

17+

token: {

18+

source: "env",

19+

provider: "default",

20+

id: "DISCORD_BOT_TOKEN",

21+

},

22+

},

23+

},

24+

}),

25+

env: {

26+

DISCORD_BOT_TOKEN: "base-token",

27+

},

28+

agentDirs: ["/tmp/openclaw-agent-main"],

29+

loadAuthStore: () => loadAuthStoreWithProfiles({}),

30+

});

31+

expect(topLevelSnapshot.config.channels?.discord?.token).toBe("base-token");

32+
33+

const accountSnapshot = await prepareSecretsRuntimeSnapshot({

34+

config: asConfig({

35+

channels: {

36+

discord: {

37+

token: {

38+

source: "env",

39+

provider: "default",

40+

id: "DISCORD_BOT_TOKEN",

41+

},

42+

accounts: {

43+

default: {

44+

enabled: true,

45+

token: {

46+

source: "env",

47+

provider: "default",

48+

id: "DISCORD_DEFAULT_ACCOUNT_TOKEN",

49+

},

50+

},

51+

},

52+

},

53+

},

54+

}),

55+

env: {

56+

DISCORD_BOT_TOKEN: "base-token",

57+

DISCORD_DEFAULT_ACCOUNT_TOKEN: "default-account-token",

58+

},

59+

agentDirs: ["/tmp/openclaw-agent-main"],

60+

loadAuthStore: () => loadAuthStoreWithProfiles({}),

61+

});

62+
63+

expect(accountSnapshot.config.channels?.discord?.token).toEqual({

64+

source: "env",

65+

provider: "default",

66+

id: "DISCORD_BOT_TOKEN",

67+

});

68+

expect(accountSnapshot.config.channels?.discord?.accounts?.default?.token).toBe(

69+

"default-account-token",

70+

);

71+

});

72+
1273

it("fails when non-default Discord account inherits an unresolved top-level token ref", async () => {

1374

await expect(

1475

prepareSecretsRuntimeSnapshot({