fix: Fail control-play-mode fast when unsaved changes cannot be quietly saved#1941
Conversation
Root cause: SaveDirtyEditorChangesBeforePlayStart returns synchronously when a scene/prefab cannot be saved (e.g. an Untitled scene with no path), but the response was numerically identical to "no state change yet" on the wire (IsPlaying=false, Changed=false, BlockedByCompileErrors=false). The Go CLI's initial-response check only special-cased BlockedByCompileErrors, so this terminal failure fell through into the 180s state-wait poll loop and surfaced as a generic timeout, even though Unity had already given up in milliseconds. Adds a BlockedByUnsavedChanges response field (mirroring the existing BlockedByCompileErrors pattern) and an early-return check in runControlPlayModeWithStateWait so this failure mode returns immediately with an actionable error instead of waiting.
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ 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 |
5fbc2c3
into
feature/round8-pause-point-improvements
Summary
control-play-mode --action Playno longer waits the full timeout (up to 180s) when Play mode cannot start because unsaved editor changes could not be quietly saved (for example, an Untitled scene).User Impact
Changes
Packages/src/Editor/FirstPartyTools/ControlPlayMode: added aBlockedByUnsavedChangesresponse field, set whenSaveDirtyEditorChangesBeforePlayStartfails, mirroring the existingBlockedByCompileErrorsfield.cli/project-runner:runControlPlayModeWithStateWaitnow checksBlockedByUnsavedChangeson the initial response and fails fast with a newCONTROL_PLAY_MODE_UNSAVED_CHANGESerror instead of entering the state-wait poll loop.Verification
execute-dynamic-code, then rancontrol-play-mode --action Play, which hung for the full timeout before this fix (EditorApplication.isPlayingstayedfalsethroughout, confirming Unity had already given up).TestRunControlPlayModeWithStateWaitFailsImmediatelyWhenUnsavedChangesBlockPlay) reproducing the fall-through-to-polling bug against the pre-fix code, confirmed it failed with a generic timeout, then implemented the fix. Added assertions to the existing C# unit tests (ExecuteAsync_WhenPlayStartSaveFails_DoesNotEnterPlayMode,ExecuteAsync_WhenPlayStartLeavesUnsavedChanges_DoesNotEnterPlayMode) confirmingBlockedByUnsavedChangesis set; confirmed both failed (Expected: True / But was: False) before the fix.control-play-mode --action Playagainst the same Untitled dirty scene now returns the new error in well under a second instead of hanging.sh scripts/check-go-cli.sh: format/vet/lint 0 issues, all Go packages pass (including the new test).go test -run TestProductionGoFilesStayFocused ./...(release-automation): pass.sh scripts/stamp-release-inputs.sh: re-run and committed, sincecli/commonchanged.dist/darwin-arm64/uloop compile: 0 errors / 0 warnings.uloop run-tests(EditMode,ControlPlayModeUseCaseTests): 18/18 passed after the fix.