fix: honor followup default account

This commit is contained in:
Tak Hoffman 2026-04-03 16:53:38 -05:00
parent 6ddc86a3d1
commit da68fa4079
No known key found for this signature in database
2 changed files with 32 additions and 1 deletions

View File

@ -360,6 +360,37 @@ describe("runPreparedReply media-only handling", () => {
expect(call?.followupRun.run.messageProvider).toBe("feishu");
});
it("uses the effective session account for followup originatingAccountId when AccountId is omitted", async () => {
await runPreparedReply(
baseParams({
ctx: {
Body: "",
RawBody: "",
CommandBody: "",
ThreadHistoryBody: "Earlier message in this thread",
OriginatingChannel: "discord",
OriginatingTo: "channel:24680",
ChatType: "group",
AccountId: undefined,
},
sessionCtx: {
Body: "",
BodyStripped: "",
ThreadHistoryBody: "Earlier message in this thread",
MediaPath: "/tmp/input.png",
Provider: "discord",
ChatType: "group",
OriginatingChannel: "discord",
OriginatingTo: "channel:24680",
AccountId: "work",
},
}),
);
const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
expect(call?.followupRun.originatingAccountId).toBe("work");
});
it("passes suppressTyping through typing mode resolution", async () => {
await runPreparedReply(
baseParams({

View File

@ -526,7 +526,7 @@ export async function runPreparedReply(
// Originating channel for reply routing.
originatingChannel: ctx.OriginatingChannel,
originatingTo: ctx.OriginatingTo,
originatingAccountId: ctx.AccountId,
originatingAccountId: sessionCtx.AccountId,
originatingThreadId: ctx.MessageThreadId,
originatingChatType: ctx.ChatType,
run: {