Repository navigation
Fix Cmd+Z stale undo target crash (#7272) - #12570
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe change adds per-view WebKit undo managers to browser, Markdown, agent session, and extension sidebar views. It routes undo and redo events to focused terminal or WebKit views before AppKit handling and consumes events without an owning surface. Tests cover these paths. ChangesUndo and redo routing
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: High Sequence Diagram(s)sequenceDiagram
participant NSEvent
participant NSApplication
participant NSWindow
participant CmuxTerminal
participant CmuxUndoableWebView
NSEvent->>NSApplication: send Cmd+Z or Cmd+Shift+Z
NSApplication->>NSWindow: resolve active window and route command-equivalent
NSWindow->>CmuxTerminal: deliver event when terminal is focused
NSWindow->>CmuxUndoableWebView: deliver event when WebKit view owns first responder
NSWindow-->>NSApplication: consume event when no surface owns it
Merge Risk: ⚪ Minimal · up to No unresolved merge-blocking risk is established by the available evidence. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 7 files. (1 skipped: 1 too large.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
fce8897 to
b5ea44d
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
b5ea44d to
da57235
Compare
da57235 to
61eedef
Compare
4638e5b Merge pull request manaflow-ai#12570 from manaflow-ai/issue-7272-undo-stack-crash 61eedef fix: isolate web undo targets before app menu routing c83dc7f Merge pull request manaflow-ai#12562 from manaflow-ai/issue-12532-agent-notification-flaky bfe1d3f Merge pull request manaflow-ai#12571 from manaflow-ai/issue-12547-nightly-provider-duplicates-guard f0d1635 chore: remove Cloud provider Release compile guard 509e806 Merge pull request manaflow-ai#12569 from manaflow-ai/issue-12567-cloud-machine-connectivity a5410da diagnostics(cloud): correlate machine terminal attachment state 7f6de01 test: reproduce application and markdown undo lifetime crashes 720f24a fix: close contextual signal matcher 50e3416 test: preserve numeric crash signal diagnosis d21502d test: exercise selected semantic suite reporting 3a0aff2 fix: retain contextual signal crash markers 16b9e75 test: preserve contextual signal crash diagnosis 557bb90 fix: trigger semantic workflow for classifier changes 46f0ba7 test: cover non-crash signal text 3824276 fix: avoid matching build signatures as signals 7079066 test: ignore build signatures in app-host causes # Conflicts: # .github/workflows/agent-notification-tests.yml
Fixes #7272
Cmd+Z could reach AppKit's shared window
NSUndoManagerafter browser or terminal focus churn. WebKit edit commands from a closed view remained on that stack, and AppKit later sent_undoRedoTextOperation:to the stale target.This PR establishes one ownership boundary and keeps terminal/browser behavior intact:
NSApplication.sendEventseam through the focused cmux surface before AppKit menu dispatch.UndoManager; page edit registrations cannot cross view lifetimes.Trade-off: the shared WebKit base class expands the isolation guarantee to every app-owned embedded
WKWebView, including views that are not browser panels, because each can host editable content. No user-facing strings or shortcut settings changed.Validation:
python3 scripts/swift_file_length_budget.py(pass; no budget TSV changes)./scripts/lint-pbxproj-test-wiring.sh(pass)python3 scripts/check-package-resolved-policy.py(pass)test-e2e.ymlandtest-depot.ymlfocused runs were attempted on pushed commits. They reached the macOS compiler but were blocked before test execution by pre-existingorigin/mainerrors inSources/Surfaces/CmuxTuiSurfaceProvider+CloseTerminal.swift/CmuxTuiSurfaceProviders.swift(private member access and related missing helper diagnostics); no Cmd+Z segfaults the app: EXC_BAD_ACCESS in -[NSUndoManager undoNestedGroup] (stale undo target) #7272 assertion ran.reload-cloud.sh; the direct backend hostname did not resolve, and the backend-off retry reached the cloud compiler but failed on the same pre-existingCmuxTuiSurfaceProviders.swifterror. No local compile or launch was performed.The source-level regression path is deterministic and the fix is isolated to undo ownership/routing. Runtime dogfood remains blocked by the repository baseline compile failure and cloud runner/backend reachability.
Summary by CodeRabbit
Bug Fixes
Tests