From 7357c26c00cbcdf012131d2202ee20964fd78b4b Mon Sep 17 00:00:00 2001 From: Nicholas Tindle Date: Wed, 28 Jan 2026 03:28:48 -0600 Subject: [PATCH] fix(workspace): add trailing slash to session path prefix Prevents session path prefix collisions where "/sessions/abc" could incorrectly match "/sessions/abc123" when using startswith filtering. Now uses "/sessions/abc/" to ensure exact session boundary matching. Co-Authored-By: Claude Opus 4.5 --- autogpt_platform/backend/backend/util/workspace.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autogpt_platform/backend/backend/util/workspace.py b/autogpt_platform/backend/backend/util/workspace.py index 4610117bc4..d345e41ed1 100644 --- a/autogpt_platform/backend/backend/util/workspace.py +++ b/autogpt_platform/backend/backend/util/workspace.py @@ -102,8 +102,9 @@ class WorkspaceManager: # Resolve the provided path with session scoping return self._resolve_path(path) elif self.session_path: - # Default to session folder - return self.session_path + # Default to session folder with trailing slash to prevent prefix collisions + # e.g., "/sessions/abc" should not match "/sessions/abc123" + return self.session_path.rstrip("/") + "/" else: # No session context, use path as-is return path