























@@ -911,6 +911,74 @@ describe("createFollowupRunner runtime config", () => {
911911expect(call.onUserMessagePersisted).toEqual(expect.any(Function));
912912});
913913914+it("reuses CLI session bindings for queued room-event followups", async () => {
915+const runtimeConfig: OpenClawConfig = {
916+agents: {
917+defaults: {
918+cliBackends: {
919+"claude-cli": { command: "claude" },
920+},
921+models: {
922+"anthropic/claude-opus-4-7": { agentRuntime: { id: "claude-cli" } },
923+},
924+},
925+},
926+};
927+const sessionEntry: SessionEntry = {
928+sessionId: "session-cli-room-event",
929+updatedAt: Date.now(),
930+cliSessionBindings: {
931+"claude-cli": {
932+sessionId: "cli-session-1",
933+},
934+},
935+};
936+runCliAgentMock.mockResolvedValueOnce({
937+payloads: [],
938+meta: {
939+agentMeta: {
940+provider: "claude-cli",
941+model: "claude-opus-4-7",
942+cliSessionBinding: {
943+sessionId: "cli-session-1",
944+},
945+},
946+},
947+});
948+949+const runner = createFollowupRunner({
950+typing: createMockTypingController(),
951+typingMode: "instant",
952+ sessionEntry,
953+sessionStore: { main: sessionEntry },
954+sessionKey: "main",
955+defaultModel: "anthropic/claude-opus-4-7",
956+});
957+958+await runner(
959+createQueuedRun({
960+currentInboundEventKind: "room_event",
961+currentInboundContext: { text: "[OpenClaw room event]" },
962+run: {
963+config: runtimeConfig,
964+sessionId: "session-cli-room-event",
965+provider: "anthropic",
966+model: "claude-opus-4-7",
967+suppressNextUserMessagePersistence: true,
968+sourceReplyDeliveryMode: "message_tool_only",
969+},
970+}),
971+);
972+973+expect(runEmbeddedAgentMock).not.toHaveBeenCalled();
974+expect(runCliAgentMock).toHaveBeenCalledOnce();
975+const call = requireLastMockCallArg(runCliAgentMock, "run cli agent");
976+expect(call.currentInboundEventKind).toBe("room_event");
977+expect(call.suppressNextUserMessagePersistence).toBe(true);
978+expect(call.cliSessionId).toBe("cli-session-1");
979+expect(call.cliSessionBinding).toEqual({ sessionId: "cli-session-1" });
980+});
981+914982it("passes prepared media user turns to CLI runtime dispatch", async () => {
915983const runtimeConfig: OpenClawConfig = {
916984agents: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。