fix(cli): isolate gateway model run sessions · openclaw/openclaw@0fd152b
Kaspre
·
2026-05-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -925,7 +925,10 @@ describe("capability cli", () => {
|
925 | 925 | }); |
926 | 926 | |
927 | 927 | const gatewayCall = firstGatewayCall(); |
| 928 | +const sessionId = String(gatewayCall?.params?.sessionId ?? ""); |
928 | 929 | expect(gatewayCall?.method).toBe("agent"); |
| 930 | +expect(sessionId).toEqual(expect.stringMatching(/^model-run-[0-9a-f-]{36}$/)); |
| 931 | +expect(gatewayCall?.params?.sessionKey).toBe(`agent:main:explicit:${sessionId}`); |
929 | 932 | expect(gatewayCall?.params?.cleanupBundleMcpOnRunEnd).toBe(true); |
930 | 933 | expect(gatewayCall?.params?.modelRun).toBe(true); |
931 | 934 | expect(gatewayCall?.params?.promptMode).toBe("none"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { randomUUID } from "node:crypto"; |
1 | 2 | import { createWriteStream } from "node:fs"; |
2 | 3 | import fs from "node:fs/promises"; |
3 | 4 | import path from "node:path"; |
@@ -10,6 +11,7 @@ import {
|
10 | 11 | loadAuthProfileStoreForRuntime, |
11 | 12 | } from "../agents/auth-profiles.js"; |
12 | 13 | import { updateAuthProfileStoreWithLock } from "../agents/auth-profiles/store.js"; |
| 14 | +import { buildExplicitSessionIdSessionKey } from "../agents/command/session.js"; |
13 | 15 | import { DEFAULT_PROVIDER } from "../agents/defaults.js"; |
14 | 16 | import { resolveMemorySearchConfig } from "../agents/memory-search.js"; |
15 | 17 | import { loadModelCatalog } from "../agents/model-catalog.js"; |
@@ -846,6 +848,8 @@ async function runModelRun(params: {
|
846 | 848 | // Provider/model overrides require trusted-operator scope. Use the backend |
847 | 849 | // shared-secret lane so local gateway smokes do not depend on paired CLI device scopes. |
848 | 850 | const hasModelOverride = Boolean(provider || model); |
| 851 | +const sessionId = `model-run-${randomUUID()}`; |
| 852 | +const sessionKey = buildExplicitSessionIdSessionKey({ agentId, sessionId }); |
849 | 853 | const response: { |
850 | 854 | result?: { |
851 | 855 | payloads?: Array<{ text?: string; mediaUrl?: string | null; mediaUrls?: string[] }>; |
@@ -861,6 +865,8 @@ async function runModelRun(params: {
|
861 | 865 | method: "agent", |
862 | 866 | params: { |
863 | 867 | agentId, |
| 868 | + sessionId, |
| 869 | + sessionKey, |
864 | 870 | message: params.prompt, |
865 | 871 | attachments: |
866 | 872 | imageFiles.length > 0 |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。