Skip to content

feat(app): group Home sessions by project - #57895

Closed
liambreen wants to merge 1 commit into
anomalyco:devfrom
liambreen:home-session-groups
Closed

liambreen wants to merge 1 commit into
anomalyco:devfrom
liambreen:home-session-groups

Conversation

@liambreen

@liambreen liambreen commented Oct 21, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #55446

Type of change

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

What does this PR do?

Adds an opt-in toggle in the Home search row that switches the sessions list between the existing date groups and per-project groups. Default stays date grouping.

Grouped view: one collapsible header per project (chevron + avatar + name), groups ordered by most recent session, sessions resolved through the project inventory so worktree and sandbox sessions join their parent project instead of splitting it. Grouped rows indent under the header's chevron column and drop the per-row project suffix (the header already names the project); search results keep the suffix since that list spans projects. The grouping mode and collapsed groups persist per user under a home.sessions storage key.

The partition logic lives in a new leaf module, home/sessions/grouping.ts, so it is unit-testable without the component graph.

How did you verify your code works?

  • bun typecheck in packages/app and bun run check at the repo root, both green.
  • Unit: new grouping.test.ts cases (first-occurrence group order, within-group recency, sandbox sessions under their parent project, per-directory identity); existing records.test.ts cases still green.
  • E2E: new keeper case in home.spec.ts covers the toggle, group order, suffix suppression, collapse, cycle-skip and reload persistence, and the compact header height. Full home.spec.ts suite is 12/12 locally.

Screenshots / recordings

Home sessions grouped by project (toggle lives at the right of the search row):

Home sessions grouped by project

Checklist

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

Added by the opencode bot (AI-generated).

Related: #51759, #54115

An opt-in toggle in the Home search row switches the sessions list
between date groups and per-project groups: collapsible compact
headers, groups ordered by most recent session, worktree and sandbox
sessions resolved to their parent project, and grouped rows indented
under their header's chevron column without the per-row project
suffix. The mode and collapsed groups persist per user.

@opencode-agent opencode-agent 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.

The project grouping works as described. I ran the full home.spec.ts e2e suite in headless Chromium (12/12, including the new case), the src/home/sessions unit tests (27/27) and bun run typecheck in packages/app (clean). The screenshots below are both from this branch: the default date view, then the grouped view.

Public API: unchanged. The only addition is an app-local persisted key, home.sessions.

One thing to fix before merge: the spacing change on the group body also applies to the default date view, so it changes the existing Home layout for everyone, not just the opt-in mode (inline). A smaller point: collapsed state is stored globally and keyed by folder path (inline). Also, the description mentions a test for skipping collapsed groups and a per-directory identity unit test, but neither is in the diff. Please update the description or add them.

Related: #51759, #54115

Before

After

</Show>
<div
class={`flex min-w-0 flex-col gap-px pt-2 md:pt-4 ${index === props.groups.length - 1 ? "" : "mb-6"}`}
class={`flex min-w-0 flex-col gap-px pt-1 ${index === props.groups.length - 1 ? "" : "mb-2"}`}

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 wrapper is shared by both modes, so going from pt-2 md:pt-4 / mb-6 to pt-1 / mb-2 also tightens the existing Today/Yesterday/Older layout, which stays the default. Could the compact spacing apply only when props.groupedByProject is true, so the date view keeps its current spacing?

const queryClient = useQueryClient()

const [storedView, setStoredView] = persisted(
Persist.global("home.sessions"),

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.

collapsed is keyed by pathKey(worktree), but it's stored under Persist.global. So the same path on two servers (e.g. /home/me/app locally and on a remote) shares one collapsed state, and entries are never pruned. If Home can show other servers, Persist.serverGlobal(...) (used elsewhere for per-server state) might fit better, at least for collapsed.

@liambreen liambreen closed this Oct 21, 2026
@liambreen

Copy link
Copy Markdown
Author

Sorry - this was not supposed to have been submitted.

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/web: group sidebar sessions by project like Codex Projects view

1 participant