mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 23:20:24 +00:00
fix(reply): prefer provider over surface for run channel fallback
This commit is contained in:
committed by
Peter Steinberger
parent
63734df3b0
commit
740bb77c8c
@@ -281,6 +281,37 @@ describe("runPreparedReply media-only handling", () => {
|
||||
expect(call?.followupRun.run.messageProvider).toBe("webchat");
|
||||
});
|
||||
|
||||
it("prefers Provider over Surface when origin channel is missing", async () => {
|
||||
await runPreparedReply(
|
||||
baseParams({
|
||||
ctx: {
|
||||
Body: "",
|
||||
RawBody: "",
|
||||
CommandBody: "",
|
||||
ThreadHistoryBody: "Earlier message in this thread",
|
||||
OriginatingChannel: undefined,
|
||||
OriginatingTo: undefined,
|
||||
Provider: "feishu",
|
||||
Surface: "webchat",
|
||||
ChatType: "group",
|
||||
},
|
||||
sessionCtx: {
|
||||
Body: "",
|
||||
BodyStripped: "",
|
||||
ThreadHistoryBody: "Earlier message in this thread",
|
||||
MediaPath: "/tmp/input.png",
|
||||
Provider: "webchat",
|
||||
ChatType: "group",
|
||||
OriginatingChannel: undefined,
|
||||
OriginatingTo: undefined,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
|
||||
expect(call?.followupRun.run.messageProvider).toBe("feishu");
|
||||
});
|
||||
|
||||
it("passes suppressTyping through typing mode resolution", async () => {
|
||||
await runPreparedReply(
|
||||
baseParams({
|
||||
|
||||
@@ -477,7 +477,10 @@ export async function runPreparedReply(
|
||||
sessionKey,
|
||||
messageProvider: resolveOriginMessageProvider({
|
||||
originatingChannel: ctx.OriginatingChannel ?? sessionCtx.OriginatingChannel,
|
||||
provider: ctx.Surface ?? ctx.Provider ?? sessionCtx.Provider,
|
||||
// Prefer Provider over Surface for fallback channel identity.
|
||||
// Surface can carry relayed metadata (for example "webchat") while Provider
|
||||
// still reflects the active channel that should own tool routing.
|
||||
provider: ctx.Provider ?? ctx.Surface ?? sessionCtx.Provider,
|
||||
}),
|
||||
agentAccountId: sessionCtx.AccountId,
|
||||
groupId: resolveGroupSessionKey(sessionCtx)?.id ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user