[codex] Group projects in new-thread pickers#4312
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review 2 blocking correctness issues found. This feature PR has multiple unresolved review comments identifying bugs: DraftHeroHeadline ignores manual project ordering, and SidebarV2 may show null project titles for some threads due to lookup issues in the new grouping logic. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
e7d474e to
7ec6918
Compare
c0f0ff2 to
2e484a2
Compare
3914285 to
4078fa6
Compare
| ), | ||
| [environments], | ||
| ); | ||
| const projectGroups = useMemo( |
There was a problem hiding this comment.
🟡 Medium chat/DraftHeroHeadline.tsx:52
When projectSortOrder is "manual", the project picker in DraftHeroHeadline displays projects in entity-store order instead of the user's saved sidebar order, so the menu disagrees with the sidebar. sortLogicalProjectsForSidebar preserves its input order for manual sorting, but projectGroups passes the raw projects collection into buildSidebarProjectSnapshots without first applying the saved projectOrder that the sidebar and command palette use. Apply the user's manual ordering to projects before passing them into buildSidebarProjectSnapshots.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/chat/DraftHeroHeadline.tsx around line 52:
When `projectSortOrder` is `"manual"`, the project picker in `DraftHeroHeadline` displays projects in entity-store order instead of the user's saved sidebar order, so the menu disagrees with the sidebar. `sortLogicalProjectsForSidebar` preserves its input order for manual sorting, but `projectGroups` passes the raw `projects` collection into `buildSidebarProjectSnapshots` without first applying the saved `projectOrder` that the sidebar and command palette use. Apply the user's manual ordering to `projects` before passing them into `buildSidebarProjectSnapshots`.
| [projects], | ||
| ); | ||
| const projectTitleByKey = useMemo( | ||
| const projectDisplayNameByKey = useMemo( |
There was a problem hiding this comment.
🟡 Medium components/SidebarV2.tsx:826
projectDisplayNameByKey is built only from group.memberProjects, which buildSidebarProjectSnapshots deduplicates down to one physical-project winner per group. But threads can belong to a discarded duplicate project ref that is absent from memberProjects yet present in memberProjectRefs. For those rows, the projectDisplayNameByKey.get(...) lookup returns undefined, so the row gets projectTitle={null} instead of the group display name it received before this change. The mapping should be built from group.memberProjectRefs (or the raw projects list) so every concrete ref resolves to the group's display name.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/SidebarV2.tsx around line 826:
`projectDisplayNameByKey` is built only from `group.memberProjects`, which `buildSidebarProjectSnapshots` deduplicates down to one physical-project winner per group. But threads can belong to a discarded duplicate project ref that is absent from `memberProjects` yet present in `memberProjectRefs`. For those rows, the `projectDisplayNameByKey.get(...)` lookup returns `undefined`, so the row gets `projectTitle={null}` instead of the group display name it received before this change. The mapping should be built from `group.memberProjectRefs` (or the raw `projects` list) so every concrete ref resolves to the group's display name.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit 7920d02. Configure here.
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
7920d02 to
af1853b
Compare
| aria-label="Un-settle thread" | ||
| onClick={handleUnsettleClick} | ||
| className="absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md border border-sidebar-border bg-sidebar-row-hover px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/v2-row:opacity-100 dark:border-transparent dark:inset-ring-1 dark:inset-ring-white/5" | ||
| className="absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/v2-row:opacity-100" |
There was a problem hiding this comment.
🟡 Medium components/SidebarV2.tsx:576
The settle/unsettle buttons lose their opaque background, so when a keyboard user tabs to one without hovering, focus-visible:opacity-100 reveals the button while the time/status label underneath stays visible (it's only hidden via group-hover/v2-row:opacity-0). Both texts render in the same space and overlap, becoming illegible. Restoring an opaque background or adding group-focus-within/v2-row:opacity-0 to the label would prevent the overlap. The same issue affects the equivalent buttons at lines 585 and 662.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/SidebarV2.tsx around line 576:
The settle/unsettle buttons lose their opaque background, so when a keyboard user tabs to one without hovering, `focus-visible:opacity-100` reveals the button while the time/status label underneath stays visible (it's only hidden via `group-hover/v2-row:opacity-0`). Both texts render in the same space and overlap, becoming illegible. Restoring an opaque background or adding `group-focus-within/v2-row:opacity-0` to the label would prevent the overlap. The same issue affects the equivalent buttons at lines 585 and 662.

Why
After Sidebar V2 groups duplicate repository copies, its new-thread flows can still list every physical environment/project pair. That makes the picker disagree with the sidebar and presents redundant choices.
Root cause
The command palette and global new-thread route consume the raw project collection rather than logical project snapshots.
Fix
Dependency
Stacked on PR #4282 because it reuses the logical grouping helpers introduced there.
Verification
vp run --filter @t3tools/web typecheckNote
Group projects by logical group in new-thread pickers across sidebar, command palette, and draft hero
buildSidebarProjectPickerEntriesandsortLogicalProjectsForSidebarto model and sort logical project groups (sets of related physical projects) for use in UI pickers.group.displayName, search across all member project titles/paths, and open the most recently active thread across all group members.chat.newshortcut and new-thread button now trigger the project picker based on the number of logical groups rather than raw project count.buildSidebarProjectSnapshotsis extended to exposememberProjectRefsfor all grouped physical projects, enabling downstream group-aware operations.Macroscope summarized 7920d02.
Note
Medium Risk
Changes which project/thread is targeted when opening or creating threads from grouped duplicates; behavior is localized to pickers and shortcuts using existing grouping helpers, not server or auth paths.
Overview
Aligns new-thread flows with Sidebar V2 logical project grouping so pickers no longer list every physical environment/project pair for the same repo.
The command palette builds project actions from
buildSidebarProjectPickerEntries/ snapshots (manual order, grouping settings, sidebar sort). Each row uses the group display name;buildProjectActionItemsaccepts optionalsearchTermsso member titles and workspace roots still match search. Open project resolves the latest non-archived thread across all members of the group. New thread in project keeps the contextual concrete project when it belongs to the selected group. The quick “New thread in …” action label prefers the preferred picker entry’s group name.Draft hero project menu uses the same grouped entries and display names instead of a flat sorted project list.
Global
chat.new(Sidebar v2) opens the palette only whenprojectGroupCount > 1, not raw project count.Sidebar v2 thread rows show group display names for project titles; settle/unsettle hover buttons drop bordered row-hover styling for transparent buttons.
Reviewed by Cursor Bugbot for commit 7920d02. Bugbot is set up for automated code reviews on this repo. Configure here.