fix(session): scope session list and TUI to current directory#14489
fix(session): scope session list and TUI to current directory#14489Aegis-commits wants to merge 1 commit intoanomalyco:devfrom
Conversation
Pass the existing `directory` parameter to all session list call sites that were missing it, so sessions are filtered to the current working directory instead of showing all sessions globally. Fixes four entry points: - CLI `session list` command - TUI bootstrap session fetch - TUI /sessions dialog search - TUI SSE session.updated event handler (new session inserts) Uses the existing Session.list() directory filter and GET /session?directory= API parameter — no server or API contract changes required. Fixes anomalyco#8836
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that address similar issues: Potentially Related PRs:
Note: PR #14489 explicitly states it "Supersedes #14443" — you may want to verify that #14443 has been closed to avoid confusion. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #8836
Type of change
What does this PR do?
The TUI and CLI session list show sessions from ALL directories instead of scoping to the current working directory.
The root cause is in
thread.ts— the normal TUI startup path never passesdirectorytotui(), sosdk.directoryisundefinedthroughout the entire TUI lifecycle. All downstream directory filtering silently becomes a no-op. Onlyattach.ts(remote attach) correctly passeddirectory.The fix:
thread.ts— Passdirectory: cwdtotui(). This is the root fix that makes everything else work.sdk.tsx— Exposedirectoryon the SDK context return so downstream consumers can read it.sync.tsx— Passsdk.directoryto the bootstrapsession.list()call so the initial load is filtered. Also guard SSE session inserts — if the incoming session's directory doesn't matchsdk.directory, don't insert it (existing sessions can still update).dialog-session-list.tsx— Passsdk.directoryto search queries, withsync.data.path.directoryas fallback.session.ts— CLIsession listpassesInstance.directorytoSession.list().The server already supports
directoryfiltering inSession.list()(line 518-520 ofsession/index.ts) — it just was never being passed from the TUI path.Supersedes #14443 (closed — missed the
thread.tsroot cause).How did you verify your code works?
/sessionsdialog shows only sessions belonging to each respective directorybun turbo typecheckpasses 12/12 packagesScreenshots / recordings
N/A — this is a data filtering fix, not a UI change. The session list looks identical, it just shows the correct subset of sessions.
Checklist