fix: honor googlechat account replyToMode

This commit is contained in:
Tak Hoffman 2026-04-03 10:12:32 -05:00
parent f08a1c34dd
commit 8e9607c064
No known key found for this signature in database
2 changed files with 30 additions and 1 deletions

View File

@ -321,6 +321,31 @@ describe("googlechatPlugin outbound sendMedia", () => {
});
});
describe("googlechatPlugin threading", () => {
it("honors per-account replyToMode overrides", () => {
const resolveReplyToMode = googlechatPlugin.threading?.resolveReplyToMode;
if (!resolveReplyToMode) {
throw new Error("Expected googlechatPlugin.threading.resolveReplyToMode to be defined");
}
const cfg = {
channels: {
googlechat: {
replyToMode: "all",
accounts: {
work: {
replyToMode: "first",
},
},
},
},
} as OpenClawConfig;
expect(resolveReplyToMode({ cfg, accountId: "work" })).toBe("first");
expect(resolveReplyToMode({ cfg, accountId: "default" })).toBe("all");
});
});
const resolveTarget = googlechatPlugin.outbound?.resolveTarget;
describe("googlechatPlugin outbound resolveTarget", () => {

View File

@ -343,7 +343,11 @@ export const googlechatPlugin = createChatChannelPlugin({
collectWarnings: collectGoogleChatSecurityWarnings,
},
threading: {
topLevelReplyToMode: "googlechat",
scopedAccountReplyToMode: {
resolveAccount: (cfg, accountId) => resolveGoogleChatAccount({ cfg, accountId }),
resolveReplyToMode: (account) => account.config.replyToMode,
fallback: "off",
},
},
outbound: {
base: {