mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix: route gateway history through session accessor target (#96179)
This commit is contained in:
@@ -97,6 +97,7 @@ export const migratedSessionAccessorFiles = new Set([
|
||||
"src/cron/service/timer.ts",
|
||||
"src/gateway/session-compaction-checkpoints.ts",
|
||||
"src/gateway/session-history-state.ts",
|
||||
"src/gateway/sessions-history-http.ts",
|
||||
"src/gateway/session-utils.ts",
|
||||
"src/gateway/managed-image-attachments.ts",
|
||||
"src/gateway/server-methods/artifacts.ts",
|
||||
|
||||
@@ -24,10 +24,6 @@ vi.mock("../config/config.js", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../config/sessions.js", () => ({
|
||||
loadSessionStore: () => ({ entries: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("../sessions/transcript-events.js", () => ({
|
||||
onInternalSessionTranscriptUpdate: (cb: typeof transcriptUpdateHandler) => {
|
||||
transcriptUpdateHandler = cb;
|
||||
@@ -83,11 +79,12 @@ vi.mock("./http-utils.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("./session-utils.js", () => ({
|
||||
resolveGatewaySessionStoreTarget: () => ({
|
||||
resolveGatewaySessionStoreTargetWithStore: () => ({
|
||||
storePath: "/tmp",
|
||||
storeKeys: ["agent:main"],
|
||||
canonicalKey: "agent:main",
|
||||
agentId: "main",
|
||||
store: {},
|
||||
}),
|
||||
resolveFreshestSessionEntryFromStoreKeys: () => ({
|
||||
sessionId: "session-1",
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
normalizeOptionalString,
|
||||
} from "@openclaw/normalization-core/string-coerce";
|
||||
import { getRuntimeConfig } from "../config/io.js";
|
||||
import { loadSessionStore } from "../config/sessions.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { normalizeAgentId } from "../routing/session-key.js";
|
||||
import { onInternalSessionTranscriptUpdate } from "../sessions/transcript-events.js";
|
||||
@@ -38,7 +37,7 @@ import {
|
||||
} from "./session-transcript-readers.js";
|
||||
import {
|
||||
resolveFreshestSessionEntryFromStoreKeys,
|
||||
resolveGatewaySessionStoreTarget,
|
||||
resolveGatewaySessionStoreTargetWithStore,
|
||||
resolveSessionTranscriptCandidates,
|
||||
} from "./session-utils.js";
|
||||
|
||||
@@ -129,9 +128,8 @@ export async function handleSessionHistoryHttpRequest(
|
||||
}
|
||||
const { cfg } = authResult;
|
||||
|
||||
const target = resolveGatewaySessionStoreTarget({ cfg, key: sessionKey });
|
||||
const store = loadSessionStore(target.storePath);
|
||||
const entry = resolveFreshestSessionEntryFromStoreKeys(store, target.storeKeys);
|
||||
const target = resolveGatewaySessionStoreTargetWithStore({ cfg, key: sessionKey });
|
||||
const entry = resolveFreshestSessionEntryFromStoreKeys(target.store, target.storeKeys);
|
||||
if (!entry?.sessionId) {
|
||||
sendJson(res, 404, {
|
||||
ok: false,
|
||||
|
||||
@@ -47,6 +47,7 @@ describe("session accessor boundary guard", () => {
|
||||
"src/cron/service/timer.ts",
|
||||
"src/gateway/session-compaction-checkpoints.ts",
|
||||
"src/gateway/session-history-state.ts",
|
||||
"src/gateway/sessions-history-http.ts",
|
||||
"src/gateway/session-utils.ts",
|
||||
"src/gateway/managed-image-attachments.ts",
|
||||
"src/gateway/server-methods/artifacts.ts",
|
||||
|
||||
Reference in New Issue
Block a user