mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
Auto-reply: preserve compacted transcript subpaths
This commit is contained in:
@@ -317,11 +317,19 @@ function resolveCompactionSessionFile(params: {
|
||||
|
||||
function canonicalizeAbsoluteSessionFilePath(filePath: string): string {
|
||||
const resolved = path.resolve(filePath);
|
||||
try {
|
||||
const parentDir = fs.realpathSync(path.dirname(resolved));
|
||||
return path.join(parentDir, path.basename(resolved));
|
||||
} catch {
|
||||
return resolved;
|
||||
const missingSegments: string[] = [];
|
||||
let cursor = resolved;
|
||||
while (true) {
|
||||
try {
|
||||
return path.join(fs.realpathSync(cursor), ...missingSegments.toReversed());
|
||||
} catch {
|
||||
const parent = path.dirname(cursor);
|
||||
if (parent === cursor) {
|
||||
return resolved;
|
||||
}
|
||||
missingSegments.push(path.basename(cursor));
|
||||
cursor = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user