Repository navigation
fix(dock): clear stale workspace unread counts - #24877
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the single commit 012c0f6 reviewed end to end (7 files, +278/−104).
- The Dock count now reads workspace flags only —
src/renderer/src/lib/unread-badge-count.ts: drops the tab-marker scan entirely and counts unread, non-archived worktrees (deduped bygetWorktreeHostIdentity, so arepo::pathid on two hosts counts as two rows) plus unread folder workspaces. - Floating terminal counted via its launcher dot —
src/renderer/src/hooks/useUnreadDockBadge.ts: newfloatingTerminalOpenarg adds 1 whilefloatingTerminalEnabled && selectFloatingWorkspaceHasUnread(s)and the panel is closed, matchingFloatingTerminalToggleButton.showAttentionDotand the status-bar dot (both!open && hasUnread). - Cache projection narrowed —
createUnreadBadgeCountSelectornow keys on the worktree projection (id/hostId/isUnread/isArchived) plusfolderWorkspacesarray identity, instead oftabsByWorktree/unreadTerminalTabs. - Tests — store-level tests drive real actions (bell then visit, sibling tab, unified chat tab, folder workspace, archive in place, same id on two hosts); the hook test covers the floating terminal with the panel open/closed and the feature off.
The load-bearing premise checks out: the sidebar dot is driven purely by Worktree.isUnread (WorktreeCardStatusSlot.tsx:231), folder rows render through folderWorkspaceToWorktree → WorktreeCard so FolderWorkspace.isUnread is the same signal, and every producer (bell, structured completion, manual toggle, activation) writes that flag. Folder workspaces are deliberately not archive-filtered by the sidebar (getRenderableFolderWorkspaces), so counting archived folder flags is parity rather than an oversight. Tests are meaningful — each selector case produces a different Dock number on main than after the change.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughUnread badge counting now reflects visible unread worktrees and qualifying folder workspaces, with host and device visibility filters. The selector recalculates when count-relevant state changes. The Dock hook also counts an unread floating terminal when its launcher is enabled and the panel is closed. Priority: ➖ Normal Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to No actionable badge-count issue remains established; the change is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change adjusts which unread activity contributes to the Dock badge. The reviewed flow sends only a numeric count and does not grant access to workspaces, hosts, or their contents. No material security risk was found in this change. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation For [ Full details: Out of Scope Changes checkExplanation The Dock selector, hook, App wiring, and related tests support [
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
012c0f6 to
7adb205
Compare
nwparker
left a comment
There was a problem hiding this comment.
Dock badge derives the same visible workspace unread dots, including folder/remote identity and archived/floating policy. Narrow stable selectors keep unrelated terminal activity from rerendering shell. 18 tests and web typecheck pass.
Required PR Checks verify passed on this exact commit: 7adb205385fdd1fc767fd9cbb5352a04cac4f616.
nwparker
left a comment
There was a problem hiding this comment.
The orphan tab-marker fix is sound, but this head introduces another unfindable Dock count through its expanded workspace counting.
At head 7adb205385fdd1fc767fd9cbb5352a04cac4f616, take one unread SSH folder workspace, no unread tab markers, and select only the local host in the sidebar. The baseline count is 0; this PR changes it to 1, while the existing sidebar host filter renders 0 folder rows. I reproduced those outputs using the exact baseline/head count functions and the head's existing filterFolderWorkspacesForVisibleHosts function. The new unconditional folder loop is unread-badge-count.ts:33; the sidebar excludes that host at host-filtering.ts:49. Similarly, two unread same-id worktrees on local and SSH hosts now count 2 instead of 1, even when only one host is visible.
CodeRabbit's visibility warning therefore includes a newly introduced case, beyond the existing working-agent cue issue tracked in #24193. Before merging, make newly counted folder/host rows follow the existing sidebar visibility policy, or keep this change narrowly scoped to removing stale tab-marker contributions. Add a regression for the local-only sidebar/unread SSH folder case and preserve the existing render-isolation tests so the fix does not wake the App root for unrelated terminal updates.
The bot's separate 80% docstring warning does not warrant boilerplate: this repository requires concise non-obvious comments, and the changed mechanisms explain their rationale. CI and the scoped tests passed this exact head, but they do not cover the filtered-folder regression above.
7adb205 to
f4ac358
Compare
There was a problem hiding this comment.
Important
The new commit makes both row types follow the sidebar's host filter, but the sibling "hide workspaces from other devices" filter is applied only to folder workspaces. An unread worktree hidden by that toggle still lights the Dock — the same unfindable-count class this PR fixes.
Reviewed changes — the delta since the prior pullfrog review (7adb205 → f4ac358): the count now derives from the sidebar's visibility pipeline.
- Worktree and folder counts follow the sidebar host filter —
getUnreadBadgeCountnow takes a sources object and drops archived worktrees plus any row whose execution host is not in the visible set; folder rows additionally run through the same host/group/device steps the sidebar uses before building rows (filterFolderWorkspacesForVisibleHosts→filterFolderWorkspacesFromOtherDevices→getRenderableFolderWorkspaceswithfilterProjectGroupsForVisibleHosts). - Cache key reads the new inputs —
createUnreadBadgeCountSelectorreplaced the tab-map projection withsameCountInputs: folder/group/repo/scope identities, focused execution host, and runtime env+status gated on the other-device toggle. - Tests — new cases cover an SSH folder hidden until its host is shown, a repo/project-group host change recounting, and one id on two hosts counted once per shown host.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Addressed the reproduced host-filter/folder-count concern on
Validation: 88 tests across 11 suites, official renderer typecheck, changed-code quality, and standalone React Doctor passed. Worktree and folder title-frame tests prove no App render or count-rescan churn. The shared duplicate journal import CI repair was reused and its focused tests passed. Fresh CI is required for this exact head before approval or merge. |
4c1785d to
8dc23ee
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (f4ac358 → 5cec080; the branch was rewritten, so this range-diff covers the whole series). The prior inline concern — worktree rows ignoring the other-device filter — is addressed.
- Folder rows now require a live owned marked tab —
getUnreadBadgeCountcounts an unread folder only whenhasUnreadFolderTabfinds a marked terminal tab oragent-sessionunified tab underfolder:<id>, so flag-only folders and orphan markers no longer contribute; rows are deduped by folder id. - Worktree rows honor the other-device filter — the worktree loop now drops rows hidden by "Hide workspaces from other devices" via
isWorkspaceFromOtherDevice, matching the folder branch andcomputeVisibleWorktrees. - Deduplication reverts to id-only — same-id rows on two hosts count once again (main's behavior) instead of once per shown host.
- Selector cache tracks the new inputs —
sameBadgeWorktreecompares creator provenance and runtime owner;sameFolderAttentionre-derives folder contributions when the tab maps change. - Migration + hook coverage — new
unread-badge-count-migration.test.tsasserts the new count never exceeds the old across 8,192 flag/owner/marker × host/group/device combinations; the hook test adds folder title frames and floating-terminal open/closed/off. - Shared test repairs — restored the journal test's
codexProviderHandleimport and updated the Windows startup-prompt test for the encoded physical launch line.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (5cec080 → 4c724e1):
- Retained the released journal parser as a test-only dependency —
@streamparser/[email protected]added todevDependencieswith the matchingpnpm-lock.yamlimporter/package/snapshot entries, and a comment intests/e2e/cross-version-wire/release-checkout.tsrecords why: extracted release sources still import it, so the cross-version harness needs it resolvable from the repo root.
The dependency is not imported anywhere under src/, so it stays test-only, and the lockfile importer entry matches package.json. No production code changed. (The release-checkout helper suite itself needs release tags and writable git refs, which this shallow review checkout lacks, so those cases cannot run here — the failure is environmental, not from this commit.)
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Tab markers outlive the workspace unread flag, so the badge could sit at 1 with no sidebar dot to find or clear. Fixes stablyai#23363
Counting folder workspaces and per-host rows by flag put rows on the Dock that a host-scoped sidebar does not show.
4c724e1 to
0bcd08b
Compare
|
@coderabbitai resume @coderabbitai review Please review the current head |
|
|
@coderabbitai full review Please review the current rebased head |
✅ Action performedFull review finished. |
nwparker
left a comment
There was a problem hiding this comment.
Low merge risk after the final repairs. Workspace unread counts require a live owned unread marker and respect host/device policy. The repair preserves legitimate folder alerts and baseline worktree deduplication. 207 focused integration tests, both typechecks, and quality gates pass. The full PR Checks workflow and all runnable CI on this exact head have passed, and review findings are addressed. Pullfrog was manually disabled repository-wide and its integration-review run cancelled; the stale pending bot check is documented. The feature code is unchanged from its completed bot-reviewed state, and this integration was reviewed manually.

ELI5
The number on Orca's Dock icon should mean "this many workspaces have something new". It could say 1 while no workspace in the sidebar had an unread dot, so there was nothing to click to make it go away. The Dock now clears those stale counts when the workspace is visited, without clearing the tab highlight.
What Changed
Before: a terminal bell in workspace W lit W's sidebar dot and set the Dock to 1. Clicking W, or typing in another tab of W, cleared the dot but left the Dock at 1 until you clicked or typed in the exact tab that rang. A marked agent chat tab made its workspace count twice.
After: the Dock counts:
A bell in a background tab still highlights that tab in its workspace's tab strip. It no longer holds the Dock on its own.
Mechanism: Git worktrees contribute through their unread workspace flag. Folder workspaces require both that flag and a marked tab owned by the live workspace. Orphan markers contribute nothing, multiple marked tabs in a folder count once, and clearing the workspace flag clears its Dock contribution. Host and folder membership use the sidebar's existing functions. The App subscribes to a cached integer; folder title changes do not invalidate that count.
Why
A count the sidebar can't explain is the bug. Alternatives considered:
The scope stays narrow: clear stale Dock counts without changing how tab highlights are stored or cleared. Existing folder notifications stay available.
Linked Issue
Fixes #23363
Visual Proof
N/A: the Dock icon is drawn by macOS outside the app window, and I have no before/after capture of it.
Testing
New store-level tests drive the real actions for each route (bell then visit, bell in a sibling tab, marked chat tab, folder workspace, archive in place, same id on two hosts, and a sidebar scoped to the local host with an unread SSH folder workspace or a two-host workspace). They fail on main with the Dock at 1 or 2 where the sidebar shows 0 or 1.
Hook tests cover the floating terminal with the panel closed, open, and the feature off, plus worktree and folder title frames that do not re-render the App root.
A migration test compares the workspace count against the old count across 256 flag/owner/marker combinations, each with 32 host, group (including collapsed), and device-policy combinations. The new count never exceeds the old count.
Latest combined head: 140 tests across 14 suites passed, along with the official renderer and main-process typechecks, changed-code quality gate and standalone React Doctor. A shared main-branch integration repair restores the journal test's required provider-handle import; its five tests passed too. The shared Windows startup-prompt expectation repair adds a test for one physical escaped command line; 40 startup tests passed. Released-snapshot compatibility also retains its exact parser dependency as dev-only; 10 release-checkout helper tests passed.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)