Skip to content

The agent that grows with you

fix(desktop): keep an explicit project cwd through config.get normalization

Bergmann893d3a268761cd
diff --git a/apps/desktop/src/app/session/workspace-session-target.test.ts b/apps/desktop/src/app/session/workspace-session-target.test.ts
index 0fc0cd911d6..4f562e135c8 100644
--- a/apps/desktop/src/app/session/workspace-session-target.test.ts
+++ b/apps/desktop/src/app/session/workspace-session-target.test.ts
@@ -74,8 +74,10 @@ describe('startWorkspaceSession', () => {
await second.promise
await Promise.resolve()
- expect($newChatWorkspaceTarget.get()).toBe('/normalized-b')
- expect($currentCwd.get()).toBe('/normalized-b')
+ // The explicitly chosen path is authoritative over the server-normalized cwd (a remote/ssh project
+ // dir is dropped to the launch cwd by host-side normalization); only the branch is adopted from the probe.
+ expect($newChatWorkspaceTarget.get()).toBe('/workspace-b')
+ expect($currentCwd.get()).toBe('/workspace-b')
expect($currentBranch.get()).toBe('main')
})
diff --git a/apps/desktop/src/app/session/workspace-session-target.ts b/apps/desktop/src/app/session/workspace-session-target.ts
index fb0dae15915..eb8b0b8e72c 100644
--- a/apps/desktop/src/app/session/workspace-session-target.ts
+++ b/apps/desktop/src/app/session/workspace-session-target.ts
@@ -67,7 +67,11 @@ export function startWorkspaceSession({
return
}
- const resolved = info.cwd || target
+ // An explicitly chosen project path is authoritative (like the backend's explicit_cwd): a remote/ssh
+ // project dir does not exist on the gateway host, so config.get's host-side normalization drops it to
+ // the launch cwd (/opt/hermes). Keep the user's path; only adopt the server cwd for the path-less
+ // fallback. Branch still comes from the probe.
+ const resolved = explicitTarget || info.cwd || target
setCurrentCwd(resolved)
setNewChatWorkspaceTarget(resolved)