fix(doctor): respect route account coverage · openclaw/openclaw@7382bdf
stainlu
·
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 |
|---|
@@ -608,10 +608,9 @@ describe("doctor preview warnings", () => {
|
608 | 608 | }); |
609 | 609 | |
610 | 610 | expect(warnings).toEqual([ |
611 | | -expect.stringContaining('Agent "main" is routed from channel "telegram"'), |
| 611 | +expect.stringContaining('Agent "main" is routed from channel "discord" and "telegram"'), |
612 | 612 | ]); |
613 | 613 | expect(warnings.join("\n")).not.toContain("commander"); |
614 | | -expect(warnings.join("\n")).not.toContain("discord"); |
615 | 614 | }); |
616 | 615 | |
617 | 616 | it("warns for default-routed traffic when a channel only has scoped routes", () => { |
@@ -652,4 +651,40 @@ describe("doctor preview warnings", () => {
|
652 | 651 | ]); |
653 | 652 | expect(warnings.join("\n")).not.toContain("commander"); |
654 | 653 | }); |
| 654 | + |
| 655 | +it("skips the default-agent warning when a wildcard account route covers the channel", () => { |
| 656 | +const warnings = collectChannelBoundMessageToolPolicyWarnings({ |
| 657 | +channels: { |
| 658 | +discord: {}, |
| 659 | +}, |
| 660 | +agents: { |
| 661 | +list: [ |
| 662 | +{ |
| 663 | +id: "main", |
| 664 | +default: true, |
| 665 | +tools: { |
| 666 | +allow: ["read"], |
| 667 | +}, |
| 668 | +}, |
| 669 | +{ |
| 670 | +id: "commander", |
| 671 | +tools: { |
| 672 | +profile: "messaging", |
| 673 | +}, |
| 674 | +}, |
| 675 | +], |
| 676 | +}, |
| 677 | +bindings: [ |
| 678 | +{ |
| 679 | +agentId: "commander", |
| 680 | +match: { |
| 681 | +channel: "discord", |
| 682 | +accountId: "*", |
| 683 | +}, |
| 684 | +}, |
| 685 | +], |
| 686 | +}); |
| 687 | + |
| 688 | +expect(warnings).toStrictEqual([]); |
| 689 | +}); |
655 | 690 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -225,9 +225,8 @@ function formatChannelList(channels: string[]): string {
|
225 | 225 | function isUnscopedChannelRouteBinding(binding: AgentRouteBinding): boolean { |
226 | 226 | const match = binding.match; |
227 | 227 | const accountId = match.accountId?.trim(); |
228 | | -const hasScopedAccount = Boolean(accountId && accountId !== "*"); |
229 | 228 | const hasRoles = Array.isArray(match.roles) && match.roles.length > 0; |
230 | | -return !hasScopedAccount && !match.peer && !match.guildId && !match.teamId && !hasRoles; |
| 229 | +return accountId === "*" && !match.peer && !match.guildId && !match.teamId && !hasRoles; |
231 | 230 | } |
232 | 231 | |
233 | 232 | function collectBoundChannelTargets(cfg: OpenClawConfig): Array<{ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。