cmux-next sidebar: every row shows its pull request badge, not only with the session tree on
This is slice S3 of Leo's sidebar-organization ask (item A, the PR badge). It builds on #21814 (the session tree's pull request badges). The owner of #21836 cleared it: the only overlap is two small spots next to each other, and whichever PR lands second takes the conflict.
What changes
Every workspace row now carries its pull request badge: a glyph and a count, in the most urgent state's color, with the hover card. Before this, the badge only drew with sidebar.sessionTree on.
- Unchanged: the tree's nesting, guide lines and Command-number keycaps still need
sidebar.sessionTree, and manual order is untouched. - How:
SidebarSessionTreeFeedalso runs for the badges and publishes them apart from the tree state (SidebarSessionTree.pullRequests). The layout draws them whether or not the tree is on. - Redraws: a badge change redraws the list, and a group fold keeps its members' badges. The first review caught both.
- Cost: by default,
ghnow runs for anyone with agent chats, not only people who turned the tree on. It uses the reader the chat header's chip already shares: two calls at a time, never prompting, at most once every five minutes per folder or URL, with one batched GraphQL read for URLs. A failed read, including a missing or logged-outgh, keeps the last answers and backs off by doubling, up to 80 minutes. - Toggle: Debug toggle
sidebar.pullRequestBadges, on by default. Turning both it and the tree off stops the feed and itsgh pr viewchecks, as before.
Tests
Tests/CmuxNextAppTests/SidebarPullRequestBadgeTests.swift (committed first) covers three things:
- the feed publishes badges but no tree while the tree is off;
- a row draws its badge with no nesting and no keycaps;
- a badge that arrives or leaves after the first draw is drawn;
- the layout carries the badge in manual order.
No capture: a capture slot has no GitHub credentials, so no row there gets pull request data. The badge view and its drawing are unchanged from #21814, and the view-level tests above cover a drawn badge with the tree off.
Observed / Not run
- Ran:
- Not run locally: the Swift suites, which run in this PR's CI.
Changelog
- Changed: Sidebar rows show their pull request badge even with the session tree off.
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Every sidebar row now shows its pull request badge even with the session tree off; previously the badge only drew when sidebar.sessionTree was enabled.
- The session tree feed now runs just for the badges and publishes them separately from tree state (
SidebarSessionTree.pullRequests). - A new Debug toggle,
sidebar.pullRequestBadges, is on by default; the tree's nesting, guide lines, and Command-number keycaps still requiresidebar.sessionTree. - A badge change redraws the list, and folding a group keeps its members' badges.
ghnow checks pull requests for anyone with agent chats, not only tree users: two concurrent calls, never prompting, at most once per five minutes per folder or URL, with backoff (doubling, up to 80 minutes) on failure.- Tests cover the publish path, a row's badge with the tree off and in manual order, and badges that arrive or leave after first draw.