fix(doctor): match route channel coverage to runtime · openclaw/openclaw@63ba3cd
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
File tree
src/commands/doctor/shared
| Original file line number | Diff line number | Diff line change |
|---|
@@ -743,6 +743,45 @@ describe("doctor preview warnings", () => {
|
743 | 743 | expect(warnings).toStrictEqual([]); |
744 | 744 | }); |
745 | 745 | |
| 746 | +it("does not treat channel aliases as route coverage when runtime would not match them", () => { |
| 747 | +const warnings = collectChannelBoundMessageToolPolicyWarnings({ |
| 748 | +channels: { |
| 749 | +imessage: {}, |
| 750 | +}, |
| 751 | +agents: { |
| 752 | +list: [ |
| 753 | +{ |
| 754 | +id: "main", |
| 755 | +default: true, |
| 756 | +tools: { |
| 757 | +allow: ["read"], |
| 758 | +}, |
| 759 | +}, |
| 760 | +{ |
| 761 | +id: "ios-agent", |
| 762 | +tools: { |
| 763 | +profile: "messaging", |
| 764 | +}, |
| 765 | +}, |
| 766 | +], |
| 767 | +}, |
| 768 | +bindings: [ |
| 769 | +{ |
| 770 | +agentId: "ios-agent", |
| 771 | +match: { |
| 772 | +channel: "imsg", |
| 773 | +}, |
| 774 | +}, |
| 775 | +], |
| 776 | +}); |
| 777 | + |
| 778 | +expect(warnings).toEqual([ |
| 779 | +expect.stringContaining('Agent "main" is routed from channel "imessage"'), |
| 780 | +]); |
| 781 | +expect(warnings.join("\n")).not.toContain("ios-agent"); |
| 782 | +expect(warnings.join("\n")).not.toContain("imsg"); |
| 783 | +}); |
| 784 | + |
746 | 785 | it("warns for the default agent when configured account routes are incomplete", () => { |
747 | 786 | const warnings = collectChannelBoundMessageToolPolicyWarnings({ |
748 | 787 | channels: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -43,6 +43,10 @@ function normalizeChannelKey(raw?: string | null): string {
|
43 | 43 | return normalizeChatChannelId(raw) ?? normalizeLowercaseStringOrEmpty(raw); |
44 | 44 | } |
45 | 45 | |
| 46 | +function normalizeRouteBindingChannelKey(raw?: string | null): string { |
| 47 | +return normalizeLowercaseStringOrEmpty(raw); |
| 48 | +} |
| 49 | + |
46 | 50 | function listConfiguredChannelIds(cfg: OpenClawConfig): string[] { |
47 | 51 | if (!hasRecord(cfg.channels)) { |
48 | 52 | return []; |
@@ -295,7 +299,7 @@ function collectBoundChannelTargets(cfg: OpenClawConfig): Array<{
|
295 | 299 | const fullyCoveredChannels = new Set<string>(); |
296 | 300 | const coveredAccountsByChannel = new Map<string, Set<string>>(); |
297 | 301 | for (const binding of routeBindings) { |
298 | | -const channel = normalizeChannelKey(binding.match.channel); |
| 302 | +const channel = normalizeRouteBindingChannelKey(binding.match.channel); |
299 | 303 | add(binding.agentId, channel); |
300 | 304 | if (!channel) { |
301 | 305 | continue; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。