Skip to content

🤖 feat: optional flat chat list for the sidebar with project badges - #3994

Open
ibetitsmike wants to merge 17 commits into
mainfrom
mike/sidebar-flat-mode
Open

🤖 feat: optional flat chat list for the sidebar with project badges#3994
ibetitsmike wants to merge 17 commits into
mainfrom
mike/sidebar-flat-mode

Conversation

@ibetitsmike

Copy link
Copy Markdown
Contributor

Summary

Adds an optional flat sidebar mode: a new "Flat chat list" setting replaces the project-folder grouping with one globally sorted list of chats, keeping pinned chats in a single unified block at the top and tagging each root chat card with a project-name badge tinted by the project's folder color. The General settings page is also reorganized from three monolithic headers into logical groups (Appearance, Sidebar, Transcript, Terminal, Archiving, Editor & debugging, Projects).

Background

Users working across many projects lose vertical space and orientation to per-project folders when they mostly care about "all my recent chats". The flat mode drops the folders while badges preserve project attribution; grouped mode stays the default and is unchanged.

Implementation

  • sidebarFlatMode persists via usePersistedState (key in src/common/constants/storage.ts, default off) with a command palette toggle for parity with the sibling sidebar options.
  • buildSortedWorkspacesFlat (workspaceFiltering.ts) reuses the existing comparators: pinned roots first in global pinnedAt order, then recency with deterministic tie-breakers, then the tree flatten that keeps sub-agents under their parents. Age grouping and hide-sub-agents both compose with flat mode.
  • Pinned drag-reorder in flat mode uses one shared reorder group; workspaceService.reorderPinned now scopes its timestamp re-deal to the union of project buckets referenced by the input ids (grouped drags keep exact single-bucket behavior), fixing cross-project reorders reverting on reload.
  • Root chat cards and drafts render a truncating badge (resolveSectionColor of the project's configured color); scratch chats get no badge, multi-project chats a neutral one, sub-agent rows none.
  • Folder expansion state is left untouched while flat, so toggling back restores the prior grouped layout.

Validation

  • Remote dogfood UAT (2 rounds) on dev.coder.com against the exact pushed SHAs: grouped-default regression, live toggle, unified pinned block, badge colors matching folder colors, 240px truncation, sub-agent nesting, hide/age toggles, expansion-state restoration, keyboard nav, drafts, rapid toggling, and cross-project pinned reorder persistence incl. reload (round 2, after the fix).
  • Cross-project reorder fix is red-green covered: the new reorderPinned cross-bucket test fails without the service change.

Risks

  • reorderPinned is the only backend touch; scope generalization is covered by new unit tests plus the pre-existing single-bucket suite (defensive contract unchanged).
  • Grouped sidebar rendering paths are gated behind the (default-off) flag; largest regression surface is ProjectSidebar render wiring, exercised by the updated UI tests and a new Storybook story.

Generated with xum • Model: anthropic:claude-fable-5 • Thinking: xhigh

reorderPinned scoped the re-deal to the first id's project bucket, so a
flat-mode drag spanning projects hit the <2 pinned early-return (or only
rewrote one bucket) and the optimistic client order reverted on reload.
Scope the reorder to the union of buckets referenced by the input ids:
grouped drags keep single-bucket behavior, flat drags re-deal the whole
unified block's timestamp pool.
- render the project badge on draft rows (prop was threaded but unused)
- gate flat-list derivation behind the flag so grouped mode skips the
  global sort/flatten work
- simplify buildSortedWorkspacesFlat to take rows directly (the two-pass
  config merge reproduced Array.from(map.values()) before a global sort)
- dedupe project badge resolution; inline single-use GroupedSidebarSection
- drop leftover divide-y padding on the API Debug Logs row
- document flat mode in locatePinnedBlock's JSDoc
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 6cee23bc30

ℹ️ 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".

Comment thread src/node/services/workspaceService.ts
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.stories.tsx
Comment thread src/browser/components/AgentListItem/AgentListItem.tsx Outdated
Comment thread src/browser/components/AgentListItem/AgentListItem.tsx Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
- setPinned scans all project buckets for the global pinnedAt max so new
  pins append at the bottom of the flat unified pinned block
- flat collection respects the multi-project experiment gate
- project badge props are stable primitives; badge text uses text-secondary
  for contrast, keeping the project color as a tinted background/border
- workspace and draft aria-labels include the project badge name
- Storybook shared reset clears SIDEBAR_FLAT_MODE_KEY
- flat draft deletion selects an adjacent draft; draft promotion renders
  the promoted workspace once in the draft's position
- extracted one shared coalesced list pipeline so flat mode gets task-group
  coalescing (best-of + workflow runs) identical to grouped mode
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 2866aec8b1

ℹ️ 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".

Comment thread src/node/services/workspaceService.ts
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.stories.tsx Outdated
- reorderPinned substitutes requested ids into their existing slots so a
  partial input (grouped multi-project section spanning buckets) never
  displaces omitted pins in the flat global order (red-green tested)
- flat mode renders compact project management headers below the chat
  list: per-project new chat, options menu, rename, and color stay
  reachable via mouse/touch without leaving flat mode
- FlatChatList story pins a phone viewport variant plus a play contract
  that the flat list and headers are actually on screen
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: ccb84d8369

ℹ️ 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".

Comment thread src/browser/utils/ui/pinnedReorder.ts Outdated
…eriment

The flat block in locatePinnedBlock included pins the sidebar hides while
the multi-project experiment is off, so keyboard/palette moves could swap
with an invisible row and appear to do nothing. The block now mirrors the
sidebar's render gate (red-green tested); omitted hidden pins keep their
slots server-side via the round-2 slot-preservation fix.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: b2155a9c31

ℹ️ 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".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Flat mode renders each project's sub-projects as compact SectionHeader
rows under its management header: scoped new chat, rename, color, and
delete stay reachable via mouse/touch. SectionHeader's expand toggle is
now optional and renders a static folder icon when omitted, since
nothing nests under the flat rows (red-green tested).
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: d0dc30381f

ℹ️ 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".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
Chats and drafts scoped to a valid sub-project now badge with the
sub-project's display name and color (stale references fall back to the
parent project), since flat mode drops the section headers that used to
convey that scope. Red-green tested.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 9977e7243b

ℹ️ 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".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 188deb9821

ℹ️ 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".

Comment thread src/browser/components/AgentListItem/AgentListItem.tsx Outdated
@chatgpt-codex-connector

This comment has been minimized.

@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: 66415fa996

ℹ️ 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".

Comment thread src/node/services/workspaceService.ts Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
Comment thread src/node/services/workspaceService.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: d1b9ec925c

ℹ️ 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".

Comment thread src/common/utils/pin.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 2d603e969b

ℹ️ 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".

Comment thread src/common/utils/pin.ts Outdated
Comment thread src/browser/stories/meta.tsx Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: c220bde067

ℹ️ 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".

Comment thread src/common/utils/pin.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 6ba6d29e65

ℹ️ 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".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: ce39dd80e9

ℹ️ 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".

Comment thread src/common/utils/pin.ts Outdated
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 7f104268ab

ℹ️ 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".

Comment thread src/common/utils/pin.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: cdb95ca2ee

ℹ️ 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".

@chatgpt-codex-connector

This comment has been minimized.

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