mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 06:38:38 +00:00
fix(sessions): set transcriptPath to agent sessions directory (openclaw#24775) thanks @martinfrancois
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: martinfrancois <14319020+martinfrancois@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
deriveSessionKey,
|
||||
loadSessionStore,
|
||||
resolveSessionFilePath,
|
||||
resolveSessionFilePathOptions,
|
||||
resolveSessionKey,
|
||||
resolveSessionTranscriptPath,
|
||||
resolveSessionTranscriptsDir,
|
||||
@@ -598,6 +599,31 @@ describe("sessions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("resolveSessionFilePathOptions keeps explicit agentId alongside absolute store path", () => {
|
||||
const storePath = "/tmp/openclaw/agents/main/sessions/sessions.json";
|
||||
const resolved = resolveSessionFilePathOptions({
|
||||
agentId: "bot2",
|
||||
storePath,
|
||||
});
|
||||
expect(resolved?.agentId).toBe("bot2");
|
||||
expect(resolved?.sessionsDir).toBe(path.dirname(path.resolve(storePath)));
|
||||
});
|
||||
|
||||
it("resolves sibling agent absolute sessionFile using alternate agentId from options", () => {
|
||||
const stateDir = path.resolve("/home/user/.openclaw");
|
||||
withStateDir(stateDir, () => {
|
||||
const mainStorePath = path.join(stateDir, "agents", "main", "sessions", "sessions.json");
|
||||
const bot2Session = path.join(stateDir, "agents", "bot2", "sessions", "sess-1.jsonl");
|
||||
const opts = resolveSessionFilePathOptions({
|
||||
agentId: "bot2",
|
||||
storePath: mainStorePath,
|
||||
});
|
||||
|
||||
const sessionFile = resolveSessionFilePath("sess-1", { sessionFile: bot2Session }, opts);
|
||||
expect(sessionFile).toBe(bot2Session);
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to derived transcript path when sessionFile is outside agent sessions directories", () => {
|
||||
withStateDir(path.resolve("/home/user/.openclaw"), () => {
|
||||
const sessionFile = resolveSessionFilePath(
|
||||
|
||||
Reference in New Issue
Block a user