fix(agents): reject bind specs with extra colon segments (#95572) · openclaw/openclaw@540ec53
ly-wang19
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,6 +33,32 @@ describe("agents bind matrix integration", () => {
|
33 | 33 | ]); |
34 | 34 | }); |
35 | 35 | |
| 36 | +it("rejects a binding spec with extra colon segments instead of silently truncating", () => { |
| 37 | +setActivePluginRegistry( |
| 38 | +createTestRegistry([{ pluginId: "matrix", plugin: matrixBindingPlugin, source: "test" }]), |
| 39 | +); |
| 40 | + |
| 41 | +const parsed = parseBindingSpecs({ agentId: "main", specs: ["matrix:work:extra"], config: {} }); |
| 42 | + |
| 43 | +expect(parsed.bindings).toEqual([]); |
| 44 | +expect(parsed.errors).toEqual([ |
| 45 | +'Invalid binding "matrix:work:extra". Account id cannot contain ":". Use <channel>:<account>, for example telegram:default.', |
| 46 | +]); |
| 47 | +}); |
| 48 | + |
| 49 | +it("still accepts a single channel:account binding", () => { |
| 50 | +setActivePluginRegistry( |
| 51 | +createTestRegistry([{ pluginId: "matrix", plugin: matrixBindingPlugin, source: "test" }]), |
| 52 | +); |
| 53 | + |
| 54 | +const parsed = parseBindingSpecs({ agentId: "main", specs: ["matrix:work"], config: {} }); |
| 55 | + |
| 56 | +expect(parsed.errors).toStrictEqual([]); |
| 57 | +expect(parsed.bindings).toEqual([ |
| 58 | +{ type: "route", agentId: "main", match: { channel: "matrix", accountId: "work" } }, |
| 59 | +]); |
| 60 | +}); |
| 61 | + |
36 | 62 | afterEach(() => { |
37 | 63 | setActivePluginRegistry(createTestRegistry()); |
38 | 64 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。