Skip to content

Commit 59eb7a2

Browse files
fix(ui): scope session list by workspace folder (#386)
## Summary - Scope session listing requests to the current workspace folder by passing `directory: instance.folder` to OpenCode. - Prevent non-git workspace sessions from leaking across projects when OpenCode stores them under the shared `global` project. - Include the scoped directory in session list logs for easier debugging. ## Why OpenCode groups non-git folders under the shared `global` project. CodeNomad previously called `session.list()` without a directory filter, so fresh non-git folders could show sessions from unrelated folders. ## Testing - `npm ci` - `npm run typecheck --workspace @codenomad/ui` --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent ff4446a commit 59eb7a2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/ui/src/stores/session-api.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ async function fetchSessions(instanceId: string): Promise<void> {
123123
})
124124

125125
try {
126-
log.info("session.list", { instanceId })
127-
const response = await rootClient.session.list()
126+
const projectResponse = await rootClient.project.current()
127+
const projectId = projectResponse.data?.id
128+
const sessionListOptions = projectId === "global" ? { directory: instance.folder } : undefined
129+
130+
log.info("session.list", { instanceId, projectId, directory: sessionListOptions?.directory })
131+
const response = sessionListOptions
132+
? await rootClient.session.list(sessionListOptions)
133+
: await rootClient.session.list()
128134

129135
const sessionMap = new Map<string, Session>()
130136

0 commit comments

Comments
 (0)