Skip to content

Clear Dock notifications on keyboard focus - #9427

Merged
austinywang merged 5 commits into
mainfrom
issue-9415-dock-keyboard-focus-dismissal
Sep 10, 2026
Merged

austinywang merged 5 commits into
mainfrom
issue-9415-dock-keyboard-focus-dismissal

Conversation

@austinywang

@austinywang austinywang commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • route right-sidebar keyboard entry into the Dock through the shared user-focus transaction
  • keep low-level Dock selection separate for restore, creation, and attention-routing paths
  • strengthen the regression test to exercise the real focusFirstControl path and verify unread projection, count, badge derivation, and dismissal flash

Root cause

PR #9418 added the correct Dock interaction transaction, but the regression test called that helper directly. The real right-sidebar keyboard entry path still selected the Bonsplit pane and focused its panel through focusFirstControl without invoking notification dismissal.

This follow-up makes keyboard entry use the same transaction as Dock pointer clicks, shortcuts, and focus history.

Testing

Follow-up to #9418.

Closes #9415


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Dismisses Dock unread notifications on keyboard entry by routing focus through the Dock interaction path, aligning behavior with clicks, shortcuts, and focus history. Closes #9415.

  • Bug Fixes
    • Route focusFirstControl() through focusPanelFromDockInteraction to trigger dismissal and ensure the panel receives focus.
  • Tests
    • Rename the regression test to cover keyboard entry, assert focus() is called on the panel, and verify unread/badge clearing.

Written for commit cb74c27. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Improved coverage for keyboard navigation and focus behavior in the test panel.
    • Updated unread-notification validation to confirm that keyboard-based focus correctly reaches the intended control.

Note

Low Risk
Changes are limited to Dock parity tests and a test panel stub; no production behavior is modified in this diff.

Overview
Updates the Dock runtime parity regression so unread dismissal is exercised through focusFirstControl() (right-sidebar keyboard entry) instead of calling focusPanelFromDockInteraction directly.

The test double now counts focus() invocations, and the case is renamed to keyboard entry into a window Dock so it asserts unread projection, total unread count, dock badge label, and dismiss flash still clear when entry goes through the real first-control path.

Reviewed by Cursor Bugbot for commit cb74c27. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 45024ea5-dd93-4976-8d43-7f39d9f4f685

📥 Commits

Reviewing files that changed from the base of the PR and between d9030b2 and cb74c27.

📒 Files selected for processing (1)
  • cmuxTests/DockRuntimeParityTests.swift

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The runtime parity test now tracks panel focus calls and validates keyboard entry through focusFirstControl() instead of directly focusing the panel.

Changes

Dock focus behavior

Layer / File(s) Summary
Validate Dock keyboard focus
cmuxTests/DockRuntimeParityTests.swift
The test panel counts focus() calls. The unread-notification test enters through dock.focusFirstControl() and verifies one panel focus call.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Medium

Suggested reviewers: lawrencecchen

Merge Risk: ⚪ Minimal · up to cb74c

This change strengthens regression coverage for Dock keyboard focus and unread-notification dismissal without changing production behavior. It is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 23 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The regression test covers the requirements in [#9415], but the provided file summary shows only test changes and no production implementation. The pull request therefore does not itself clear notific… Add the production change that routes right-sidebar keyboard entry through the shared Dock focus transaction and clears the pane unread state, in-app notification indicator, and derived macOS Dock badge. Keep the regression test to verify t…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (23 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the intended Dock notification behavior and keyboard-focus path. It does not state that the changes are test-only, but it remains directly related to the pull request.
Description check ✅ Passed The description includes a detailed summary, root cause, testing results, and verification evidence. It omits the Demo Video section, review trigger, and checklist, but the core required information i…
Out of Scope Changes check ✅ Passed The changes are limited to the Dock runtime parity test and its test panel stub. These changes directly support the linked notification-dismissal issue and no unrelated code changes are identified.
Cmux Swift Actor Isolation ✅ Passed PASS: The authoritative PR diff changes only cmuxTests/DockRuntimeParityTests.swift. The added focusCount state and focus() behavior are test-fixture code, and the updated keyboard-entry asserti…
Cmux Swift Blocking Runtime ✅ Passed PASS — The pull request changes only cmuxTests/DockRuntimeParityTests.swift. It adds deterministic test scaffolding (focusCount and an increment in the test panel’s focus() method) and changes t…
Cmux Browser Automation Off-Main ✅ Passed PASS. The authoritative PR diff changes only cmuxTests/DockRuntimeParityTests.swift. It adds panel focus tracking and changes a Dock notification test to call focusFirstControl(). The patch contai…
Cmux Expensive Synchronous Load ✅ Passed PASS. The authoritative PR diff changes only cmuxTests/DockRuntimeParityTests.swift. It adds a test-only focusCount counter and replaces a direct test helper call with focusFirstControl(). The d…
Cmux Cache Substitution Correctness ✅ Passed PASS. The reviewed range changes only cmuxTests/DockRuntimeParityTests.swift; no production Swift, TypeScript, or JavaScript file changed. The patch adds a test panel focusCount and changes the re…
Cmux No Hacky Sleeps ✅ Passed PASS. The authoritative diff changes only cmuxTests/DockRuntimeParityTests.swift, which is Swift test code. The rule explicitly scopes TypeScript, JavaScript, shell, and non-Swift build/runtime scri…
Cmux Algorithmic Complexity ✅ Passed PASS. The authoritative diff changes only cmuxTests/DockRuntimeParityTests.swift (+8/-4); no production Swift, TypeScript, JavaScript, shell, or runtime file changes exist. The additions are test-pa…
Cmux Swift Concurrency ✅ Passed PASS. The reviewed range changes only cmuxTests/DockRuntimeParityTests.swift. It adds a synchronous focusCount counter and changes the test to call the existing synchronous focusFirstControl() p…
Cmux Swift @Concurrent ✅ Passed PASS. The reviewed range changes only cmuxTests/DockRuntimeParityTests.swift. It adds synchronous focusCount bookkeeping to an already @MainActor test panel and changes the existing async test t…
Cmux Swift Package Boundaries ✅ Passed PASS. The reviewed range changes only cmuxTests/DockRuntimeParityTests.swift. The diff adds focus tracking to a private test fixture and changes a regression test to use focusFirstControl(). It in…
Cmux Swiftpm Lockfiles ✅ Passed The authoritative PR diff contains only cmuxTests/DockRuntimeParityTests.swift. It changes test-panel focus tracking and the keyboard-entry test, with no Package.swift, Package.resolved, `.gitig…
Cmux Swift Logging ✅ Passed PASS. The pull request changes only cmuxTests/DockRuntimeParityTests.swift, which is test code allowed by the rule. The added lines track focus calls and update test expectations. They add no `print…
Cmux User-Facing Error Privacy ✅ Passed The authoritative PR diff changes only cmuxTests/DockRuntimeParityTests.swift. The changes add test-panel focus tracking and update a regression test to use focusFirstControl(). No production code…
Cmux Full Internationalization ✅ Passed PASS: The authoritative diff changes only cmuxTests/DockRuntimeParityTests.swift (+8/-4). The changes add test instrumentation and update a test name and assertions. The added strings are test descr…
Cmux Swiftui State Layout ✅ Passed PASS. The pull request changes only cmuxTests/DockRuntimeParityTests.swift. It adds a plain focusCount property and increments it in the test panel's focus() method. The existing `ObservableObje…
Cmux Architecture Rethink ✅ Passed PASS. The authoritative PR diff changes only cmuxTests/DockRuntimeParityTests.swift; no production Swift file changes. The patch adds focusCount to a test-only DockRuntimeParityPanel double and …
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The pull request changes only cmuxTests/DockRuntimeParityTests.swift. The diff adds focusCount to the private DockRuntimeParityPanel test fixture and changes one test to call `focusFirstCo…
Cmux Source Artifacts ✅ Passed PASS. The PR changes only cmuxTests/DockRuntimeParityTests.swift, a hand-written Swift test file. The patch adds focus-call tracking and updates a regression test. No logs, screenshots, recordings, …
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS. The authoritative diff changes only cmuxTests/DockRuntimeParityTests.swift; it contains no Swift file under a production Sources/ path. The added focusCount member and focus() instrument…
Cmux No Ambient Global State ✅ Passed PASS. The reviewed range changes only cmuxTests/DockRuntimeParityTests.swift, not production Swift code. The added focusCount is a private(set) instance property on the private test panel, and `…
Full details: Linked Issues check

Explanation

The regression test covers the requirements in [#9415], but the provided file summary shows only test changes and no production implementation. The pull request therefore does not itself clear notifications when a Dock pane receives focus.

Resolution

Add the production change that routes right-sidebar keyboard entry through the shared Dock focus transaction and clears the pane unread state, in-app notification indicator, and derived macOS Dock badge. Keep the regression test to verify this behavior through focusFirstControl().

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-9415-dock-keyboard-focus-dismissal

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmuxTests/DockRuntimeParityTests.swift`:
- Line 297: Update the assertion in the DockRuntimeParityTests focus test to
verify that the first control in the test panel actually received focus, using
the panel’s focus state or focus callback/count rather than only asserting the
return value of focusFirstControl().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0ec92e06-2fee-46b4-842b-984f784f7068

📥 Commits

Reviewing files that changed from the base of the PR and between 7dff5ec and 29f5f16.

📒 Files selected for processing (2)
  • Sources/DockSplitStore+PaneFocus.swift
  • cmuxTests/DockRuntimeParityTests.swift

Comment thread cmuxTests/DockRuntimeParityTests.swift
@austinywang

Copy link
Copy Markdown
Contributor Author

Regarding the algorithmic-complexity note: focusFirstControl runs only when focus enters the Dock or its registered focus host, not for ordinary Dock keystrokes. Re-resolving the selected panel inside focusPanelFromDockInteraction keeps one authoritative selection and dismissal transaction and avoids accepting stale pane or tab identities. Dock pane counts are bounded and small, so adding an index or a second pre-resolved mutation seam would increase consistency risk without improving a hot path.

austinywang and others added 2 commits September 9, 2026 19:09
Resolves conflicts in the Dock keyboard-focus path:

- Sources/DockSplitStore+PaneFocus.swift: keep main's focusFirstControl(),
  which already routes through focusPanelFromDockInteraction (#10340) and
  focuses the panel via reassertDockPanelInputFocus, so the branch's extra
  panel.focus() call is dropped.
- cmuxTests/DockRuntimeParityTests.swift: keep main's new
  notificationOpensOnlyRenderedWindowDockPanels test alongside the branch's
  renamed keyboardEntryIntoWindowDockDismissesUnreadNotification test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSMiqTxhCoebgiVkBKgNRm
Clean merge, no conflicts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux166 Ready Ready Preview Sep 10, 2026 8:26am UTC
cmux41 Ready Ready Preview Sep 10, 2026 8:26am UTC

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@austinywang
austinywang merged commit e61ac8b into main Sep 10, 2026
30 of 33 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 10, 2026
803dc26 Fix Codex hook injection paths with spaces (manaflow-ai#11968)
1769fd2 Fix Cloud discovery stalls and private address fallback (manaflow-ai#12266)
dc5df2b Fix misplaced XCStrings localization entries (manaflow-ai#12171)
02d7597 ci: persist nightly Xcode compilation caches (manaflow-ai#12039)
1216d7c Fix native pane layout sync with bound cloud workspaces (manaflow-ai#12264)
40c1b73 Improve Computer Use onboarding and permission companion lifecycle (manaflow-ai#12265)
8229d75 ci: isolate Computer Use helper notarization tickets (manaflow-ai#12262)
2b75bd1 Fix bash PROMPT_COMMAND export leak (manaflow-ai#11257) (manaflow-ai#11290)
e61ac8b Clear Dock notifications on keyboard focus (manaflow-ai#9427)
dfccbd1 Fix cloud VM verification fixtures and agent login context (manaflow-ai#12258)
8ba29ea Cloud: one machine, one devbox snapshot ladder with displays; restore the original New Machine modal; refresh the agents to Claude Code 2.1.267 and Codex 0.154.0 (manaflow-ai#12250)
6810da8 cloud: cmux Cloud terminals run as cmux, not root (manaflow-ai#12101)
aerickson pushed a commit to aerickson/cmux that referenced this pull request Sep 13, 2026
* test: cover Dock keyboard focus notification dismissal

* fix: dismiss notifications on Dock keyboard focus

* test: verify Dock panel receives keyboard focus

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
Preview – cmux41 — cb74c279 Deployed Sep 10, 2026 by vercel[bot]
Preview – cmux166 — cb74c279 Deployed Sep 10, 2026 by vercel[bot]
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.

Dock notifications don't clear when focusing the pane that raised them

1 participant