Problem
currentWorkspaceFolder() in settings.service.ts always returns vscode.workspace.workspaceFolders?.[0]?.uri.fsPath. In a multi-root workspace this silently pins every pycodeloop serve invocation — and every file-tool jail — to the first folder in the list, regardless of which file the user is editing.
This matters for:
- The
cwd passed to RpcClient (and therefore to the spawned process).
- The
workspace jail that limits read_file/write_file/etc. to one root.
resolveWorkspacePath(), which expands ${workspaceFolder} to the same fixed path.
Steps to reproduce / context
- Open a multi-root workspace with folders
[frontend, backend].
- Open the CodeLoop sidebar.
- Ask the agent to read a file in
backend/.
- The agent's working directory is
frontend/ and ${workspaceFolder} resolves to frontend/, causing path-not-found errors or the agent reading the wrong tree.
Expected behavior
The extension should either:
- Follow the active editor's workspace folder (via
vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor?.document.uri)), or
- Expose a command / status-bar picker to let the user select the active root, similar to how the Python extension lets you select the interpreter per-folder.
The chosen root should be re-evaluated (or at least re-queried) each time ensureClient() spawns a new process.
Problem
currentWorkspaceFolder()insettings.service.tsalways returnsvscode.workspace.workspaceFolders?.[0]?.uri.fsPath. In a multi-root workspace this silently pins everypycodeloop serveinvocation — and every file-tool jail — to the first folder in the list, regardless of which file the user is editing.This matters for:
cwdpassed toRpcClient(and therefore to the spawned process).workspacejail that limitsread_file/write_file/etc. to one root.resolveWorkspacePath(), which expands${workspaceFolder}to the same fixed path.Steps to reproduce / context
[frontend, backend].backend/.frontend/and${workspaceFolder}resolves tofrontend/, causing path-not-found errors or the agent reading the wrong tree.Expected behavior
The extension should either:
vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor?.document.uri)), orThe chosen root should be re-evaluated (or at least re-queried) each time
ensureClient()spawns a new process.