mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-20 05:07:34 +00:00
fix(doctor): include fallback channel warnings
This commit is contained in:
committed by
Peter Steinberger
parent
1831162ac1
commit
60acfd9dfe
@@ -573,4 +573,44 @@ describe("doctor preview warnings", () => {
|
||||
expect(warnings.join("\n")).not.toContain("slack");
|
||||
expect(warnings.join("\n")).not.toContain("defaults");
|
||||
});
|
||||
|
||||
it("warns for default-routed configured channels when other routes exist", () => {
|
||||
const warnings = collectChannelBoundMessageToolPolicyWarnings({
|
||||
channels: {
|
||||
discord: {},
|
||||
telegram: {},
|
||||
},
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "main",
|
||||
default: true,
|
||||
tools: {
|
||||
allow: ["read"],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "commander",
|
||||
tools: {
|
||||
profile: "messaging",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
bindings: [
|
||||
{
|
||||
agentId: "commander",
|
||||
match: {
|
||||
channel: "discord",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(warnings).toEqual([
|
||||
expect.stringContaining('Agent "main" is routed from channel "telegram"'),
|
||||
]);
|
||||
expect(warnings.join("\n")).not.toContain("commander");
|
||||
expect(warnings.join("\n")).not.toContain("discord");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -242,13 +242,18 @@ function collectBoundChannelTargets(cfg: OpenClawConfig): Array<{
|
||||
};
|
||||
|
||||
const routeBindings: AgentRouteBinding[] = listRouteBindings(cfg);
|
||||
const explicitlyBoundChannels = new Set<string>();
|
||||
for (const binding of routeBindings) {
|
||||
add(binding.agentId, binding.match.channel);
|
||||
const channel = binding.match.channel.trim();
|
||||
add(binding.agentId, channel);
|
||||
if (channel) {
|
||||
explicitlyBoundChannels.add(channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (routeBindings.length === 0) {
|
||||
const defaultAgentId = resolveDefaultAgentId(cfg);
|
||||
for (const channel of listConfiguredChannelIds(cfg)) {
|
||||
const defaultAgentId = resolveDefaultAgentId(cfg);
|
||||
for (const channel of listConfiguredChannelIds(cfg)) {
|
||||
if (!explicitlyBoundChannels.has(channel)) {
|
||||
add(defaultAgentId, channel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user