fix(sessions): always compute session paths from current environment
Remove trust in stored absolute paths in sessions.json. When migrating Moltbot to a different user or home directory, the stored sessionFile paths would still point to the old user's directories, causing EACCES permission errors. Now resolveSessionFilePath() always computes paths fresh from the current HOME environment variable rather than using cached paths. Fixes user migration scenarios where sessions.json contains paths like /home/olduser/.clawdbot/... but the service runs as a different user.
This commit is contained in:
parent
93c2d65398
commit
47e9374226
@ -54,8 +54,10 @@ export function resolveSessionFilePath(
|
||||
entry?: SessionEntry,
|
||||
opts?: { agentId?: string },
|
||||
): string {
|
||||
const candidate = entry?.sessionFile?.trim();
|
||||
return candidate ? candidate : resolveSessionTranscriptPath(sessionId, opts?.agentId);
|
||||
// Always compute path from current environment rather than trusting stored paths.
|
||||
// Stored absolute paths in sessions.json break when migrating to a different user
|
||||
// or home directory, causing EACCES errors when accessing the old user's paths.
|
||||
return resolveSessionTranscriptPath(sessionId, opts?.agentId);
|
||||
}
|
||||
|
||||
export function resolveStorePath(store?: string, opts?: { agentId?: string }) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user