Skip to content

Commit 5731225

Browse files
committed
Use named workspace paths for all user-facing operations
Agent bash calls and UI bash execute should use the friendly named workspace path (symlink or legacy dir name), not the internal stable ID path. This matches what users see in the UI. Backwards compatible: legacy workspaces have no symlinks, so the named path IS the actual directory path.
1 parent 8d67e9a commit 5731225

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/services/aiService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,10 @@ export class AIService extends EventEmitter {
522522
if (!workspace) {
523523
return Err({ type: "unknown", raw: `Workspace ${workspaceId} not found in config` });
524524
}
525-
const workspacePath = workspace.workspacePath;
525+
526+
// Use named workspace path (symlink) for user-facing operations
527+
// Agent commands should run in the path users see in the UI
528+
const workspacePath = this.config.getWorkspaceSymlinkPath(metadata.projectPath, metadata.name);
526529

527530
// Build system message from workspace metadata
528531
const systemMessage = await buildSystemMessage(

src/services/ipcMain.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,10 @@ export class IpcMain {
598598
if (!workspace) {
599599
return Err(`Workspace ${workspaceId} not found in config`);
600600
}
601-
const workspacePath = workspace.workspacePath;
601+
602+
// Use named workspace path (symlink) for user-facing operations
603+
// Users see the friendly name in the UI, so commands should run in that path
604+
const namedPath = this.config.getWorkspaceSymlinkPath(metadata.projectPath, metadata.name);
602605

603606
// Load project secrets
604607
const projectSecrets = this.config.getProjectSecrets(metadata.projectPath);
@@ -609,7 +612,7 @@ export class IpcMain {
609612
// Create bash tool with workspace's cwd and secrets
610613
// All IPC bash calls are from UI (background operations) - use truncate to avoid temp file spam
611614
const bashTool = createBashTool({
612-
cwd: workspacePath,
615+
cwd: namedPath,
613616
secrets: secretsToRecord(projectSecrets),
614617
niceness: options?.niceness,
615618
tempDir: tempDir.path,

src/utils/commands/sources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function buildCoreSources(p: BuildSourcesParams): Array<() => CommandActi
154154
}
155155

156156
// Remove current workspace (rename action intentionally omitted until we add a proper modal)
157-
if (selected) {
157+
if (selected && selected.namedWorkspacePath) {
158158
const workspaceDisplayName = `${selected.projectName}/${selected.namedWorkspacePath.split("/").pop() ?? selected.namedWorkspacePath}`;
159159
list.push({
160160
id: "ws:open-terminal-current",

0 commit comments

Comments
 (0)