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

推荐订阅源

I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
B
Blog
罗磊的独立博客
GbyAI
GbyAI
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
The GitHub Blog
The GitHub Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Visual Studio Blog
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏

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(sms): add Twilio webhook diagnostics · openclaw/openc...
steipete · 2026-05-31 · via Recent Commits to openclaw:main
1+

import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";

2+

import {

3+

applyResolvedAssignments,

4+

createResolverContext,

5+

resolveSecretRefValues,

6+

} from "openclaw/plugin-sdk/secret-ref-runtime";

7+

import { describe, expect, it } from "vitest";

8+

import { collectRuntimeConfigAssignments, secretTargetRegistryEntries } from "./secret-contract.js";

9+10+

async function resolveSmsSecretAssignments(

11+

sourceConfig: OpenClawConfig,

12+

env: NodeJS.ProcessEnv,

13+

): Promise<{

14+

config: OpenClawConfig;

15+

warnings: ReturnType<typeof createResolverContext>["warnings"];

16+

}> {

17+

const resolvedConfig: OpenClawConfig = structuredClone(sourceConfig);

18+

const context = createResolverContext({ sourceConfig, env });

19+20+

collectRuntimeConfigAssignments({

21+

config: resolvedConfig,

22+

defaults: sourceConfig.secrets?.defaults,

23+

context,

24+

});

25+26+

const resolved = await resolveSecretRefValues(

27+

context.assignments.map((assignment) => assignment.ref),

28+

{

29+

config: sourceConfig,

30+

env: context.env,

31+

cache: context.cache,

32+

},

33+

);

34+

applyResolvedAssignments({ assignments: context.assignments, resolved });

35+36+

return { config: resolvedConfig, warnings: context.warnings };

37+

}

38+39+

describe("sms secret contract", () => {

40+

it("publishes SMS auth token targets", () => {

41+

expect(secretTargetRegistryEntries.map((entry) => entry.id)).toEqual([

42+

"channels.sms.accounts.*.authToken",

43+

"channels.sms.authToken",

44+

]);

45+

});

46+47+

it("resolves top-level authToken SecretRefs for SMS accounts", async () => {

48+

const resolved = await resolveSmsSecretAssignments(

49+

{

50+

channels: {

51+

sms: {

52+

enabled: true,

53+

accountSid: "AC123",

54+

authToken: { source: "env", provider: "default", id: "TWILIO_AUTH_TOKEN" },

55+

fromNumber: "+15557654321",

56+

},

57+

},

58+

} as OpenClawConfig,

59+

{ TWILIO_AUTH_TOKEN: "resolved-token" },

60+

);

61+62+

expect(resolved.config.channels?.sms?.authToken).toBe("resolved-token");

63+

expect(resolved.warnings).toStrictEqual([]);

64+

});

65+66+

it("keeps top-level authToken active for an implicit default sender plus named accounts", async () => {

67+

const resolved = await resolveSmsSecretAssignments(

68+

{

69+

channels: {

70+

sms: {

71+

enabled: true,

72+

accountSid: "AC123",

73+

authToken: { source: "env", provider: "default", id: "TWILIO_DEFAULT_TOKEN" },

74+

fromNumber: "+15557654321",

75+

accounts: {

76+

support: {

77+

enabled: true,

78+

accountSid: "AC456",

79+

authToken: { source: "env", provider: "default", id: "TWILIO_SUPPORT_TOKEN" },

80+

fromNumber: "+15558675309",

81+

},

82+

},

83+

},

84+

},

85+

} as OpenClawConfig,

86+

{

87+

TWILIO_DEFAULT_TOKEN: "resolved-default-token",

88+

TWILIO_SUPPORT_TOKEN: "resolved-support-token",

89+

},

90+

);

91+92+

expect(resolved.config.channels?.sms?.authToken).toBe("resolved-default-token");

93+

expect(resolved.config.channels?.sms?.accounts?.support?.authToken).toBe(

94+

"resolved-support-token",

95+

);

96+

expect(resolved.warnings).toStrictEqual([]);

97+

});

98+99+

it("keeps top-level authToken active for env-backed default senders plus named accounts", async () => {

100+

const resolved = await resolveSmsSecretAssignments(

101+

{

102+

channels: {

103+

sms: {

104+

enabled: true,

105+

authToken: { source: "env", provider: "default", id: "TWILIO_DEFAULT_TOKEN" },

106+

accounts: {

107+

support: {

108+

enabled: true,

109+

accountSid: "AC456",

110+

authToken: { source: "env", provider: "default", id: "TWILIO_SUPPORT_TOKEN" },

111+

fromNumber: "+15558675309",

112+

},

113+

},

114+

},

115+

},

116+

} as OpenClawConfig,

117+

{

118+

TWILIO_ACCOUNT_SID: "AC-env",

119+

TWILIO_PHONE_NUMBER: "+15550001111",

120+

TWILIO_DEFAULT_TOKEN: "resolved-default-token",

121+

TWILIO_SUPPORT_TOKEN: "resolved-support-token",

122+

},

123+

);

124+125+

expect(resolved.config.channels?.sms?.authToken).toBe("resolved-default-token");

126+

expect(resolved.config.channels?.sms?.accounts?.support?.authToken).toBe(

127+

"resolved-support-token",

128+

);

129+

expect(resolved.warnings).toStrictEqual([]);

130+

});

131+132+

it("treats top-level authToken refs as inactive when all enabled accounts override them", async () => {

133+

const resolved = await resolveSmsSecretAssignments(

134+

{

135+

channels: {

136+

sms: {

137+

authToken: { source: "env", provider: "default", id: "UNUSED_TWILIO_TOKEN" },

138+

accounts: {

139+

support: {

140+

enabled: true,

141+

accountSid: "AC456",

142+

authToken: { source: "env", provider: "default", id: "TWILIO_SUPPORT_TOKEN" },

143+

fromNumber: "+15558675309",

144+

},

145+

},

146+

},

147+

},

148+

} as OpenClawConfig,

149+

{ TWILIO_SUPPORT_TOKEN: "resolved-support-token" },

150+

);

151+152+

expect(resolved.config.channels?.sms?.authToken).toEqual({

153+

source: "env",

154+

provider: "default",

155+

id: "UNUSED_TWILIO_TOKEN",

156+

});

157+

expect(resolved.config.channels?.sms?.accounts?.support?.authToken).toBe(

158+

"resolved-support-token",

159+

);

160+

expect(resolved.warnings.map((warning) => warning.path)).toContain("channels.sms.authToken");

161+

});

162+

});