Repository navigation
fix: hold Auto Refresh when Editor starts unfocused (external scene dialog/crash) - #1757
Conversation
Background launch never fires focusChanged(false), so DisallowAutoRefresh was never armed and native HandleOpenScenesChangeOnDisk could dialog or segfault on external scene edits. Arm Hold from Initialize, reconcile on throttled update, and only set SessionState after Disallow/Allow succeed. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe focus return service now guards Unity auto-refresh hold and release operations, logs failures, and exposes focus reconciliation methods. The scene tracker performs throttled reconciliation during editor updates, handles initially unfocused startup states, and records richer focus-return diagnostics. Tests cover idempotence, retries, release ordering, and exceptions. ChangesFocus-aware auto-refresh handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant EditorApplication
participant ExternalSceneChangeTracker
participant ExternalAssetFocusReturnService
participant UnityAutoRefresh
EditorApplication->>ExternalSceneChangeTracker: invoke throttled update callback
ExternalSceneChangeTracker->>ExternalAssetFocusReturnService: reconcile hold with focus
ExternalAssetFocusReturnService->>UnityAutoRefresh: disallow or allow auto-refresh
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
Clean-gate held probes previously ran blind when ODE was busy; structured hold/focus/resolve events make dialog timing correlatable without relying on Editor.log alone. Co-authored-by: Cursor <cursoragent@cursor.com>
|
LGTM (reviewed by Fable on behalf of the review flow; same-account approval unavailable). Reviewed the full 345-line diff plus the observability commit bf2aa9a:
Follow-ups recorded in group5 umbrella notes: warning backoff if Disallow persistently fails, narrowing catch(Exception) once the real exception type is confirmed, and the group-3 residual (DynamicCodeExecutionScheduler slot stuck across domain reload with an idle Roslyn worker). |
Summary
DisallowAutoRefreshimmediately (not only onfocusChanged(false))User Impact
uloop launchin the background never fired focus-lost, so Auto Refresh stayed enabled. External Scene edits (e.g. git discard) then hit Unity’s nativeEditorSceneManager::HandleOpenScenesChangeOnDiskpath → reload/ignore dialog, and in at least one local run a native SIGSEGV that killed the whole EditorResolveForCompileReal-world crash evidence (pre-fix)
~/Library/Logs/Unity/Editor-prev.log(~22:27 session), after loadingRaycastAnnotationPerspectiveDemoScene:This is the native external-scene-change path this PR bypasses by holding Auto Refresh until uloop can resolve quietly.
Design choices (from approved answers)
Verification
uloop compile— 0 errors / 0 warningsuloop run-testsfilterExternalSceneChangeResolverTests— 23 passed (incl. vibe hold log tests)focused=False;held=True→ discard → first focus → no dialog / no crash/tmp/claude-shared/pr-5-2-clean-gate-result.md(+ vibe timeline + Editor-prev.log Loaded scene before Refresh)EditorApplication.isFocused+ SessionState...AutoRefreshHeld; proves hold armed before discard/focus (not dialog absence alone)Test plan
hold_armedat launch; no permanent Disallow desync observed)Made with Cursor