mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:04:33 +00:00
fix: preserve inter-session input provenance (thanks @anbecker)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
getFreePort,
|
||||
installGatewayTestHooks,
|
||||
startGatewayServer,
|
||||
testState,
|
||||
} from "./test-helpers.js";
|
||||
|
||||
installGatewayTestHooks({ scope: "suite" });
|
||||
@@ -17,13 +18,15 @@ let server: Awaited<ReturnType<typeof startGatewayServer>>;
|
||||
let gatewayPort: number;
|
||||
let prevGatewayPort: string | undefined;
|
||||
let prevGatewayToken: string | undefined;
|
||||
const gatewayToken = "test-token";
|
||||
|
||||
beforeAll(async () => {
|
||||
prevGatewayPort = process.env.OPENCLAW_GATEWAY_PORT;
|
||||
prevGatewayToken = process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
gatewayPort = await getFreePort();
|
||||
testState.gatewayAuth = { mode: "token", token: gatewayToken };
|
||||
process.env.OPENCLAW_GATEWAY_PORT = String(gatewayPort);
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = "test-token";
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = gatewayToken;
|
||||
server = await startGatewayServer(gatewayPort);
|
||||
});
|
||||
|
||||
@@ -105,8 +108,14 @@ describe("sessions_send gateway loopback", () => {
|
||||
expect(details.reply).toBe("pong");
|
||||
expect(details.sessionKey).toBe("main");
|
||||
|
||||
const firstCall = spy.mock.calls[0]?.[0] as { lane?: string } | undefined;
|
||||
const firstCall = spy.mock.calls[0]?.[0] as
|
||||
| { lane?: string; inputProvenance?: { kind?: string; sourceTool?: string } }
|
||||
| undefined;
|
||||
expect(firstCall?.lane).toBe("nested");
|
||||
expect(firstCall?.inputProvenance).toMatchObject({
|
||||
kind: "inter_session",
|
||||
sourceTool: "sessions_send",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user