[Bug]: First message in a chat outside the sidebar project filter resets the filter to All projects#33251

opened2d agobyKkarimou5

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. In the sidebar, set the project filter to a single project, e.g. Project A.
  2. Start a new chat in another project, Project B (new-thread picker / Cmd+Shift+O, or a thread link).
  3. Send the first message.

Expected behavior

The sidebar follows the chat I am working in: the filter switches to Project B (or at least adds B to the current selection), so I keep a focused, single-project list.

Actual behavior

The filter is reset to All projects and that choice is persisted, so the sidebar suddenly lists every thread of every project. I then have to reopen the filter menu and pick the project again, many times a day.

Cause, from the source (main at c6ca605630):

  • resolveSidebarRouteReveal (apps/web/src/components/sidebar/routeReveal.ts) reports widensScope when the routed thread is hidden by the current project scope.
  • Sidebar.tsx (~L1132-1149) then uses projectScopeKeys = [] and persists it with setPersistedProjectScopeKeys([]).
  • While the chat is still a draft the thread shell does not exist, so findThread returns undefined and nothing happens; the widening fires at the first send, when the shell arrives.

Proposal

Make the reveal target the thread's own project instead of clearing the scope, ideally behind a setting so both behaviors stay available:

Settings > Sidebar > When the open thread is outside the project filter:

  • Switch the filter to its project (proposed default)
  • Add its project to the filter
  • Show all projects (current behavior)

The project group key is already at hand in Sidebar.tsx: the group whose memberProjectRefs contains ${thread.environmentId}:${thread.projectId}. When no group matches, fall back to all projects as today.

Impact

Minor bug or occasional failure

Version or commit

0.1.8-nightly.20261109.4399 (code unchanged on main at c6ca605630)

Environment

Linux (Lubuntu), desktop AppImage, default (non-boring) sidebar

Workaround

Re-select the project in the filter after each first message in another project. Locally I patch the minified renderer bundle so the effect persists [threadProjectKey] instead of [].