mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:22:45 +00:00
fix(sessions): allow cross-agent session file paths in multi-agent setups
When OPENCLAW_STATE_DIR changes between session creation and resolution (e.g., after reinstall or config change), absolute session file paths pointing to other agents' sessions directories were rejected even though they structurally match the valid .../agents/<agentId>/sessions/... pattern. The existing fallback logic in resolvePathWithinSessionsDir extracts the agent ID from the path and tries to resolve it via the current env's state directory. When those directories differ, the containment check fails. Now, if the path structurally matches the agent sessions pattern (validated by extractAgentIdFromAbsoluteSessionPath), we accept it directly as a final fallback. Fixes #15410, Fixes #15565, Fixes #15468
This commit is contained in:
committed by
Peter Steinberger
parent
e20b87f1ba
commit
90774c098a
@@ -152,6 +152,11 @@ function resolvePathWithinSessionsDir(
|
||||
if (resolvedFromPath) {
|
||||
return resolvedFromPath;
|
||||
}
|
||||
// The path structurally matches .../agents/<agentId>/sessions/...
|
||||
// Accept it even if the root directory differs from the current env
|
||||
// (e.g., OPENCLAW_STATE_DIR changed between session creation and resolution).
|
||||
// The structural pattern provides sufficient containment guarantees.
|
||||
return path.resolve(trimmed);
|
||||
}
|
||||
}
|
||||
if (!normalized || normalized.startsWith("..") || path.isAbsolute(normalized)) {
|
||||
|
||||
Reference in New Issue
Block a user