Skip to content

feat(sidebar): option to move folders with unread chats to the top - #25781

Merged
buluoray merged 1 commit into
mainfrom
crew/issue-triage/gh-13410-unread-folders
Nov 13, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/issue-triage/gh-13410-unread-folders

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let a person choose to see sidebar folders that hold unread chats at the top, without ever changing their saved folder order.

With many folders, a folder that just got an unread reply can sit far down the list. Today the only way to find it is to scroll or turn on the Unread filter, which hides everything else.

Why it matters

People who file chats into many folders miss replies in folders below the fold. An opt-in "unread first" view brings those folders up while leaving the manual order (and #13321's deterministic order) untouched for everyone else.

Not a goal

  • No change for anyone who does not turn the option on. It is off by default.
  • No server-side setting. The chat_folder_tree MCP tool, the folder pickers and the Command Bar keep listing in dashboard.folder_sort order. A shared server setting (the route PR feat(dashboard): setting to hide the unread dot on session cards #25757 took) was the larger option and was not picked.
  • No floating inside the sort-and-filter menu's own folder list, or for session rows.
  • No reorder-by-drag while the option is on. Making drags work against a floated order is a separate design.

What changed (motivation → approach → change)

Decision (★A, the most conservative option), also posted on the issue: one toggle, off by default, display only.

Toggle Sidebar folders
Off (default) Folder order mode, as today
On Folders with an unread chat first, newest unread first; the rest in mode order
  • Where: sidebar sort-and-filter menu → Folder order → Move folders with unread chats to the top. It is kept in this browser (mc-sidebar-folders-unread-first in localStorage), like the other sidebar view choices in that menu.
  • Nested folders: an unread chat in a subfolder floats its parent among the root folders and the subfolder among its siblings. A parent_id loop cannot hang the walk.
  • Saved order: the view is a comparator over the mode's own comparator (pages/chat-sidebar/unreadFolderFloat.ts), used for the tree and board folder rows in ChatSidebar.tsx. It writes no folder order and no dashboard.folder_sort. The new-chat folder picker and ⌘K Search Folders keep the stored order.
  • No jumping under the pointer: while the pointer is over the sessions list, or a folder or board-card drag runs, the unread order is held at its last value. It re-sorts when the pointer leaves or the drag ends. Turning the toggle on or off always applies at once.
  • Drag: while the toggle is on, sibling folder reordering is off and its "Switch to Custom" hint is not shown. A line under the toggle says folders cannot be dragged into place while it is on. Moving a folder into another folder still works.
  • Agents: chat_folder_tree cannot read a browser setting, so its description (src/kiro_crew/mcp_dashboard.py) says the sidebar may draw unread folders above the listed order. The config spec, docs/architecture/mcp.md and the feature map say the same.
  • The two new strings are in every website/src/i18n catalog (en.manual.json, translations, regenerated en-XA.json).

Backwards compatibility

Compatible: the option is new and off by default, so the sidebar draws exactly as before until someone turns it on.

Removes nothing: no key, field, route or behaviour is removed; reordering is only paused while the new opt-in view is on.

Tests

website/src/test/ChatSidebar.folderUnreadFirst.test.tsx (11 cases):

  • off by default draws the stored order even with unread chats;
  • on draws unread folders first, newest unread first, the rest in stored order;
  • the new-chat folder picker keeps the stored order while the tree floats unread folders;
  • the menu toggle flips the view both ways, and the folder cache and patchConfig are never written;
  • flipping the toggle while the pointer is over the list applies at once, both ways;
  • on, a scripted sibling drop writes nothing and shows no "Switch to Custom" hint;
  • on, a chat turning read mid-drag (dnd-kit) does not re-sort the folders until the drag ends;
  • on, folders hold their order while the pointer is over the list and re-sort when it leaves;
  • on, a natively dragged board card holds the folder order until the drag ends;
  • nested: a subfolder's unread chat floats its parent and itself;
  • an unstamped unread chat still floats; a parent_id loop ends.

ChatSidebar.ownerComposition.test.ts pins the hook order, including where useNativeSessionDrag now runs.

Mutant proof (manual, frontend), each turns its own test red: the mode comparator in place of the unread one; removing && !foldersUnreadFirst from the reorder gate; dropping each freeze source (dnd-kit drag, native board-card drag, list hover); dropping the on/off clause of the freeze, which leaves "flipping the toggle while the pointer is over the list" red.

Proof: not provable -- frontend test (prove.py runs Python only)

Also green: ChatSidebar.ownerComposition.test.ts, tsc -p tsconfig.app.json, eslint on the touched files, npm run i18n:check.

Manual verification

Ran the built SPA in Playwright behind the repo's loopback static server, with /api/** answered from fixtures and the dashboard websocket held by the script. Four folders in stored order Alpha, Bravo, Charlie, Delta; Delta holds an unread chat. Every step below was asserted on the drawn folder order:

Step Drawn order
Toggle off Alpha, Bravo, Charlie, Delta
Toggle on Delta, Alpha, Bravo, Charlie
Toggle off again Alpha, Bravo, Charlie, Delta
On; a reply lands in Bravo, pointer over the list Delta, Alpha, Bravo, Charlie (held)
Pointer leaves the list Delta, Bravo, Alpha, Charlie

Screenshots / video

The menu with the toggle on and its whole note:

Menu, toggle on, with the note

The flow above, one frame per step (1.8 s each):

Toggle flips, then a reply lands under the pointer and the folder moves up when the pointer leaves

Earlier stills: setting off and on, and the menu

Sidebar, setting off

Sidebar, setting on

Menu, off

Related Issues

Closes #13410

Related: #13321 (deterministic folder order; untouched while this option is off).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 29, 2026 13:36
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of ddc92ca2c57f5e93911127e355a29e0356c7be4e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is an opt-in, display-only view, off by default and kept in localStorage, answering #13410. No existing mechanism does it, and the stored folder order and folder_sort are left as they are.

What this change ships

Inventory (8 items) — 8 justified

Intent: let a person see folders that hold unread chats at the top of the sidebar without changing the saved order. ADDITION.

  1. Sort-and-filter menu → Folder order gets a new toggle, Move folders with unread chats to the top, off by default — justified
  2. With it on, folders holding an unread chat are drawn first, newest unread first, and a subfolder's unread chat lifts its parents too — justified
  3. With it on, you can't drag folders into a new place among their siblings, the "Switch to Custom" hint is hidden, and a note says so — justified
  4. With it on, folder order stays still while the pointer is over the list or a drag is running, and re-sorts afterwards — justified
  5. The new-chat folder picker, ⌘K Search Folders and the filter menu's folder list keep the stored order — justified
  6. The choice is saved in this browser only (mc-sidebar-folders-unread-first) — justified
  7. The chat_folder_tree MCP tool description now warns that the sidebar may draw unread folders above the order it lists — justified
  8. Config spec, mcp.md and the feature map describe the new view — justified

[FIRST-PRINCIPLES-REVIEWED] ddc92ca

Description read

[DESCRIPTION-READ] dc6e952bbcdc398af0b6e01247189e33ace0e74c77bf569dc79ecc5df2bc82bd

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ddc92ca2c57f5e93911127e355a29e0356c7be4e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the option is off by default, lives only in the browser, sits on top of the existing folder comparator, and writes no stored order. Rendered evidence is attached.

[DESIGN-REVIEWED] ddc92ca

Description read

[DESCRIPTION-READ] eeaa527106aad4183662edeb2ea5f78fe6440b73eca52c142adc73f18a5f621f

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of ddc92ca2c57f5e93911127e355a29e0356c7be4e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader read the toggle correctly ("folders holding something I haven't read jump to the top"), said they would use it, and spotted the reorder in shots 3–4 without being told.

Notes

  • folder_order_unread_first sits directly under the Custom / By name / By date radio items and uses the same check mark. The reader couldn't tell "whether the second is a fourth choice in that list or a separate on/off switch". Add a DropdownMenuSeparator above it, or use a checkbox-style indicator, so it reads as a switch on top of the mode.
  • Nothing in the sidebar shows that the order is being changed. The reader said: "nothing on screen says why the order changed." A small marker on the Folders header while the option is on would explain why folders moved.
  • The note "Folders cannot be dragged into place while this is on" shows while Custom is still ticked, and the reader felt "one setting silently overrides the other". Name what still works: "Drag-to-reorder is paused while this is on; moving into a folder still works."

[UX-REVIEWED] ddc92ca

Description read

[DESCRIPTION-READ] a0c1204ed3b539862ecfc7ea94d02d25e18d51ba804bc3c7bcd55f92df3e3dcd

That sha256 names everything this verdict read: the PR description, plus the 8 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ddc92ca2c57f5e93911127e355a29e0356c7be4e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ddc92ca

Verdict parsed from the review's SHA-scoped output markers for commit ddc92ca2c57f5e93911127e355a29e0356c7be4e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ddc92ca2c57f5e93911127e355a29e0356c7be4e false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ddc92ca2c57f5e93911127e355a29e0356c7be4e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ddc92ca

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ddc92ca2c57f5e93911127e355a29e0356c7be4e false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the crew/issue-triage/gh-13410-unread-folders branch 2 times, most recently from 8d38d00 to b62ac89 Compare October 29, 2026 14:25
@iamwhatever

iamwhatever commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: unread-first folder comparator shared through scope

  • span=c3bc99e7b8e9 Unread-first ordering leaks into the folder picker

fixed in b62ac89: the New → New chat in folder picker (SidebarHeader.tsx) now sorts with folderModeCompare, the folder-order mode comparator, exposed on the sidebar scope.
Class swept: every folderCompare sort site. Only drawn tree, board and root folder rows keep the unread-first comparator; the filter lists already used the mode comparator.
Test: ChatSidebar.folderUnreadFirst.test.tsx asserts the picker lists A,B,C,D while the tree draws D,B,A,C; it fails without the fix.

🤖 AI-assisted comment 🤖

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 29, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at b62ac89c6b0c: all 93 checks pass, PR Readiness passed, the PR is mergeable, and no review threads are open.

  • GPT 6.1 and Opus 5.5 reviewed this head with no blocking findings. Design, First Principles and UX passed.
  • The one GPT finding (span c3bc99e7b8e9, the New chat in folder picker sorting with the unread-first order) is fixed in this head; its disposition is posted above.
  • Drag decision (from the triage owner): while the toggle is on, sibling folder reorder by drag stays off and the note under the toggle stays. The toggle is display-only and never rewrites the stored order.

What remains is a maintainer's review and merge. I have not merged, approved or enabled auto-merge.

🤖 AI-assisted comment 🤖

@buluoray buluoray 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.

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Requesting changes at b62ac89c6b.

Blocking: the browser-local view breaks the order promise made to agents. config.md:3721-3737 says folder_sort is workspace-level so the sidebar and chat_folder_tree show the same order, and mcp_dashboard.py:103-106 tells agents that in custom mode the order they read is the order the person sees. With this option on (stored in browser localStorage, not config), both statements become false, and the PR updates neither. Either make chat_folder_tree aware of the option (which means storing it where the gateway can read it), or update the tool description and the spec to say the sidebar may lift unread folders above that order.

Checked and fine: off by default; display only, it never writes back an order; the sort is stable. New tests 7/7 and existing folder-sort tests 47/47 pass; two mutations redden named tests.

Value gate, for the owner: #13410 is T2, needs-human and parked, and it conflicts with #13321, which asks for a deterministic folder order.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 29, 2026
@iamwhatever
iamwhatever force-pushed the crew/issue-triage/gh-13410-unread-folders branch from b62ac89 to 5ede5e2 Compare October 29, 2026 16:33
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray thanks for the review. Reply to the blocking point (the order promise to agents):

I took the second option you gave: update the tool description and the spec, and keep the setting in the browser. Fixed in 5ede5e2d261e:

  • chat_folder_tree description (src/kiro_crew/mcp_dashboard.py): it now says the person may turn on a browser-only view that draws folders holding unread chats above the listed order, that the listing cannot see it, and that a before/after anchor still sets the stored position.
  • docs/system-specs/modules/config.md (Sidebar folder order) and docs/architecture/mcp.md: both name the view, its localStorage key, that it is off by default, and that it writes no order and no folder_sort, so the stored order an agent reads is still the one a drag or chat_folder_move writes.

Why this option and not a gateway-readable setting: the decision on #13410 was the most conservative one (display-only, off by default, the smaller change). Storing it in config.json would add a new config key, a PATCH allowlist entry and a second ordering rule inside chat_folder_tree, for a view whose order changes every time a chat is read. Saying plainly that the sidebar may lift unread folders keeps the agent contract true without that. If you would rather have the server-side setting, say so and I will switch.

Verified on this head: folder-order, unread-first and all locale style tests pass (154), and the chat_folder_tree tests pass (80).

On the value gate (T2, needs-human, parked, and the tension with #13321): that is the owner's call, so I have left it alone. With the option off, which is the default, the folder order is exactly as deterministic as before.

🤖 AI-assisted comment 🤖

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 29, 2026
@iamwhatever
iamwhatever force-pushed the crew/issue-triage/gh-13410-unread-folders branch from 5ede5e2 to b09b64c Compare October 30, 2026 04:37
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 7, 2026
@iamwhatever

iamwhatever commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=f7cc1ed5117a
    self-added: no
    mechanism: unread-first snapshot frozen while a drag runs

fixed in 4d89aca: while dragFrozen is set, the folder order keeps the unread snapshot from drag start and picks up the live one when the drag ends.
Owner decision (@iamwhatever, 2026-11-08): stop holding and fix this in the PR.
Class swept: liveUnreadLatest (ChatSidebar.tsx) is the only place unread state enters the folder order; folderCompare is built from the frozen value.
Test: "a chat turning read mid-drag does not re-sort the folders until the drag ends" fails without the fix and passes with it.

@iamwhatever
iamwhatever force-pushed the crew/issue-triage/gh-13410-unread-folders branch from 8cbcd0f to 4d89aca Compare November 8, 2026 09:13
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray the held drag fix has landed in 4d89aca9b143, per the owner decision from @iamwhatever: while the unread-first view is on, folder order now stays fixed during a drag and updates when the drag ends. One small change in ChatSidebar.tsx plus a test that fails without it. Ready for your re-review.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 8, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=976f6eddfe87
    self-added: no

Rebutted (disproportional): the lane itself downgraded it (disproportionate-remedy). It needs a full localStorage with nothing left to reclaim (safeStorage.ts), and the only loss is one browser-local view preference that resets on reload.
The sibling toggles in filters.tsx (lines 231 and 239) ignore the safeSetItem result the same way; an ErrorNotice for this one toggle alone would be a new pattern, not a fix within this PR.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at 4d89aca9b143: all 97 checks pass (0 failing), PR Readiness passed, the PR is mergeable, and no review threads are open.

  • The drag fix (span f7cc1ed5117a) is in this head, per the owner decision; its disposition is posted above.
  • GPT 6.1: no blocking findings; its one downgraded finding (span 976f6eddfe87) has a rebuttal posted.
  • Design, First Principles and UX passed.
  • green_age.py says main moved 8 commits since this head went green, with one same-file overlap (docs/feature-map/README.md). The PR is still mergeable, so I did not rebase.

@buluoray this waits only on your re-review.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the drag-time freeze. It is real and it has a test. Two things still block this head.

  1. A lifted folder drops back as soon as its unread chat is opened (website/src/pages/ChatSidebar.tsx:455).

    • Steps: turn the option on with stored order A,B,C,D and unread chats in B and D, so the sidebar draws D,B,A,C. Click D's unread chat.
    • What happens: switchSlot runs markSlotRead straight away (store/chat/slotSwitch.ts:209). liveUnreadLatest is rebuilt from the new unread set. Outside a drag, folderCompare changes in that same render, and the sidebar draws B,A,C,D. The folder you just clicked jumps to the bottom, and another block slides in under the pointer.
    • The only hold on this head is the dragFrozen snapshot (lines 460-462). Every test in ChatSidebar.folderUnreadFirst.test.tsx renders with activeSlot={null}. This is the case from the open change request, and it is still unaddressed.
    • Smallest fix: keep the active chat's folder chain in the drawn snapshot until a chat outside it is opened, or hold the drawn order while the pointer is in the sidebar. Add a render test where D holds the active chat and its unread mark is cleared, and D is still drawn first. The test must fail when the hold is removed.
    • Question: if dropping back on open is the intended behaviour, can a maintainer say so on #13410? The change request can then be settled on that basis.
  2. The UX review could not evaluate this head because evidence is missing (website/src/pages/chat-sidebar/SearchDock.tsx:645).

    • The body still has only the four original screenshots. The "menu on" image is cut off at the toggle row, so the "Folders cannot be dragged into place while this is on" note does not appear in any of them. There is no recording.
    • Folder rows that are already on screen move when the toggle flips and when a chat turns unread. That needs a recording.
    • Smallest fix: from this head, attach (a) a screenshot of the open menu with the toggle on and the whole note visible, (b) a still or short clip of a sibling folder drag with the toggle on, and (c) a short recording of the folders reordering when the toggle flips and when a chat turns unread.

Optional:

  • With the option on, dropping a folder among its siblings does nothing, and nothing on screen says why. The only explanation is the note inside the closed menu. You could show a status line at the drop instead of suppressing the reorder hint.
  • The body's Tests section lists 5 cases. The file now has 8, including the picker test and the mid-drag test. Please refresh the list, the count, and the mutant results.
  • #13410 is still labelled parked and needs-human. A maintainer should post on the issue whether this option is wanted, and how it should behave when a chat is opened. That also settles item 1.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Conflict-only rebase onto main (6fb9415); new head 0897fd0, drag fix kept, no behavior change (SidebarHeader.tsx and feature-map README kept both sides).

@iamwhatever

iamwhatever commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=c3bc99e7b8e9
    self-added: yes
    mechanism: unread-first snapshot frozen while a dnd-kit drag OR a native board-card drag runs

fixed in 6ed4ad3: the unread snapshot now freezes while dragFrozen or nativeSessionDrag is set, so a board card dragged natively no longer sees the folder targets re-sort; the live order returns on dragend.
Class swept: liveUnreadLatest (ChatSidebar.tsx) is the only place unread state enters the folder order; both drag kinds that exist (dnd-kit, native board card) now hold it. Board folder targets (boardLane.tsx) read the frozen comparator.
Test: "on, a board card dragged natively holds the folder order until the drag ends" fails without the fix and passes with it.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the native board-card freeze. It works and has its own test. One thing still blocks this head.

  1. The UX review still cannot evaluate this head because evidence is missing (website/src/pages/chat-sidebar/SearchDock.tsx:645).
    • Trigger: a reviewer checks the note under the ticked toggle ("Folders cannot be dragged into place while this is on"), and checks that folder rows on screen re-sort when the toggle flips or a chat turns unread.
    • Outcome: no evidence covers either. The body still has only the four original screenshots. The "menu on" image is cut off at the toggle row, so the note is in none of them, and there is no recording. The UX review on 6ed4ad3 is a BLOCK for this reason, and this repo's review rules treat a verdict that missing evidence prevents as a BLOCK.
    • Smallest fix, no code change needed: from this head, attach (a) a screenshot of the open menu with the toggle on and the whole note visible, and (b) a short recording of the folders reordering when the toggle flips and when a chat turns unread while it is on. Then let the UX review run again.

Follow-up on my earlier review at 4d89aca:

  • Item 1 (a lifted folder drops back as soon as its unread chat is opened): still stands. This head adds no hold for the active chat's folder, and every case in ChatSidebar.folderUnreadFirst.test.tsx still renders with activeSlot={null}. The behaviour matches the PR's own wording, so this is a product question. Can a maintainer say on #13410 whether dropping back on open is intended? If it is not, keep the active chat's folder chain in the drawn snapshot and add a render test that fails without that hold.
  • Item 2 (missing screenshot and recording): still stands. It is item 1 above.

Optional:

  • The de, es, fr and ru translations of the note say folders cannot be dragged at all. A folder can still be dragged to move it into another folder. Please re-translate from the current English source.
  • The body's Tests list and mutant counts describe an older head. The file now has more cases, including the picker, dnd-kit freeze and native freeze tests, and the body does not mention the drag-time unread snapshot.
  • #22596 adds a second toggle in the same Folder order block, stored as a workspace setting. The two PRs will conflict, and the menu would mix a per-browser toggle with a workspace one.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Folders jump while the user is reading or about to click
    self-added: no
    mechanism: one frozen unread-first snapshot, held while the pointer is over the sessions list or a drag runs

fixed in 1387f80: per the owner decision (hover freeze), the unread-first folder order is held while the pointer is over the sessions list, and re-sorts once it leaves. Hover, dnd-kit drags and native board-card drags share one frozen-order source in ChatSidebar.tsx, so a folder never moves under the pointer.
Turning the option on or off is never held back.
Test: "on, folders hold their order while the pointer is over the list and re-sort when it leaves" fails without the fix and passes with it.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the hover freeze. It holds the order under a mouse or pen pointer, and each freeze source has its own test that goes red without it. One thing still blocks this head.

  1. The UX review still cannot evaluate this head because evidence is missing (website/src/pages/chat-sidebar/SearchDock.tsx:645).
    • Trigger: a reviewer checks the note under the ticked toggle ("Folders cannot be dragged into place while this is on"). They also check that folder rows re-sort on screen when the toggle flips, and when a chat turns unread and the pointer then leaves the list.
    • Outcome: no evidence covers either check. The body still has only the four original screenshots. The "menu on" image is cut off at the toggle row, so none of them shows the note, and there is no recording. The UX review on 1387f80 says "cannot evaluate". It shows as PASS only because its BLOCK had no Trigger and Outcome lines. This repo's review rules say a verdict that missing evidence prevents is a BLOCK, not a pass. The new hover, drag and board-card freezes have no rendered evidence at all.
    • Smallest fix, no code change needed: from this head, attach (a) a screenshot of the open menu with the toggle on, tall enough to show the whole note, and (b) a short recording of the folders re-sorting when the toggle flips, and of a folder moving up after a chat turns unread and the pointer leaves the list. Then let the UX review run again.

Follow-up on my earlier reviews at 4d89aca and 6ed4ad3:

  • A lifted folder drops back when its unread chat is opened: partly fixed. With a mouse or pen, the hover freeze now holds the order while the pointer is over the list. On a touch tap, pointerleave fires before click, so the freeze is already off when switchSlot marks the chat read (ChatSidebar.tsx:1017, SessionRow.tsx:1493). The same happens with a keyboard open while the pointer is outside the list. Whether that is acceptable is still a product question for a maintainer on #13410. I am not blocking on it here.
  • Missing screenshot and recording: still stands. It is item 1 above.

Optional:

  • The body's "What changed" section does not mention the hover and drag freeze. The Tests list and mutant counts also describe an older head; the test file now has 10 cases.
  • docs/feature-map/README.md:107 still says "a person and an agent see the same tree". config.md, mcp.md and the chat_folder_tree description now say the sidebar may lift unread folders, so that sentence could say the same.
  • listHovered is set on every pointer enter and leave, even with the option off, which re-renders the sidebar for nothing. Setting it only while foldersUnreadFirst is on would avoid that.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This head is a rebase of 1387f80 with no code change, so the one blocking item from my last review still stands.

  1. The UX review still cannot evaluate this head because evidence is missing (website/src/pages/chat-sidebar/SearchDock.tsx:645).
    • Trigger: a reviewer checks the note under the ticked toggle ("Folders cannot be dragged into place while this is on"). They also check that folder rows re-sort on screen when the toggle flips, and when a chat turns unread and the pointer then leaves the list.
    • Outcome: no evidence covers either check. The body still has only the four original screenshots. The "menu on" image is cut off at the toggle row, so the note is in none of them, and there is no recording. The UX review on d4d09a8 says "cannot evaluate". It shows PASS only because its BLOCK had no Trigger and Outcome lines. This repo's review rules say a verdict that missing evidence prevents is a BLOCK, not a pass.
    • Smallest fix, no code change needed: from this head, attach (a) a screenshot of the open menu with the toggle on, tall enough to show the whole note, and (b) a short recording of the folders re-sorting when the toggle flips, and of a folder moving up after a chat turns unread and the pointer leaves the list. Then let the UX review run again.

Follow-up on my earlier reviews at 4d89aca, 6ed4ad3 and 1387f80:

  • Missing screenshot and recording: still stands. It is item 1 above.
  • A lifted folder drops back when its chat is opened by a touch tap or the keyboard: unchanged. This is still a product question for a maintainer on #13410, and I am not blocking on it here.

The code review found no correctness or security defect on this head. The failing Backend Tests shard 6 test checks dashboard server files that this PR does not touch, and it fails the same way on main. Analyze (python) failed on a rate limit.

Optional:

  • docs/feature-map/README.md:107 still says "a person and an agent see the same tree". The new clause also sits right before "Search Folders lists in the same order", which now reads as the unread-first order. The PR's own Not a goal says the Command Bar keeps the stored order.
  • The de, es, fr, ru and ja copies of the note say folders cannot be dragged at all. Dragging a folder into another folder still works. The English "cannot be dragged into place" is accurate.
  • No test flips the toggle while the pointer is over the list, which is the normal case because the menu sits inside the list region. Removing the null-check clause at ChatSidebar.tsx:468 leaves all 10 tests green.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 514 lines, more than the 400 it may approve on its own.

Opt-in, browser-local view that draws folders with unread chats first. Verified against the code: the comparator only wraps the mode order and never writes folder order or dashboard.folder_sort. The new-chat picker, the filter menu's folder rows and the hidden-folder reveal lists use the mode-only comparator. ⌘K and chat_folder_tree are untouched. While the toggle is on, sibling reordering is off both on the rows (droppable disabled) and in reorderFolders, and the 'Switch to Custom' hint is a no-op. Moving into a folder still works. The order is held while the pointer is over the list or a drag runs. Turning the toggle on or off always applies at once. The parent_id walk is guarded against loops. The 11 tests cover each behaviour. The CodeQL failures are API rate limits. The backend change is a description string only.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit ddc92ca2c5 · 514 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Status on head 707f84d: UX, design and first-principles lanes PASS with the attached screenshot and GIF. Two reds are not from this PR:

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready on head 93bad8a (rebased onto main b677e0d, which carries the #36315 fix). All 97 checks pass and PR Readiness passes. The UX, Design and First Principles lanes PASS. The UX lane read the attached screenshot (toggle on, with the full note) and the GIF of folders re-sorting. GPT and Opus are fresh on this head. There are 0 unresolved threads. The reds earlier on this head were the GitHub installation rate limit; each lane was rerun once after the reset.

@KiroCrewCaptain your blocking item was the missing UX evidence. It is now attached. @buluoray could you take another look? Both CHANGES_REQUESTED reviews are the only gate left.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This PR needs a maintainer before it can merge. The code review on this head found no blocking defect, but three things are still open:

  • The product call on Option to auto-sort sidebar folders so folders with unread activity move to the top #13410 is still open. The issue is labelled needs-human and parked, and the only decision on it is the one written for this fix. A maintainer should post there: is this opt-in, browser-local view wanted? Is it fine that a lifted folder drops back when its chat is opened by a touch tap or the keyboard? The hover freeze covers only a mouse or pen.
  • The change request from buluoray at 9f5b138 (the folder drops back when its unread chat is opened) has not been re-reviewed since the hover and drag freezes landed.
  • The PR edits docs/feature-map/README.md, so a person signs off the design.

Follow-up on my earlier review at d4d09a8:

What the review checked on this head:

  • The unread-first comparator is a consistent order that falls back to the stored order on ties, and the parent walk is guarded against loops.
  • The new-chat picker, the filter menu folder list and the hidden-folder reveal keep the stored order. Nothing writes order or folder_sort.
  • Each freeze source (dnd-kit drag, native board-card drag, list hover) and the on/off switch has its own render test that checks both the hold and the re-sort afterwards.

Well done: the view wraps the mode comparator, so turning it off gives back the stored order exactly, and a test proves no folder or folder mode is written.

Optional:

  • listHovered is set on every pointer enter and leave even with the option off, so the sidebar re-renders for nothing (ChatSidebar.tsx:455, :1059). Setting it only while foldersUnreadFirst is on would avoid that.
  • The persistence.ts row in docs/system-specs/modules/history.md:773 lists the keys filters.tsx reads. It could add the new folders-unread-first flag.
  • No test pins the stored order in the menu's Folders list or the hidden-folder reveal rows (ChatSidebar.tsx:658, :707). One case with the toggle on would cover both.

@buluoray buluoray 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.

Approve on ddc92ca. This PR adds an opt-in toggle, "Move folders with unread chats to the top", to the sort-and-filter menu under Folder order. It is off by default and kept in this browser only. When it is on, folders that hold an unread chat are drawn first, newest unread first; every other folder keeps the stored order. Nothing writes a folder's stored position or the folder mode, so turning it off gives back the old order exactly. The blocking point from my last review is fixed for a mouse or pen: while the pointer is over the list, or a drag runs, the drawn order is held, so the folder you just opened no longer jumps away. Each hold has its own test, and removing any one of them turns that test red. The maintainer has decided to take this now and to treat the remaining case as a known limitation: a folder can still drop back when its chat is opened by a touch tap, or from the keyboard while the pointer is outside the list. That case and the small follow-ups (the Italian and Portuguese drag notes, a test for the stored order in the filter menu's folder list, one menu picking a subfolder in drawn order, and the history spec's list of storage keys) are tracked in #36879. I found no correctness or security defect. This supersedes my change request at 9f5b138. Decisive lines: website/src/pages/ChatSidebar.tsx:455-467, website/src/pages/ChatSidebar.tsx:1059, website/src/pages/chat-sidebar/filters.tsx:244, issue #13410 (labels needs-human, parked, tier:T2)

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.

Option to auto-sort sidebar folders so folders with unread activity move to the top

3 participants