Files
codewhale/crates
LinQ 5b0b81c5fc fix(session-picker): scope Ctrl+R picker to the current workspace (#1395)
#1395 reports that Ctrl+R in project B restores a session that
belongs to project A — the picker was calling `list_sessions()` and
showing every session on disk regardless of where the user is. With
hundreds of past sessions across many repos, the first hit on the
"most recent" sort is rarely the one from the project the user just
opened.

`SessionMetadata.workspace` is already persisted, so the data needed
to filter is there. This PR:

1. Adds a `workspace_scope` field to `SessionPickerView` and a
   `show_all_workspaces` toggle. `SessionPickerView::new` now takes
   `&Path` so every caller is forced to pass a scope.
2. Filters `filtered` to sessions whose recorded `workspace`
   canonicalises to the same path as the active workspace. Both
   sides go through `std::fs::canonicalize` so a symlinked or
   relative checkout matches its canonical form.
3. Adds an `a` keybinding inside the picker to flip
   `show_all_workspaces`, with a status-line readout
   ("scoped to this workspace" / "showing sessions from every
   workspace"). The user can always escape the scope if they need
   to.

Three new tests:
- `workspace_scope_filters_sessions_to_current_project` —
  reproduces the #1395 scenario (sessions in /tmp/project-a vs
  /tmp/project-b; the picker only surfaces the matching project).
- `workspace_scope_toggle_a_expands_to_all_workspaces` — `a` flips
  back and forth; status announces the new mode.
- `workspace_scope_none_means_show_all` — the historical
  unscoped behaviour is still reachable when the caller passes
  no workspace (used for tests + future opt-out).

Updates the two call sites (`ui.rs` Ctrl+R handler and
`commands/session.rs` `/sessions [show]`) to pass
`&app.workspace`.

Closes #1395
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 19:28:29 -05:00
..
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00
2026-05-10 18:21:58 -05:00