mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:34:59 +00:00
fix(agent): forward resolved outbound session context for delivery
This commit is contained in:
@@ -48,6 +48,7 @@ describe("deliverAgentCommandResult", () => {
|
||||
|
||||
async function runDelivery(params: {
|
||||
opts: Record<string, unknown>;
|
||||
outboundSession?: { key?: string; agentId?: string };
|
||||
sessionEntry?: SessionEntry;
|
||||
runtime?: RuntimeEnv;
|
||||
resultText?: string;
|
||||
@@ -62,6 +63,7 @@ describe("deliverAgentCommandResult", () => {
|
||||
deps,
|
||||
runtime,
|
||||
opts: params.opts as never,
|
||||
outboundSession: params.outboundSession,
|
||||
sessionEntry: params.sessionEntry,
|
||||
result,
|
||||
payloads: result.payloads,
|
||||
@@ -234,6 +236,30 @@ describe("deliverAgentCommandResult", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("uses caller-provided outbound session context when opts.sessionKey is absent", async () => {
|
||||
await runDelivery({
|
||||
opts: {
|
||||
message: "hello",
|
||||
deliver: true,
|
||||
channel: "whatsapp",
|
||||
to: "+15551234567",
|
||||
},
|
||||
outboundSession: {
|
||||
key: "agent:exec:hook:gmail:thread-1",
|
||||
agentId: "exec",
|
||||
},
|
||||
});
|
||||
|
||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
session: expect.objectContaining({
|
||||
key: "agent:exec:hook:gmail:thread-1",
|
||||
agentId: "exec",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("prefixes nested agent outputs with context", async () => {
|
||||
const runtime = createRuntime();
|
||||
await runDelivery({
|
||||
|
||||
Reference in New Issue
Block a user