Skip to content

fix: pause-point disconnect no longer leaves Play Mode stuck; quiet-save before CLI Play#1756

Merged
hatayama merged 2 commits into
v3-betafrom
feature/pause-playmode-guards
Jul 13, 2026
Merged

fix: pause-point disconnect no longer leaves Play Mode stuck; quiet-save before CLI Play#1756
hatayama merged 2 commits into
v3-betafrom
feature/pause-playmode-guards

Conversation

@hatayama

@hatayama hatayama commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pause-point hits no longer leave Play Mode stuck paused after CLI disconnect, Clear, or capture-window expiry
  • CLI control-play-mode Play quietly saves dirty Scenes / Prefab Stage before Edit→Play (same path as run-tests)

User Impact

  • Before: An abandoned pause-point pause blocked screenshot / simulate-* with “PlayMode is paused”; dirty Scene dialogs could stall CLI Play start
  • After: Clear / expiry / mid-request disconnect / DisconnectAllClients resume Play Mode; Edit→Play auto-saves dirty editor assets or fails with an explicit list
  • Trade-off (approved Option B): pause-point auto-resume also clears a manual Editor pause if one happens to be active—no ownership distinction
  • Resume-from-pause does not rewrite Scene assets (SaveScene is ineffective while already playing)

Sub-PRs (already merged into this branch)

PR Change
#1754 Resume Play Mode when pause-point markers clear, expire, or CLI disconnects mid-request (pending flag + main-thread apply)
#1755 Quietly save dirty Scenes before CLI Play Mode start via shared EditorUnsavedChangesQuietSaver

Out of scope

  • Domain reload residual pause handling

Test plan

  • CI green on this PR (Compile Check should run because base is v3-beta)
  • Manual: pause-point hit → Clear / wait past timeout / kill mid-request → Play Mode resumes
  • Manual: after await-pause-point Hit, short commands do not resume until Clear/expiry
  • Manual: dirty a Scene → uloop control-play-mode --action Play → Scene saved, Play starts
  • Manual: resume from pause → no unexpected Scene rewrite

Made with Cursor

Review in cubic

hatayama and others added 2 commits July 13, 2026 19:20
…k paused (#1754)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 51120cb8-1dfc-4f3d-9550-8f14fb958bd8

📥 Commits

Reviewing files that changed from the base of the PR and between bc1233a and b9a6216.

⛔ Files ignored due to path filters (3)
  • Packages/src/Editor/FirstPartyTools/Common/EditorUtility/EditorUnsavedChangesQuietSaver.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/Common/EditorUtility/IEditorUnsavedChangesQuietSaver.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/ControlPlayMode/UnityCLILoop.FirstPartyTools.ControlPlayMode.Editor.asmdef is excluded by none and included by none
📒 Files selected for processing (21)
  • Assets/Tests/Editor/ControlPlayModeUseCaseTests.cs
  • Assets/Tests/Editor/PausePointCaptureModeTests.cs
  • Assets/Tests/Editor/PausePointTests.cs
  • Assets/Tests/Editor/PausePointToolModeTests.cs
  • Assets/Tests/Editor/SourcePausePointCapture/SourcePausePointCaptureTests.cs
  • Assets/Tests/Editor/SourcePausePointPatcher/SourcePausePointPatcherTests.cs
  • Assets/Tests/PlayMode/KeyboardInputSimulationResponseFactoryTests.cs
  • Assets/Tests/PlayMode/MouseInputSimulationResponseFactoryTests.cs
  • Assets/Tests/PlayMode/SimulateKeyboardTests.cs
  • Assets/Tests/PlayMode/SimulateMouseInputTests.cs
  • Packages/src/Editor/FirstPartyTools/Common/EditorUtility/EditorUnsavedChangesQuietSaver.cs
  • Packages/src/Editor/FirstPartyTools/Common/EditorUtility/IEditorUnsavedChangesQuietSaver.cs
  • Packages/src/Editor/FirstPartyTools/ControlPlayMode/ControlPlayModeUseCase.cs
  • Packages/src/Editor/FirstPartyTools/RunTests/TestExecutionStateValidationService.cs
  • Packages/src/Editor/Infrastructure/UnityCliLoopBridgeClientDisconnectMonitor.cs
  • Packages/src/Editor/Infrastructure/UnityCliLoopBridgeClientSessionManager.cs
  • Packages/src/Runtime/PausePoints/IUloopPausePointPauseController.cs
  • Packages/src/Runtime/PausePoints/UloopPausePointEntry.cs
  • Packages/src/Runtime/PausePoints/UloopPausePointRawCaptureLifecycle.cs
  • Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
  • Packages/src/Runtime/PausePoints/UnityEditorPausePointPauseController.cs

📝 Walkthrough

Walkthrough

The PR adds shared quiet saving for dirty Unity scenes and Prefab Stages, blocks Play mode when saving fails or changes remain, and extends pause-point resume handling for clearing, capture expiry, and client disconnects.

Changes

Unsaved editor changes

Layer / File(s) Summary
Quiet saver contract and implementation
Packages/src/Editor/FirstPartyTools/Common/EditorUtility/*
Defines the quiet-saver interface and implements dirty scene and Prefab Stage detection, saving, failure collection, and display-path formatting.
Test validation saver integration
Packages/src/Editor/FirstPartyTools/RunTests/TestExecutionStateValidationService.cs
Injects the shared saver into test execution validation and removes the previous local scene and Prefab Stage save implementation.
Play-mode save gate
Packages/src/Editor/FirstPartyTools/ControlPlayMode/ControlPlayModeUseCase.cs
Saves and rechecks editor changes before Edit-to-Play transitions, returning an unchanged failure response when saving fails or changes remain.
Play-mode save-gate tests
Assets/Tests/Editor/ControlPlayModeUseCaseTests.cs
Tests failed saves and remaining unsaved changes, including response state, messages, and saver calls.

Pause-point resume and expiration

Layer / File(s) Summary
Pause controller resume contract
Packages/src/Runtime/PausePoints/IUloopPausePointPauseController.cs, Packages/src/Runtime/PausePoints/UnityEditorPausePointPauseController.cs
Adds Resume() to the controller contract and clears Unity’s editor pause state in its implementation.
Capture-window expiration transitions
Packages/src/Runtime/PausePoints/UloopPausePointEntry.cs
Makes expiration report state changes and allows hit entries to expire after their capture windows close.
Registry resume paths
Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
Resumes after clearing or expiration and adds atomic pending-resume handling for client disconnects.
Editor lifecycle and disconnect wiring
Packages/src/Runtime/PausePoints/UloopPausePointRawCaptureLifecycle.cs, Packages/src/Editor/Infrastructure/*
Applies pending resumes and expirations on editor updates and requests resume handling during client disconnect paths.
Pause and resume behavior tests
Assets/Tests/Editor/*PausePoint*, Assets/Tests/PlayMode/*Input*
Updates pause-controller fakes and covers clear, expiration, and client-disconnect resume behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ControlPlayModeUseCase
  participant EditorUnsavedChangesQuietSaver
  participant UnityEditor
  ControlPlayModeUseCase->>EditorUnsavedChangesQuietSaver: Save dirty editor changes
  EditorUnsavedChangesQuietSaver->>UnityEditor: Save scenes and Prefab Stage
  UnityEditor-->>EditorUnsavedChangesQuietSaver: Save results
  ControlPlayModeUseCase->>EditorUnsavedChangesQuietSaver: Detect remaining changes
  EditorUnsavedChangesQuietSaver-->>ControlPlayModeUseCase: Failure or remaining paths
  ControlPlayModeUseCase-->>UnityEditor: Start Play mode only when clear
Loading
sequenceDiagram
  participant ClientDisconnect
  participant UloopPausePointRegistry
  participant EditorUpdate
  participant UnityEditor
  ClientDisconnect->>UloopPausePointRegistry: Request editor resume
  EditorUpdate->>UloopPausePointRegistry: Apply pending resume
  UloopPausePointRegistry->>UnityEditor: Set editor pause state to false
  EditorUpdate->>UloopPausePointRegistry: Apply capture-window expirations
  UloopPausePointRegistry->>UnityEditor: Resume after expiration
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.34% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: pause-point resume fixes and quiet-saving before CLI Play.
Description check ✅ Passed The description is detailed and directly matches the pause-resume and quiet-save changes in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/pause-playmode-guards

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.

@hatayama

Copy link
Copy Markdown
Owner Author

LGTM (merge after required CI including Compile Check is green). Verified this umbrella contains exactly the two reviewed sub-PR squash merges (#175448c0155, #1755b9a6216) and the diff against v3-beta (24 files, +585/−146) matches the sum of the reviewed sub-PR diffs — no extra changes. The body correctly documents the approved Option B trade-off (auto-resume also clears a manual pause) and the resume-from-pause no-rewrite guarantee.

@hatayama hatayama merged commit 3b17b68 into v3-beta Jul 13, 2026
9 of 10 checks passed
@hatayama hatayama deleted the feature/pause-playmode-guards branch July 13, 2026 11:18
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.

1 participant