Skip to content

Cap open storage folders and keep folder state stable - #5155

Merged
brsbl merged 1 commit into
mainfrom
bb/info-panel-followups-thr_pkx7jnw5gf
Oct 7, 2026
Merged

brsbl merged 1 commit into
mainfrom
bb/info-panel-followups-thr_pkx7jnw5gf

Conversation

@brsbl

@brsbl brsbl commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The Slop Cop review of #5144 left five P2 follow-ups in the thread storage tree.

  • Slow sort: the tree sorted names with localeCompare and options, which builds a new collator on every comparison.
  • Merged folders closing: a merged single-child folder (qa/screenshots) remembered only its deepest path. When an agent wrote a file that split the chain, the open folder closed on its own.
  • State leaking between threads: the open-folder state lived on the thread view instance, so it carried over between threads.
  • Uncapped overflow: the "N more" cap counted only top-level entries. An opened folder rendered every child, and a selected file behind the top-level "N more" stayed hidden even though its folders opened.
  • Duplicate helper: the changed-file folder hint used a local parent-path helper that duplicated directoryFromPath from @bb/thread-view.

What changed

  • thread-storage-tree.ts sorts with one module-level Intl.Collator. Folder nodes carry chainPaths. Flattening caps each open folder's children at five and adds a "N more" row for that folder.
  • useThreadStorageBrowser:
    • opens and closes a whole merged chain together
    • tracks folders that show all their children
    • remembers the last selected file
    • resets folder state when threadId changes
  • InfoList takes a revealIndex and expands when that index is behind "N more". Its "N more" row is now InfoListMoreRow, which the tree reuses at depth.
  • ChangesSection uses directoryFromPath. The local getParentFolderPathFromPath is removed.

No API, CLI, SDK, persisted data or wire changes.

How you verified

The screenshots come from the branch web app at 2×, in headless Chrome for Testing through the Browser Automation plugin. Both sides use the same fixture thread: 24 storage files, including a logs/ folder with 10 files, and plan.md and summary.md behind the top-level "N more".

Before: 89f40e7 (main) · After: d545579 (PR head) · Captured at 2×

Screen / state Viewport Before After
Thread storage / 10-file folder opened Desktop · 1440×1800 Before: folder shows all 10 files After: folder shows 5 files and 5 more
Thread storage / folder "N more" clicked (main has no per-folder cap) Desktop · 1440×1800 Before: folder shows all 10 files After: folder shows all 10 files
Thread storage / merged deep/nested opened, then deep/top.md written Desktop · 1440×1800 Before: deep closed after the split After: deep and nested stay open
Thread storage / logs opened, switched to another thread and back Desktop · 1440×1800 Before: logs still open from before After: logs closed again
Thread storage / after opening summary.md from its tab Desktop · 1440×1800 Before: summary.md hidden behind 2 more After: list expanded to show summary.md
Thread storage / 10-file folder opened Mobile · 390×844 Before: folder shows all 10 files After: folder shows 5 files and 5 more

End-to-end QA on d545579 (headless Chrome for Testing 154 through the Browser Automation plugin) passed. It covered the folder cap and its "N more", a merged folder splitting while the panel was open, switching threads without a reload, and the console, which had no errors.

Unit tests:

  • per-folder cap, and the case where only one child would be hidden
  • chainPaths
  • opening and closing a merged chain together
  • resetting folder state on thread change
  • remembering the last selected file
  • InfoList revealIndex

The existing ordering tests cover the collator. Remote CI runs on the PR. Tests, typecheck and lint were not run locally.

Follow-up to #5144.

BB-Thread: Thread storage viz design
BB-Thread-ID: thr_pkx7jnw5gf

AGENT GENERATED

🤖 Generated with Claude Code

- Sort tree names with one shared collator instead of one per comparison.
- Open and close merged folder chains together so a folder stays open when
  a new file splits the chain.
- Reset open folders when the thread changes.
- Cap each open folder at five children with its own "N more" row, and
  expand the top-level list when the last selected file sits behind it.
- Use directoryFromPath for changed-file folder hints.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-10-07T23:12:00.103010Z d545579 PR opened
ℹ️ 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: d545579793

ℹ️ 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 on lines +418 to +420
if (revealIndex !== revealedIndex) {
setRevealedIndex(revealIndex);
if (revealIndex !== null && revealIndex >= limit) setIsExpanded(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset automatic list expansion when changing threads

When thread A selects a storage file past the top-level limit, this permanently sets isExpanded to true. Navigating to thread B can change revealIndex to null, but nothing collapses the same InfoList instance, so a second thread with many root entries displays everything and leaks thread A's visibility state. Reset or scope the expansion state to the storage/thread context while preserving manual toggles within one thread.

Useful? React with 👍 / 👎.

@brsbl
brsbl merged commit d18f6f2 into main Oct 7, 2026
28 checks passed
@brsbl
brsbl deleted the bb/info-panel-followups-thr_pkx7jnw5gf branch October 7, 2026 23:28
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