[GH-ISSUE #3754] [GUI] an existing chat does not restore its sidebar workspace after restart (must re-select it to continue) #1577

Closed
opened 2026-11-04 01:52:22 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3754

Area

[GUI] (the desktop app)

Desktop app, Terminal or source?

Desktop app (Windows)

What happened

After restarting the desktop app, a chat does not return to the workspace it was created in. The sidebar is back on the first/default workspace, and opening the chat only selects the conversation; it does not restore the chat's workspace. The next message is sent with the first workspace, so the agent runs in the wrong folder. The user has to click the original workspace in the sidebar again before the chat works there.

The chat is still listed under its old workspace in the sidebar (grouping uses the saved path), but the active/highlighted workspace is the first one. That makes the wrong-folder turn easy to miss.

This is more than the file tree. If the chat already had an agent session, the cwd mismatch makes the host drop the saved Harness session and create a new one in the wrong folder; the new session only gets the last 12 messages. If the user sends once before re-selecting the workspace, the saved session mapping is already deleted, so re-selecting afterwards still starts a new session and only replays those 12 messages. That is why the chat looks like it cannot continue the previous work.

The code path (0.2.2 source at 011c9e6):

  • Session.workspace is saved as a path when a chat is created (apps/host/src/lib/store.ts:1027) and is used only for sidebar grouping (apps/host/src/app/Sidebar.tsx:89).
  • activeWorkspace starts as null (store.ts:251), is not in savePrefs() (store.ts:440-459), and bootstrap() falls back to workspaces[0] (store.ts:723).
  • selectSession() only sets activeSession (store.ts:1084-1087); Chat.tsx:54-73 does not restore the workspace either.
  • The chat request always sends workspaceId: state.activeWorkspace (store.ts:1660).
  • The host resolves the turn cwd with chatFolders.get(chatId) ?? workspaceId path ?? WORKSPACE (apps/host/server/index.mjs:579). It does not use agent.workingFolder(chatId), although the file routes do (index.mjs:488).
  • On a cwd change, apps/host/server/agent/agent-bridge.mjs:286 deletes the chat's session mapping and creates a new session in the new cwd; :796 only carries the earlier conversation for a fresh session, and withEarlierConversation keeps the last 12 messages (:1234-1240).

The per-chat "Select a folder" chip is a separate mechanism and does survive a restart: it writes chat-folders.json (apps/host/server/chat-files.mjs:35-57) and wins at index.mjs:579. A chat created under a sidebar workspace has no such entry; only Session.workspace records the path, and that path is never mapped back to a workspace id or sent to the host.

Expected: reopening a chat restores the workspace it belongs to (or the turn uses that chat's saved workspace), so the next message runs in the same folder and the agent session continues without re-selecting. The file tree and the agent should agree.

Possible fix:

  1. In selectSession(), map session.workspace (including Workspace.aliases) to a workspace id and set activeWorkspace.
  2. In sendMessage(), use the session's saved workspace/chat folder instead of the global activeWorkspace.
  3. In index.mjs:579, add agent.workingFolder(chatId) as a fallback before the global workspace/default, as the file routes do.
  4. Persist the last active workspace for new/empty chats, but prefer the opened chat's workspace.

Smallest steps or command that reproduce it

  1. Add a second workspace in the sidebar (Workspaces -> Add a workspace folder), for example D:\Project.
  2. Click that workspace, create a chat, and send a message so the agent works in D:\Project.
  3. Restart Strata completely.
  4. Reopen the same chat from the chat list or command palette without clicking the D:\Project workspace header.
  5. Send a message. The chat does not run in D:\Project; the first/default workspace is active, and the agent session is recreated there. Clicking D:\Project in the sidebar makes the next turn use that folder again (but the earlier session mapping is already gone if step 5 ran).

Expected: the chat continues in D:\Project after the restart without re-selecting the workspace.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.2 · engine 0.1.47

Graphics card, memory and system

RTX 3080 Ti Laptop 16 GB · 64 GB RAM · Windows 11 (10.0.26300)

Model, size and settings

Swift 1.5 IQ3_XXS · 524288 max context (the workspace binding is model-independent)

Logs

No engine crash. This is the GUI/host workspace state. Source: Niko1221/Strata at 011c9e6 (README says 0.2.2). The installed 0.2.2 bundle also has the same workspaceId: activeWorkspace field next to /api/chat/stream, so the shipped app has the same send path.

Relevant lines:

  • apps/host/src/lib/store.ts:251, :440-459, :613-616, :723, :1027, :1084-1087, :1660
  • apps/host/src/app/Sidebar.tsx:89-95
  • apps/host/src/screens/Chat.tsx:54-73
  • apps/host/server/index.mjs:488, :579, :1914-1916
  • apps/host/server/agent/agent-bridge.mjs:286, :796, :1234-1240
  • apps/host/server/chat-files.mjs:35-57
Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3754 ### Area [GUI] (the desktop app) ### Desktop app, Terminal or source? Desktop app (Windows) ### What happened After restarting the desktop app, a chat does not return to the workspace it was created in. The sidebar is back on the first/default workspace, and opening the chat only selects the conversation; it does not restore the chat's workspace. The next message is sent with the first workspace, so the agent runs in the wrong folder. The user has to click the original workspace in the sidebar again before the chat works there. The chat is still listed under its old workspace in the sidebar (grouping uses the saved path), but the active/highlighted workspace is the first one. That makes the wrong-folder turn easy to miss. This is more than the file tree. If the chat already had an agent session, the cwd mismatch makes the host drop the saved Harness session and create a new one in the wrong folder; the new session only gets the last 12 messages. If the user sends once before re-selecting the workspace, the saved session mapping is already deleted, so re-selecting afterwards still starts a new session and only replays those 12 messages. That is why the chat looks like it cannot continue the previous work. The code path (0.2.2 source at 011c9e6): - `Session.workspace` is saved as a path when a chat is created (`apps/host/src/lib/store.ts:1027`) and is used only for sidebar grouping (`apps/host/src/app/Sidebar.tsx:89`). - `activeWorkspace` starts as null (`store.ts:251`), is not in `savePrefs()` (`store.ts:440-459`), and `bootstrap()` falls back to `workspaces[0]` (`store.ts:723`). - `selectSession()` only sets `activeSession` (`store.ts:1084-1087`); `Chat.tsx:54-73` does not restore the workspace either. - The chat request always sends `workspaceId: state.activeWorkspace` (`store.ts:1660`). - The host resolves the turn cwd with `chatFolders.get(chatId) ?? workspaceId path ?? WORKSPACE` (`apps/host/server/index.mjs:579`). It does not use `agent.workingFolder(chatId)`, although the file routes do (`index.mjs:488`). - On a cwd change, `apps/host/server/agent/agent-bridge.mjs:286` deletes the chat's session mapping and creates a new session in the new cwd; `:796` only carries the earlier conversation for a fresh session, and `withEarlierConversation` keeps the last 12 messages (`:1234-1240`). The per-chat "Select a folder" chip is a separate mechanism and does survive a restart: it writes `chat-folders.json` (`apps/host/server/chat-files.mjs:35-57`) and wins at `index.mjs:579`. A chat created under a sidebar workspace has no such entry; only `Session.workspace` records the path, and that path is never mapped back to a workspace id or sent to the host. Expected: reopening a chat restores the workspace it belongs to (or the turn uses that chat's saved workspace), so the next message runs in the same folder and the agent session continues without re-selecting. The file tree and the agent should agree. Possible fix: 1. In `selectSession()`, map `session.workspace` (including `Workspace.aliases`) to a workspace id and set `activeWorkspace`. 2. In `sendMessage()`, use the session's saved workspace/chat folder instead of the global `activeWorkspace`. 3. In `index.mjs:579`, add `agent.workingFolder(chatId)` as a fallback before the global workspace/default, as the file routes do. 4. Persist the last active workspace for new/empty chats, but prefer the opened chat's workspace. ### Smallest steps or command that reproduce it 1. Add a second workspace in the sidebar (Workspaces -> Add a workspace folder), for example `D:\Project`. 2. Click that workspace, create a chat, and send a message so the agent works in `D:\Project`. 3. Restart Strata completely. 4. Reopen the same chat from the chat list or command palette without clicking the `D:\Project` workspace header. 5. Send a message. The chat does not run in `D:\Project`; the first/default workspace is active, and the agent session is recreated there. Clicking `D:\Project` in the sidebar makes the next turn use that folder again (but the earlier session mapping is already gone if step 5 ran). Expected: the chat continues in `D:\Project` after the restart without re-selecting the workspace. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.2 · engine 0.1.47 ### Graphics card, memory and system RTX 3080 Ti Laptop 16 GB · 64 GB RAM · Windows 11 (10.0.26300) ### Model, size and settings Swift 1.5 IQ3_XXS · 524288 max context (the workspace binding is model-independent) ### Logs No engine crash. This is the GUI/host workspace state. Source: `Niko1221/Strata` at 011c9e6 (README says 0.2.2). The installed 0.2.2 bundle also has the same `workspaceId: activeWorkspace` field next to `/api/chat/stream`, so the shipped app has the same send path. Relevant lines: - `apps/host/src/lib/store.ts:251`, `:440-459`, `:613-616`, `:723`, `:1027`, `:1084-1087`, `:1660` - `apps/host/src/app/Sidebar.tsx:89-95` - `apps/host/src/screens/Chat.tsx:54-73` - `apps/host/server/index.mjs:488`, `:579`, `:1914-1916` - `apps/host/server/agent/agent-bridge.mjs:286`, `:796`, `:1234-1240` - `apps/host/server/chat-files.mjs:35-57`
Author
Owner

@Niko1221 commented on GitHub (Oct 26, 2026):

Fixed in 0.2.5: a chat comes back in the workspace it was made in and the next turn runs in that folder. Please update.

<!-- gh-comment-id:6423325691 --> @Niko1221 commented on GitHub (Oct 26, 2026): Fixed in 0.2.5: a chat comes back in the workspace it was made in and the next turn runs in that folder. Please update.
Author
Owner

@DevHyfes commented on GitHub (Oct 29, 2026):

Where do the chats go that were in here? I had several chats that were in a workspace. I closed the application to restart my computer. I open it up today, and all of those chats are missing from my workspace. The only chats I see are those in the default folder. The folder that I told the missing chats to use has the documents that they were working on, but no chat logs, and those chat logs had all the commentary by subagents that were working on it. I don't exactly understand why creating a workspace and defining a folder for it doesn't actually stick.

<!-- gh-comment-id:6502634760 --> @DevHyfes commented on GitHub (Oct 29, 2026): Where do the chats go that were in here? I had several chats that were in a workspace. I closed the application to restart my computer. I open it up today, and all of those chats are missing from my workspace. The only chats I see are those in the default folder. The folder that I told the missing chats to use has the documents that they were working on, but no chat logs, and those chat logs had all the commentary by subagents that were working on it. I don't exactly understand why creating a workspace and defining a folder for it doesn't actually stick.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1577
No description provided.