mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-18 04:01:03 +00:00
fix(doctor): match route channel coverage to runtime
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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<string>();
|
||||
const coveredAccountsByChannel = new Map<string, Set<string>>();
|
||||
for (const binding of routeBindings) {
|
||||
const channel = normalizeChannelKey(binding.match.channel);
|
||||
const channel = normalizeRouteBindingChannelKey(binding.match.channel);
|
||||
add(binding.agentId, channel);
|
||||
if (!channel) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user