fix(discord): deep merge agent component config · openclaw/openclaw@814386a
100menotu001
·
2026-05-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -187,6 +187,65 @@ describe("resolveDiscordAccount botLoopProtection precedence", () => {
|
187 | 187 | }); |
188 | 188 | }); |
189 | 189 | |
| 190 | +describe("resolveDiscordAccount agentComponents precedence", () => { |
| 191 | +it("preserves a disabled channel default when an account only overrides ttlMs", () => { |
| 192 | +const resolved = resolveDiscordAccount({ |
| 193 | +cfg: { |
| 194 | +channels: { |
| 195 | +discord: { |
| 196 | +agentComponents: { |
| 197 | +enabled: false, |
| 198 | +}, |
| 199 | +accounts: { |
| 200 | +work: { |
| 201 | +token: "token-work", |
| 202 | +agentComponents: { |
| 203 | +ttlMs: 120_000, |
| 204 | +}, |
| 205 | +}, |
| 206 | +}, |
| 207 | +}, |
| 208 | +}, |
| 209 | +}, |
| 210 | +accountId: "work", |
| 211 | +}); |
| 212 | + |
| 213 | +expect(resolved.config.agentComponents).toEqual({ |
| 214 | +enabled: false, |
| 215 | +ttlMs: 120_000, |
| 216 | +}); |
| 217 | +}); |
| 218 | + |
| 219 | +it("preserves channel ttlMs when an account only overrides enabled", () => { |
| 220 | +const resolved = resolveDiscordAccount({ |
| 221 | +cfg: { |
| 222 | +channels: { |
| 223 | +discord: { |
| 224 | +agentComponents: { |
| 225 | +enabled: false, |
| 226 | +ttlMs: 180_000, |
| 227 | +}, |
| 228 | +accounts: { |
| 229 | +work: { |
| 230 | +token: "token-work", |
| 231 | +agentComponents: { |
| 232 | +enabled: true, |
| 233 | +}, |
| 234 | +}, |
| 235 | +}, |
| 236 | +}, |
| 237 | +}, |
| 238 | +}, |
| 239 | +accountId: "work", |
| 240 | +}); |
| 241 | + |
| 242 | +expect(resolved.config.agentComponents).toEqual({ |
| 243 | +enabled: true, |
| 244 | +ttlMs: 180_000, |
| 245 | +}); |
| 246 | +}); |
| 247 | +}); |
| 248 | + |
190 | 249 | describe("resolveDiscordMaxLinesPerMessage", () => { |
191 | 250 | it("falls back to merged root discord maxLinesPerMessage when runtime config omits it", () => { |
192 | 251 | const resolved = resolveDiscordMaxLinesPerMessage({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。