mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:41:22 +00:00
fix: stop hardcoded channel fallback and auto-pick sole configured channel (#23357) (thanks @lbo728)
Co-authored-by: lbo728 <extreme0728@gmail.com>
This commit is contained in:
@@ -59,6 +59,19 @@ describe("agent delivery helpers", () => {
|
||||
expect(resolved.resolvedTo).toBe("+1999");
|
||||
});
|
||||
|
||||
it("does not inject a default deliverable channel when session has none", () => {
|
||||
const plan = resolveAgentDeliveryPlan({
|
||||
sessionEntry: undefined,
|
||||
requestedChannel: "last",
|
||||
explicitTo: undefined,
|
||||
accountId: undefined,
|
||||
wantsDelivery: true,
|
||||
});
|
||||
|
||||
expect(plan.resolvedChannel).toBe("webchat");
|
||||
expect(plan.deliveryTargetMode).toBeUndefined();
|
||||
});
|
||||
|
||||
it("skips outbound target resolution when explicit target validation is disabled", () => {
|
||||
const plan = resolveAgentDeliveryPlan({
|
||||
sessionEntry: {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ChannelOutboundTargetMode } from "../../channels/plugins/types.js";
|
||||
import { DEFAULT_CHAT_CHANNEL } from "../../channels/registry.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { SessionEntry } from "../../config/sessions.js";
|
||||
import { normalizeAccountId } from "../../utils/account-id.js";
|
||||
@@ -59,7 +58,7 @@ export function resolveAgentDeliveryPlan(params: {
|
||||
if (baseDelivery.channel && baseDelivery.channel !== INTERNAL_MESSAGE_CHANNEL) {
|
||||
return baseDelivery.channel;
|
||||
}
|
||||
return params.wantsDelivery ? DEFAULT_CHAT_CHANNEL : INTERNAL_MESSAGE_CHANNEL;
|
||||
return INTERNAL_MESSAGE_CHANNEL;
|
||||
}
|
||||
|
||||
if (isGatewayMessageChannel(requestedChannel)) {
|
||||
@@ -69,7 +68,7 @@ export function resolveAgentDeliveryPlan(params: {
|
||||
if (baseDelivery.channel && baseDelivery.channel !== INTERNAL_MESSAGE_CHANNEL) {
|
||||
return baseDelivery.channel;
|
||||
}
|
||||
return params.wantsDelivery ? DEFAULT_CHAT_CHANNEL : INTERNAL_MESSAGE_CHANNEL;
|
||||
return INTERNAL_MESSAGE_CHANNEL;
|
||||
})();
|
||||
|
||||
const deliveryTargetMode = explicitTo
|
||||
|
||||
Reference in New Issue
Block a user