fix: route gateway history through session accessor target (#96179) · openclaw/openclaw@b08d901
jalehman
·
2026-06-24
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -97,6 +97,7 @@ export const migratedSessionAccessorFiles = new Set([
|
97 | 97 | "src/cron/service/timer.ts", |
98 | 98 | "src/gateway/session-compaction-checkpoints.ts", |
99 | 99 | "src/gateway/session-history-state.ts", |
| 100 | +"src/gateway/sessions-history-http.ts", |
100 | 101 | "src/gateway/session-utils.ts", |
101 | 102 | "src/gateway/managed-image-attachments.ts", |
102 | 103 | "src/gateway/server-methods/artifacts.ts", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,10 +24,6 @@ vi.mock("../config/config.js", () => ({
|
24 | 24 | }), |
25 | 25 | })); |
26 | 26 | |
27 | | -vi.mock("../config/sessions.js", () => ({ |
28 | | -loadSessionStore: () => ({ entries: [] }), |
29 | | -})); |
30 | | - |
31 | 27 | vi.mock("../sessions/transcript-events.js", () => ({ |
32 | 28 | onInternalSessionTranscriptUpdate: (cb: typeof transcriptUpdateHandler) => { |
33 | 29 | transcriptUpdateHandler = cb; |
@@ -83,11 +79,12 @@ vi.mock("./http-utils.js", () => ({
|
83 | 79 | })); |
84 | 80 | |
85 | 81 | vi.mock("./session-utils.js", () => ({ |
86 | | -resolveGatewaySessionStoreTarget: () => ({ |
| 82 | +resolveGatewaySessionStoreTargetWithStore: () => ({ |
87 | 83 | storePath: "/tmp", |
88 | 84 | storeKeys: ["agent:main"], |
89 | 85 | canonicalKey: "agent:main", |
90 | 86 | agentId: "main", |
| 87 | +store: {}, |
91 | 88 | }), |
92 | 89 | resolveFreshestSessionEntryFromStoreKeys: () => ({ |
93 | 90 | sessionId: "session-1", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,6 @@ import {
|
6 | 6 | normalizeOptionalString, |
7 | 7 | } from "@openclaw/normalization-core/string-coerce"; |
8 | 8 | import { getRuntimeConfig } from "../config/io.js"; |
9 | | -import { loadSessionStore } from "../config/sessions.js"; |
10 | 9 | import { createSubsystemLogger } from "../logging/subsystem.js"; |
11 | 10 | import { normalizeAgentId } from "../routing/session-key.js"; |
12 | 11 | import { onInternalSessionTranscriptUpdate } from "../sessions/transcript-events.js"; |
@@ -38,7 +37,7 @@ import {
|
38 | 37 | } from "./session-transcript-readers.js"; |
39 | 38 | import { |
40 | 39 | resolveFreshestSessionEntryFromStoreKeys, |
41 | | -resolveGatewaySessionStoreTarget, |
| 40 | +resolveGatewaySessionStoreTargetWithStore, |
42 | 41 | resolveSessionTranscriptCandidates, |
43 | 42 | } from "./session-utils.js"; |
44 | 43 | |
@@ -129,9 +128,8 @@ export async function handleSessionHistoryHttpRequest(
|
129 | 128 | } |
130 | 129 | const { cfg } = authResult; |
131 | 130 | |
132 | | -const target = resolveGatewaySessionStoreTarget({ cfg, key: sessionKey }); |
133 | | -const store = loadSessionStore(target.storePath); |
134 | | -const entry = resolveFreshestSessionEntryFromStoreKeys(store, target.storeKeys); |
| 131 | +const target = resolveGatewaySessionStoreTargetWithStore({ cfg, key: sessionKey }); |
| 132 | +const entry = resolveFreshestSessionEntryFromStoreKeys(target.store, target.storeKeys); |
135 | 133 | if (!entry?.sessionId) { |
136 | 134 | sendJson(res, 404, { |
137 | 135 | ok: false, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -47,6 +47,7 @@ describe("session accessor boundary guard", () => {
|
47 | 47 | "src/cron/service/timer.ts", |
48 | 48 | "src/gateway/session-compaction-checkpoints.ts", |
49 | 49 | "src/gateway/session-history-state.ts", |
| 50 | +"src/gateway/sessions-history-http.ts", |
50 | 51 | "src/gateway/session-utils.ts", |
51 | 52 | "src/gateway/managed-image-attachments.ts", |
52 | 53 | "src/gateway/server-methods/artifacts.ts", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。