diff --git a/src/commands/doctor/shared/preview-warnings.test.ts b/src/commands/doctor/shared/preview-warnings.test.ts index 9d01174b587..20937a00b6d 100644 --- a/src/commands/doctor/shared/preview-warnings.test.ts +++ b/src/commands/doctor/shared/preview-warnings.test.ts @@ -743,6 +743,45 @@ describe("doctor preview warnings", () => { expect(warnings).toStrictEqual([]); }); + it("does not treat channel aliases as route coverage when runtime would not match them", () => { + const warnings = collectChannelBoundMessageToolPolicyWarnings({ + channels: { + imessage: {}, + }, + agents: { + list: [ + { + id: "main", + default: true, + tools: { + allow: ["read"], + }, + }, + { + id: "ios-agent", + tools: { + profile: "messaging", + }, + }, + ], + }, + bindings: [ + { + agentId: "ios-agent", + match: { + channel: "imsg", + }, + }, + ], + }); + + expect(warnings).toEqual([ + expect.stringContaining('Agent "main" is routed from channel "imessage"'), + ]); + expect(warnings.join("\n")).not.toContain("ios-agent"); + expect(warnings.join("\n")).not.toContain("imsg"); + }); + it("warns for the default agent when configured account routes are incomplete", () => { const warnings = collectChannelBoundMessageToolPolicyWarnings({ channels: { diff --git a/src/commands/doctor/shared/preview-warnings.ts b/src/commands/doctor/shared/preview-warnings.ts index 92b96b24100..b16f498d213 100644 --- a/src/commands/doctor/shared/preview-warnings.ts +++ b/src/commands/doctor/shared/preview-warnings.ts @@ -43,6 +43,10 @@ function normalizeChannelKey(raw?: string | null): string { return normalizeChatChannelId(raw) ?? normalizeLowercaseStringOrEmpty(raw); } +function normalizeRouteBindingChannelKey(raw?: string | null): string { + return normalizeLowercaseStringOrEmpty(raw); +} + function listConfiguredChannelIds(cfg: OpenClawConfig): string[] { if (!hasRecord(cfg.channels)) { return []; @@ -295,7 +299,7 @@ function collectBoundChannelTargets(cfg: OpenClawConfig): Array<{ const fullyCoveredChannels = new Set(); const coveredAccountsByChannel = new Map>(); for (const binding of routeBindings) { - const channel = normalizeChannelKey(binding.match.channel); + const channel = normalizeRouteBindingChannelKey(binding.match.channel); add(binding.agentId, channel); if (!channel) { continue;