Skip to content

Studio: give a project one home in the sidebar, and fix the row menus around it - #11370

Merged
shimmyshimmer merged 4 commits into
mainfrom
studio-sidebar-project-rows
Sep 20, 2026
Merged

shimmyshimmer merged 4 commits into
mainfrom
studio-sidebar-project-rows

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

The sidebar talks about a project in three places at once: the Projects nav row, the Projects section, and the folder row's own menu. This lines them up, and fixes two row bugs found on the way.

Pinned folders belong to Pinned

Pinning a project sorted its folder to the top of Projects, which reads as nothing having happened when the Pinned section right above it holds only chats. A pinned folder now renders in Pinned, chats nested under it as usual, and leaves the Projects list entirely, so it is never in both places.

  • Pinned folders reorder in their own scope (PINNED_PROJECT_ORDER_SCOPE), so a drag in one section cannot renumber the other's rows.
  • Each folder now leaves the screen with the section it renders in, which renderedProjectIds, renderedProjectChatItems, the selection guard, the chat walk and Select All all read.
  • The Projects header stays while any project exists, pinned or not, because it owns "New project".

The folder row rendering moved into renderProjectFolderRow(project, index, order) so both sections render the same row.

The Projects nav row steps aside while the section is there

The nav row and the section list the same folders one click apart. Both now read one flag:

const projectsSectionShowing =
  !isStudioRoute && !showTrainingRecents &&
  organizeBy === "project" && projects.length > 0;

While the section is showing, the Projects row drops into "More" on its own. It comes back when the section is not there: no projects left, the sidebar organised as one list, or a route the section does not render on. It goes to "More" rather than disappearing, so nothing becomes unreachable.

A toggle in Customize sidebar still wins. The customization now carries sidebarNavAuto, the rows still following their automatic rule. Flipping the Projects switch writes an explicit pinned and drops the id from that list, so pinned stays pinned beside the section and off stays off after the last project is deleted. The switch shows the effective placement, so Settings and the sidebar never disagree.

A payload written before this field has no entry, so it is read as "never chose" and picks up the rule once. One toggle makes it permanent either way.

One Edit dialog per project

"Rename project" is now "Edit", opening a dialog that holds everything a project is:

  • name
  • instructions, sent with every chat in the project. This is the first UI for updateChatProjectInstructions, which had no caller.
  • linked local folders, the same manager the Sources tab carries, so a folder linked here is linked there
  • Delete project, handing back to the existing confirmation with its "delete its files too" switch rather than cloning that flow

Name and instructions write separately so a failed rename cannot discard instructions typed in the same visit, and the drafts reseed per project so one project's text is never saved over another's. The rename dialog's kind: "project" branch is removed with it, since nothing could reach it any more.

The folder menu is now Project home, Pin project, Edit, Move up, Move down, Delete project. "New chat" is gone from it: the row's own pencil is right there and does exactly that.

Folder rows say what they are doing

  • The icon follows the disclosure: Folder02Icon while the chats are showing, Folder01Icon while they are not.
  • An expanded folder with no chats says "No chats" in the muted row token instead of looking like one that failed to expand. New shell.navigation.noChats key, translated across all twelve locales; the existing noChatsYet still serves the "no history at all" state in Recents.

The chat row's Project submenu

"Move to project" is now "Project", and "Save to project sources" is "Project sources", nested under it directly below "New project":

Project >   New project
            Project sources >
            ------------------
            Recents
            <projects>

The rule now means something. Above it are the two rows that act on the chat, below it every row moves it. Project sources previously sat at the bottom, under the destinations it is not one of.

Icons: project sources use folder-attachment everywhere they appear (row menu, project page menu, the reply action, the composer pill), and Link folder uses hugeicons' folder-sync instead of lucide's, along with the two other places the same icon appears in that panel so they do not read as two different glyphs side by side.

Fixes

A row's title ran under its action buttons

group-has-[.sidebar-row-action[data-state=open]]/x:pr-N is more specific than group-hover/x:pr-M, since the :has() argument carries a class and an attribute, so it wins outright when both match. A row hovered with its menu open therefore laid out with the open-state gutter while hover had revealed every action, and that gutter was narrower.

Measured in a browser before changing anything: hovered with the menu open, the old pr-8 put the title's right edge 36px past the secondary action's left edge. Both states now reserve the same width, which leaves it 4px clear, and the quick-action beside the kebab is revealed with the open menu so the row stops changing shape depending on where the pointer is.

Renaming a project chat did nothing

Not a rename bug. A pinned project chat is two rows at once, one under Pinned and one under its folder, and isRenamingThis matched on the chat id alone, so both rows mounted an autoFocus input. The second stole focus, the first fired onBlur, and the blur handler cancelled a rename that was not dirty yet. Reproduced with the real menu component:

rename  opened from pinned
focus   pinned
blur    pinned -> cancel
focus   project:p1

Both pills gone before a key could be pressed. The rename target now carries the row's list scope, so the row the menu was opened from owns the pill. The keyboard chord still opens the dialog, unchanged.

Tests

tsc -b clean, full suite 8015 pass / 0 fail, eslint unchanged against the pre-existing errors in the touched files.

Two new files:

  • tests/sidebar-row-menu-and-pinned-folders.test.ts, which pins the gutter invariant across every row that carries both variants, the open-menu reveal, the rename scoping, the folder icon and empty row, the submenu order and the Pinned placement. All of these fail against the unfixed source.
  • tests/sidebar-projects-nav-auto.test.ts, covering the nav rule: the row stands down only while the section shows, a choice outlives the rule in both directions, no other id can join the rule (a hand-edited list sanitizes back), and the sidebar and the customizer resolve through the same helper.

Four assertions in keyboard-shortcuts.test.ts were pinned to the old structure and now assert the new one.

… around it

Pinned folders render in Pinned instead of sorting to the top of Projects, the Projects
nav row steps aside while that section already lists the same folders, and a folder's
menu opens one Edit dialog for its name, instructions and linked folders.

Two fixes on the way there. A row whose menu was open laid out with a narrower gutter
than hover, so a long title ran under the action buttons. And a chat on screen twice,
a pinned project chat, mounted two rename inputs, the second stealing focus from the
first, whose blur cancelled the rename before a key could be pressed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-20T11:19:35.514425Z 29aa390 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3afffee114

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ges intact

Three things the Projects rework got wrong.

A payload written before sidebarNavAuto existed already carries a Projects pin the user
chose, so only a layout we shipped picks up the automatic rule now; an arranged one keeps
what it has.

The icon rail hides both folder sections in CSS without unmounting them, so the nav row
stays on the rail rather than standing down behind More where nothing else lists projects.

And a folder now range-selects within the list its row is in. Pinned folders are rows of
Pinned, whose ids the Projects list does not hold, so a Shift-click between two of them
found neither endpoint and cleared the selection.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

All three were right, and are fixed in b2aa10b.

Sidebar placement on upgrade. A payload written before sidebarNavAuto existed can already hold an explicit Projects pin, so treating every one of them as "never chose" overrode it in both directions. sanitizeSidebarNavAuto now takes the sanitized nav and only hands out the rule when the layout is still one we shipped, using the same comparison migrateShippedSidebarNavDefault was doing; that check moved into a shared isUntouchedSidebarNav so the two cannot drift. An arranged layout gets an empty list and keeps its pin. Verified against a layout with Projects unpinned (rule empty, row stays unpinned with the section both showing and absent), a reordered layout with Projects untouched (rule empty, row stays pinned), an older shipped layout from before Audio shipped (rule applies), and a fresh install (rule applies).

The icon rail. Both folder sections carry group-data-[collapsible=icon]:hidden, so they are hidden there without unmounting, and the row was standing down exactly where nothing else lists projects. Split in two: projectsSectionRendered keeps the section's mount condition, and projectsSectionShowing, which the nav rule reads, adds (isMobile || sidebarState !== "collapsed"), matching chatListsOnScreen.

Folder range selection. Confirmed: rangeBetween returns [] when neither endpoint is in the list, so a Shift-click between two pinned folders cleared the selection outright. handleProjectSelectionClick now takes the row's orderedIds, and the call site passes order.orderedIds, so each section ranges within itself. An anchor from the other section is treated as absent and restarts here, which is what the chat rows do with sameList.

Covered by new tests in tests/sidebar-projects-nav-auto.test.ts: the upgrade cases above, the rail keeping the row while the section is CSS-hidden, and the handler taking a list rather than reaching for projectRowIds.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2aa10be13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… drawn order

Three fixes to the sidebar project work, from the review on this PR.

PersonalizationCustomization ignores unknown keys, so sidebarNavAuto was
stripped from every save and rebuilt from the nav layout on the next load. A
user who pinned Projects while the rule was hiding it had that undone on the
next hydration, since the layout it was inferred from is still the shipped
default. The backend now stores the field, defaulting to None so a record
written before it exists stays distinguishable from a user who chose an empty
list. A parity test fails on any future customization field the backend does
not declare.

Pinned folders fell back to pin order, dropping an order the user had already
dragged them into while they were rows of Projects. They now read that order
until Pinned records one of its own.

Pinned draws its folders above its chats, but the published lists still put the
standalone pinned chats first, so Next/Previous Chat walked a different
sequence than the screen showed. The section publishes its rows as one block,
and the Projects section publishes only its own.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

All three are real, fixed in 29aa390.

sidebarNavAuto was not persisted. PersonalizationCustomization ignores unknown keys, so the field went out on every PUT and came back missing, and the next hydration inferred it again from a layout that is still the shipped default. Pinning Projects while the rule hid it was undone on reload. The backend model now carries sidebarNavAuto, defaulting to None rather than a list so a record written before the field stays distinguishable from a user who chose an empty list, which is what the client's sanitizer already keys on. Covered by a route round trip in test_personalization_settings.py, plus a parity test in sidebar-nav-backend-parity.test.ts that fails on any customization field the backend does not declare.

Pinned folders lost their order. The new scope is empty on the first run, so folders fell back to pin order even though manualOrder[PROJECT_ORDER_SCOPE] still held the order they had been dragged into. They now read that order until Pinned records one of its own, and a drop in Pinned takes over from then on. With pin order [b, a] and a Projects order of [c, a, b], the folders drew b, a and now draw a, b.

The walk disagreed with the screen. Pinned draws its folders above its chats, but pinnedItems carried only the standalone chats and every folder chat went to projectItems, so with both a pinned project and a pinned chat the walk went pin-1, folder-2, folder-1 while the sidebar showed folder-1, folder-2, pin-1. Pinned now publishes its rows as one block and the Projects section publishes only its own, so visibleChatItems reads in draw order, including the chat that is drawn twice.

Suite: 8020 frontend tests and the backend personalization tests pass.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 29aa3909f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit 63c6341 into main Sep 20, 2026
48 of 52 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-sidebar-project-rows branch September 20, 2026 11:29
danielhanchen added a commit that referenced this pull request Sep 20, 2026
…tter wants (#11374)

The sidebarNavAuto validator landed with its signature wrapped across three
lines. It fits in one at the configured line length of 100, so the
ruff-format-with-kwargs hook rewrites it on every run, reports "files were
modified by this hook" and fails.

That is why pre-commit.ci has been red on main since #11370, and why every open
pull request inherits a red check it did nothing to cause. On a fork-hosted
branch the bot cannot push its own fix either, so the failure just sits there.

Running the hook after this change leaves the tree untouched.
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Sep 20, 2026
…11372)

* Format the validator unslothai#11370 added, so pre-commit.ci is green again

`ruff-format-with-kwargs` runs over the whole tree, so one unformatted
signature fails the hook on every open PR rather than only on the one that
introduced it. `_validate_sidebar_nav_auto` fits on a single line under the
pinned ruff 0.6.9, and this is exactly the output of
`python scripts/run_ruff_format.py studio/backend/routes/settings.py`.

* Give the desktop release tests an explicit utf-8 encoding

The repo's own guard in tests/security fails any read of a checked-in file at
the platform default encoding, because it breaks on Windows the moment that
file gains a non-ASCII byte. Three reads added with the desktop release work
were missing it, which fails `Repo tests (CPU, rest)` on every PR opened
against current main, unslothai#11371 and unslothai#11372 included.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
… around it (unslothai#11370)

* Studio: give a project one home in the sidebar, and fix the row menus around it

Pinned folders render in Pinned instead of sorting to the top of Projects, the Projects
nav row steps aside while that section already lists the same folders, and a folder's
menu opens one Edit dialog for its name, instructions and linked folders.

Two fixes on the way there. A row whose menu was open laid out with a narrower gutter
than hover, so a long title ran under the action buttons. And a chat on screen twice,
a pinned project chat, mounted two rename inputs, the second stealing focus from the
first, whose blur cancelled the rename before a key could be pressed.

* Studio: pad the project name field's folder glyph off the left edge

* Studio: keep an arranged sidebar, the icon rail and pinned folder ranges intact

Three things the Projects rework got wrong.

A payload written before sidebarNavAuto existed already carries a Projects pin the user
chose, so only a layout we shipped picks up the automatic rule now; an arranged one keeps
what it has.

The icon rail hides both folder sections in CSS without unmounting them, so the nav row
stays on the rail rather than standing down behind More where nothing else lists projects.

And a folder now range-selects within the list its row is in. Pinned folders are rows of
Pinned, whose ids the Projects list does not hold, so a Shift-click between two of them
found neither endpoint and cleared the selection.

* Studio: store the Projects nav rule, and keep pinned folders in their drawn order

Three fixes to the sidebar project work, from the review on this PR.

PersonalizationCustomization ignores unknown keys, so sidebarNavAuto was
stripped from every save and rebuilt from the nav layout on the next load. A
user who pinned Projects while the rule was hiding it had that undone on the
next hydration, since the layout it was inferred from is still the shipped
default. The backend now stores the field, defaulting to None so a record
written before it exists stays distinguishable from a user who chose an empty
list. A parity test fails on any future customization field the backend does
not declare.

Pinned folders fell back to pin order, dropping an order the user had already
dragged them into while they were rows of Projects. They now read that order
until Pinned records one of its own.

Pinned draws its folders above its chats, but the published lists still put the
standalone pinned chats first, so Next/Previous Chat walked a different
sequence than the screen showed. The section publishes its rows as one block,
and the Projects section publishes only its own.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…tter wants (unslothai#11374)

The sidebarNavAuto validator landed with its signature wrapped across three
lines. It fits in one at the configured line length of 100, so the
ruff-format-with-kwargs hook rewrites it on every run, reports "files were
modified by this hook" and fails.

That is why pre-commit.ci has been red on main since unslothai#11370, and why every open
pull request inherits a red check it did nothing to cause. On a fork-hosted
branch the bot cannot push its own fix either, so the failure just sits there.

Running the hook after this change leaves the tree untouched.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…11372)

* Format the validator unslothai#11370 added, so pre-commit.ci is green again

`ruff-format-with-kwargs` runs over the whole tree, so one unformatted
signature fails the hook on every open PR rather than only on the one that
introduced it. `_validate_sidebar_nav_auto` fits on a single line under the
pinned ruff 0.6.9, and this is exactly the output of
`python scripts/run_ruff_format.py studio/backend/routes/settings.py`.

* Give the desktop release tests an explicit utf-8 encoding

The repo's own guard in tests/security fails any read of a checked-in file at
the platform default encoding, because it breaks on Windows the moment that
file gains a non-ASCII byte. Three reads added with the desktop release work
were missing it, which fails `Repo tests (CPU, rest)` on every PR opened
against current main, unslothai#11371 and unslothai#11372 included.
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.

1 participant