Skip to content

fix(web): new-sprint dialog uses the new agent project menu - #590

Merged
NoahHendrickson merged 3 commits into
customfrom
t3/sprint-project-menu-consistency
Nov 29, 2026
Merged

NoahHendrickson merged 3 commits into
customfrom
t3/sprint-project-menu-consistency

Conversation

@NoahHendrickson

@NoahHendrickson NoahHendrickson commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

The New sprint dialog's Project field was a plain Select, and Also touches (optional) was a plain checkbox menu. Both showed a long list of names, unlike the project menu on the new agent screen.

Both fields now open that same menu (custom/DraftProjectPicker), with its search, Recent/Name sort, favicons, pin buttons and "Add a project" footer. The trigger is drawn like the dialog's Model picker and shows the draft chip's folder icon and the project name.

  • Typed selection: DraftProjectPicker takes selection: { mode: "single", value, onPick } | { mode: "multiple", values, onValuesChange, anchor }. In multiple mode, checked rows show a check instead of a fill and the list stays open. anchor is required because Base UI's multiple combobox otherwise anchors to chips this menu never draws. DraftProjectMenuChoices now holds row data only. A side prop opens the menu downward in the dialog.
  • Rows: useSprintProjectChoices() owns the dialog's candidates and rows. Each project is still its own row, because a sprint runs on one machine. A row's pin and recent use come from the project's group in upstream's ~/hooks/useSidebarProjectGroups, so pinned and recent projects come first, as in the draft menu.
  • Behavior unchanged: which projects are offered (unarchived, not No project, on a machine that has a No project workspace; Also touches = same machine, excluding the main project, and picks on another machine still survive a project switch), the default project, and what useCreateSprint receives (project, otherProjects).
  • A guard in forkSprints.test.ts pins both fields to DraftProjectPicker. forkNewAgentDraft now guards the new single-pick dispatcher. The Storybook menu story passes the typed selection. The fork-sprints manifest entry now mentions the shared menu.

Checks: vp run check:changed (typecheck across 44 packages, 157 test files, React Compiler), design-lint and the fork lint ratchet all pass. I also checked in a browser against a scratch dev server: search, picking a project, toggling Also touches rows on and off, the main project left out of Also touches, Add a project opening the palette over the dialog, and the new agent chip's menu unchanged.

Reviewed with sol-loop: 2 rounds with GPT-6.1 Sol on high. Sol verdict: approved


🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code (T3 Code)
Reviewer: GPT-6.1 Sol (gpt-6.1-sol, high effort) via Codex. It approved both rounds; its one round-2 finding, the Storybook story, is fixed.

🤖 Generated with Claude Code

Both project pickers in the New sprint dialog (Project and Also touches)
now open the draft's project menu (DraftProjectPicker): search, sort,
favicons, pins and the Add a project footer. Also touches uses a new
multi-select mode (checked rows show a check, the list stays open).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list. labels Nov 29, 2026

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code quality review, commit acc5697b292fbf7efe4c0fce30a945f852dbff0f. Not approving yet. Behavior looks right and no file comes near 1k lines (picker 263, hook 279, dialog 438). But the multi-select mode is bolted onto the picker through loose optional props, and the PR adds a second useSidebarProjectGroups next to the canonical one. Both can be fixed without changing what users see.

1. Multi-select is a set of optional props, not a mode (custom/DraftProjectPicker.tsx:66-195)

The new mode is spread across checkedValues?, anchor?, a sentinel value: "", and a pick that now means "toggle" instead of "set". The picker then checks checkedValues !== undefined in five places (multiple, value, onValueChange, selectedFill, the check icon). Nothing in the types ties these together: anchor is required for multi-select (see its own comment) but optional, and choices.value has no meaning in multi mode, so the caller passes "".

The worst part is onValueChange. Base UI already passes the new array, but the picker diffs it against checkedValues to find the one key that changed, then calls pick(key). The dialog then rebuilds the array with a toggle reducer (NewSprintDialog.tsx:317-323). The data goes array → key → toggle → set, which is the reverse of what the combobox already provides.

Suggested change: make the mode a typed prop and let the array pass straight through.

type PickerSelection =
  | { readonly mode: "single"; readonly value: string; readonly onPick: (key: string) => void }
  | {
      readonly mode: "multiple";
      readonly values: ReadonlyArray<string>;
      readonly onValuesChange: (keys: ReadonlyArray<string>) => void;
      readonly anchor: RefObject<Element | null>;
    };

With this:

  • The diffing code is gone.
  • The dialog's toggle reducer becomes setAlsoKeys(new Set(keys)).
  • anchor is required exactly when it is needed.
  • DraftProjectMenuChoices loses value/pick and holds only row data (entries, recent keys, pin, No project).

That last point matches what the dialog already does: useSprintProjectRows returns Omit<DraftProjectMenuChoices, "value" | "pick">, which shows the type was mixing two things. The draft chip passes { mode: "single", value, onPick: choices.pick }.

One detail if you want zero behavior drift: alsoKeys currently keeps keys from another machine across a project switch. Merge those hidden keys back in, or decide on purpose that toggling drops them.

2. A second useSidebarProjectGroups with a different contract (custom/useDraftProjectChoices.ts:97-128)

~/hooks/useSidebarProjectGroups is upstream's canonical hook, used by Sidebar, the PR page and CollapsedThreadTabs. This PR exports another hook with the same name but a different signature (it takes projects), a different sort (sortLogicalProjectsForSidebar vs sortSidebarV2ProjectGroups) and no scratch grouping. Its doc comment says "as the sidebar draws them", which is not what the real sidebar hook does. Auto-import and grep will now mix the two up.

It also returns a grab-bag, { projectGroups, threads, projectGroupingSettings, primaryEnvironmentId }. The last two are only there so useDraftProjectChoices doesn't have to call two cheap selectors itself.

Either:

  • Name it for what it is (for example useDraftProjectGroups) and return only { projectGroups, threads }, letting the draft hook read its own settings and primary environment. Or:
  • Check whether the sprint dialog can use the canonical hook directly. It filters to sprintKeys anyway, so scratch grouping doesn't matter there. That would keep the extraction out of this PR entirely.

3. The sprint dialog builds its project list twice and makes up a "group" (custom/sprints/NewSprintDialog.tsx:45-102)

  • useSprintProjects() and useSprintProjectRows() each call useProjects() and useScratchProject() and filter out scratch projects in slightly different ways. The second gets its candidate set through a Set of keys from the first. One useSprintProjectChoices() hook that owns the candidate list, the rows and the recent keys would leave one list instead of two that have to agree.
  • Each row's group is an object built by hand. Its projectKey is a scoped project key, while pinned and memberProjects belong to the logical group. It is half one thing and half the other, and it gets passed to togglePin. If the picker's entry type is what forces this shape, say so in the type: give the entry a row key separate from its pin target, rather than relabelling a group's fields. At minimum, put the construction in a small named helper with a one-line invariant.
  • recentKeys wraps groups as { group } only to fit rankRecentProjectEntries, then flattens members. That is fine on its own, but it is a third shape conversion in one hook.

Smaller

  • The "Also touches" choices object is built inline in JSX, including an O(n·m) alsoChoices.some(...) filter, the sentinel value and the reducer. After (1) and (3) it becomes { ...rows, entries: alsoEntries }, with alsoEntries computed next to alsoChoices.

Verdict: request changes. (1) is the main blocker: it removes the diff logic, the sentinel and the optional-prop tangle. (2) is a canonical-name collision that should not merge as is.


🤖 Review by Claude Opus 5.5 (claude-opus-5-5) via Claude Code (T3 Code), reviewed commit acc5697b292fbf7efe4c0fce30a945f852dbff0f.

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code review: acc5697b292fbf7efe4c0fce30a945f852dbff0f

No correctness issues found.

What I checked:

  • useSidebarProjectGroups extraction. This only moves code. useDraftProjectChoices still builds projectGroups with the same inputs: manual order, grouping settings, environment labels and thread-based sort. entries, recentKeys and pick don't change, so the new agent chip and launchpad behave as before.
  • Multi-select toggle in DraftProjectPicker. Base UI computes the new array from the controlled checkedValues, so the before/after difference is always exactly one key. choices.pick(toggled) then flips it in alsoKeys. Single-select still goes through the typeof value === "string" branch. A deselect (null) is ignored, as before.
  • Backspace in the search field. Base UI's multi-select Backspace-removes-last-value path (ComboboxInput, @base-ui/react@1.9.0) runs only when a chips context exists. This menu renders no chips, so pressing Backspace in an empty search can't silently uncheck an "Also touches" project.
  • Anchoring. ComboboxPopup falls back to chipsRef only when anchor is unset, so passing alsoTrigger is what the multi-select picker needs. The single-select Project picker correctly leaves it unset.
  • Rows and keys. In the sprint rows, group.projectKey is the member's own scoped key. That matches projectKeyOf, recentKeys (flattened per member) and checkedValues, so "Recent" sort, the check marks and the toggles all use the same key. sprintKeys still applies the unarchived, non-scratch, has-a-No-project-machine filter. Also touches is still limited to alsoChoices, the same machine minus the main project.
  • Pins. These act on the full sidebar group (memberProjects and pinned from the group), the same as the draft menu. pickableProjectGroups filters archived groups, not individual members, so the two menus operate on the same group members.
  • useCreateSprint payload. The project and otherProjects it receives are unchanged.

Non-blocking:

  • NewSprintForm now subscribes to useQuietThreadShells() through useSidebarProjectGroups, so the open dialog re-renders when any thread shell changes. The draft chip already pays this cost and the dialog is short-lived, so I'm fine leaving it as is.

CI: the fast checks and the server shards pass. Test, Test Web 2 and Build and Typecheck were still pending when I posted this.


🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code (T3 Code), automated review

xxxxxxxxxxxxx and others added 2 commits November 29, 2026 01:53
Review follow-up on #590: DraftProjectPicker takes a selection prop
(single: value + onPick; multiple: values + onValuesChange + anchor),
so the array passes straight through with no diffing and the menu
choices type holds rows only. The sprint dialog reads upstream's
useSidebarProjectGroups instead of a second hook of the same name, and
one useSprintProjectChoices owns its candidates, rows and ranking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NoahHendrickson

Copy link
Copy Markdown
Owner Author

Thanks. All three points are addressed in 2e531a8, plus a Storybook fix in ab3bd34. Nothing changes for the user: the dialog and the new agent chip look and behave as before (re-checked in a browser against a scratch dev server).

1. Multi-select is now a typed mode. DraftProjectPicker takes selection: { mode: "single"; value; onPick } | { mode: "multiple"; values; onValuesChange; anchor }. anchor is required in multiple mode. Base UI's array goes straight to onValuesChange, so the diffing code, the "" sentinel and the toggle reducer are gone. DraftProjectMenuChoices now holds row data only. The draft chip passes { mode: "single", value: choices.value, onPick: choices.pick }, and DraftProjectPillViewChoices adds value/pick back for the chip. On the hidden keys: "Also touches" merges the new picks with the keys of projects not shown, so picks on another machine still survive a project switch, the same as before.

2. The second useSidebarProjectGroups is gone. I reverted the extraction, so useDraftProjectChoices.ts only changes the DraftProjectMenuChoices type now. The sprint dialog calls the canonical ~/hooks/useSidebarProjectGroups directly, plus useQuietThreadShells for rankRecentProjectEntries. Scratch grouping doesn't matter there because the dialog filters to its own candidates.

3. One sprint choices hook. useSprintProjectChoices() owns the candidate list, the rows and the recent keys, and calls useProjects/useScratchProject once. Each row is built by a named sprintProjectRow(project, group). Its comment states the invariant: the row is keyed by the project, because a sprint runs on one machine, while the pin and recent use come from the project's sidebar group. I didn't change the entry type itself, because the draft menu shares it.

Smaller. alsoRows is computed next to alsoChoices from a Set of keys, so the JSX passes choices={alsoRows}.

Also fixed: Sol round 2 approved, with one finding: DraftProjectMenu.stories.tsx still passed value/pick. It now passes the typed selection. The fork-storybook typecheck passes. I re-stamped the story's design-lint B6 hash without a Figma change, since only its props moved and it renders the same.

Checks: vp run check:changed (typecheck across 44 packages, 157 test files, React Compiler), design-lint and the lint ratchet all pass. I updated the forkNewAgentDraft guard to the new dispatcher (selection.onPick, onPick: choices.pick).

🤖 Claude Opus 5.5 (claude-opus-5-5) via Claude Code (T3 Code)

@github-actions

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 435c741 · PR result: ab3bd34 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@NoahHendrickson

Copy link
Copy Markdown
Owner Author

Re the correctness review's non-blocking note (dialog re-renders on thread shell changes): this still applies after the refactor, because useSprintProjectChoices reads useQuietThreadShells for the recent ranking. That's the quiet variant, which skips streaming ticks, and the draft chip pays the same cost. I'm leaving it, as you suggested, since the dialog is short-lived.

🤖 Claude Opus 5.5 (claude-opus-5-5) via Claude Code (T3 Code)

@NoahHendrickson
NoahHendrickson merged commit b532086 into custom Nov 29, 2026
33 checks passed
@NoahHendrickson
NoahHendrickson deleted the t3/sprint-project-menu-consistency branch November 29, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants