Conversation
|
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 (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe recoverable main-window route snapshot now checks tab-manager ownership before resolving the cached window. Non-ownable routes return ChangesRecoverable route ownership
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The ownership guard prevents the recursion path while preserving live routing for eligible managers; no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches🧪 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 |
|
You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard. |
|
All contributors have signed the CLA ✍️ ✅ |
`recoverableMainWindowRouteSnapshot(for:)` resolved the route's window before checking whether the route's tab manager can still own it. Resolving the window goes through `validatedRecoverableMainWindow` to `recoverableMainWindowRoute(windowId:)`, which retires a route whose manager can no longer own it. Retirement filters the route's workspaces through `tabManagerFor(tabId:)`, which snapshots orphaned routes again, so the cycle repeated until the stack overflowed. A test host crashed this way with 511 frames of the loop. Check the manager first. A route whose manager cannot own it has no snapshot either way, so the result is unchanged, and looking up a workspace's tab manager no longer retires routes as a side effect.
55c8142 to
2a8d6dc
Compare
|
You actually had this one first! You opened it on Sep 14 and we ended up landing the same fix days later without spotting your PR, which is on us. Closing since main has it now, but the credit is yours. Thank you for tracking it down :) |
Summary
Retiring a recoverable window route can recurse until the stack overflows. One crash report shows 511 frames of
tabManagerFor(tabId:)→contextContainingTabId→recoverableRouteWorkspaceIdsForRemoteTeardown→retireRecoverableMainWindowRouteIfCurrent→recoverableMainWindowRoute(windowId:)→validatedRecoverableMainWindow→windowForMainWindowId→recoverableMainWindowRouteSnapshot(for:), repeating.recoverableMainWindowRouteSnapshot(for:)resolved the route's window before checking whether the route's tab manager can still own it. Resolving the window goes throughvalidatedRecoverableMainWindowtorecoverableMainWindowRoute(windowId:), which retires a route whose manager can no longer own it. Retirement filters the route's workspaces throughtabManagerFor(tabId:), which snapshots orphaned routes again, so the cycle repeated.The snapshot now checks the manager before resolving the window. A route whose manager cannot own it has no snapshot either way, so the result is unchanged, and looking up a workspace's tab manager no longer retires routes as a side effect.
Testing
4638e5b1eaplus the compile fixes in Fix the compile errors that keep main and its unit tests from building #12584, throughscripts/ci/run-app-host-xcodebuild.shin 12 batches the way CI runs app-host tests, one crash report shows 511 frames of this recursion.Demo Video
Not applicable. The change prevents a crash and has no visible effect.
Review Trigger (Copy/Paste as PR comment)
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes a stack overflow crash when retiring a recoverable window route. The snapshot now validates the route's tab manager before resolving the window, breaking the recursion cycle. Route lookup no longer retires routes as a side effect; the snapshot result is unchanged.
Written for commit 2a8d6dc. Summary will update on new commits.
Summary by CodeRabbit