fix: prevent sessions_spawn from creating directories with error messages#47
Open
newtontech wants to merge 1 commit intomainfrom
Open
fix: prevent sessions_spawn from creating directories with error messages#47newtontech wants to merge 1 commit intomainfrom
newtontech wants to merge 1 commit intomainfrom
Conversation
…ages When sessions_spawn is called with an invalid agent ID, the error message was being used as a directory path, creating ghost directories in the workspace root. This fix ensures validation happens before any directory creation, preventing filesystem artifacts on error. The fix modifies resolveAgentWorkspaceDir to validate the agentId against the list of configured agents before creating a workspace directory. If the agentId is not configured, it falls back to the default agent ID. Fixes openclaw#31311
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a bug where sessions_spawn would create workspace directories using error message strings as paths when called with invalid agent IDs.
Changes
resolveAgentWorkspaceDirto validate the agentId against the list of configured agents before creating a workspace directoryTesting
Root Cause
When
sessions_spawnwas called with a non-existent agent ID, theresolveAgentWorkspaceDirfunction would normalize the agentId (which could be an error message) and use it to create a workspace directory. This resulted in "ghost directories" being created with names likeacp-target-agent-is-not-configured-pass-agentid-in-sessions-spawn-or-set-acp-defaultagent-in-config.Fix
The fix adds validation to check if the agentId is a configured agent before creating a workspace directory. If not, it falls back to the default agent ID, preventing the creation of directories with error messages as names.
Fixes openclaw#31311