Skip to content

fix(app): show subfolder sessions under their project in Home - #65443

Open
MykolaBiron wants to merge 1 commit into
anomalyco:devfrom
MykolaBiron:home-child-sessions
Open

MykolaBiron wants to merge 1 commit into
anomalyco:devfrom
MykolaBiron:home-child-sessions

Conversation

@MykolaBiron

@MykolaBiron MykolaBiron commented Nov 21, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #65362 (part A only)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Home hid sessions that run in a subfolder of the selected project. A session in personal/android-app did not show under personal, even with the same project ID.

There were two causes. The Home filter in records.ts matched directories exactly. The scoped fetch in queries.ts also asked the server by exact directory, so subfolder sessions of quiet projects were never loaded.

The fix:

  • records.ts keeps sessions in a selected directory or any subfolder of it. It uses the existing containsDirectory helper, so /repo/ab does not match /repo/a and Windows paths work. Sessions of a separately added nested project stay with that project.
  • queries.ts also lists the selected project's sessions by project ID. It skips the shared global project, which spans unrelated folders.

Part B of the issue looks like #55133, so I left it out.

How did you verify your code works?

  • Added 3 tests in records.test.ts: a subfolder session, Windows path variants, and a nested added project. They failed before the fix and pass after it.
  • All 68 tests under packages/app/src/home pass.
  • Prettier, oxlint and tsc show no new issues in the changed files.

Screenshots / recordings

None. I verified the change with unit tests and did not run the desktop app.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Home kept only sessions whose directory exactly equals the selected
project's worktree or sandbox, so a session started in a subfolder
(for example personal/android-app) vanished from its own project.

Match sessions whose directory is a selected directory or a
path-segment descendant of it, unless a separately added nested project
owns that subfolder. The scoped fetch also lists the selected project's
sessions by project ID, since the server's directory filter is exact.
The shared global project is skipped there so it does not pull in
unrelated folders.

Fixes anomalyco#65362 (part A)
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 21, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a sound fix for part A of the issue.

How I checked

  • I ran the issue's reproduction against a server from this branch. Listing by the project's root folder still returns only the root session (the server code is the same on the base). Listing by project ID, which this PR adds, returns both the root and the android-app session.
  • The three new records.test.ts cases fail on the base and pass here.
  • All 68 tests in src/home pass, and tsc -b is clean.
  • I could not open the Home UI itself. Could you add a before/after screenshot of Home with a subfolder session?

Public API: unchanged. The change is client-only and uses the project filter that session.list already accepts.

Concerns

  • The client filter matches by folder path alone, not by the session's project ID (see the inline comment). Unadded nested repos, and subfolders of non-git folders, can end up under the selected project.
  • Not blocking: the per-project browse view (projects/browse-view.tsx) still filters by exact folder, so it will keep hiding these sessions.

Related: #55133, #51191


return selected.some(
(root) =>
containsDirectory(root, directory) &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches by path only, so any loaded session in a subfolder of the selected folder now shows under the project, whatever its projectID. Examples:

  • A nested git repo that was never added as a project, such as a vendored clone or a submodule with its own project ID.
  • A subfolder of a non-git (global) selected folder. That's the case the query in queries.ts deliberately skips, so the two halves disagree.

Could subfolder matches also require session.projectID === selectedProject.id, and skip them for global? Exact folder matches would stay as they are. That would line up with the project-ID fetch and mostly make the nested-project scan unnecessary. It would also avoid rebuilding that scan for every session.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@epicwhale

Copy link
Copy Markdown

Came to say, I applied this locally and it works for me: with a project selected on Home, my sessions opened in a subfolder of the repository show again. This bug hides most of my sessions.... I found one more place with the same exact-folder filter: the project history view in the Desktop Projects sidebar?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop: Home hides subdirectory sessions and mixes unrelated global projects

2 participants