Skip to content

fix: run-tests cancel now exits Play Mode before re-enabling domain reload#1740

Merged
hatayama merged 2 commits into
feature/run-tests-hang-hardeningfrom
feat/run-tests-cancel-stop-restore
Jul 13, 2026
Merged

fix: run-tests cancel now exits Play Mode before re-enabling domain reload#1740
hatayama merged 2 commits into
feature/run-tests-hang-hardeningfrom
feat/run-tests-cancel-stop-restore

Conversation

@hatayama

@hatayama hatayama commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Refs: hang survey section 2 / PR 1-2 (Option B baseline; Option A pending user permission)

Summary

  • On run-tests cancel/timeout, request Play Mode exit and wait (upper-bounded) before disposing DomainReloadDisableScope
  • Agents get stop/restore details in the timeout message

User Impact

  • Before: cancel freed the CLI await but could leave Play Mode / reload settings in a bad state
  • After: cancel path restores Play Mode first, then re-enables domain reload

Changes

  • Add injectable RunTestsCancelStopRestore orchestrator (no-throw; internal waits use CancellationToken.None + 10s bound)
  • Wire PlayMode/EditMode executers to run stop/restore before scope dispose
  • Option B baseline: public EditorApplication.isPlaying = false only; CancelTestRun reflection not enabled yet (needs explicit user permission). If approved, Option A will plug into TryCancelTestRun with cached lookup and automatic B fallback

Verification

  • dotnet test tests/RunTestsExecutionTimeout.UnitTests/RunTestsExecutionTimeout.UnitTests.csproj (16 passed)
  • uloop compile green
  • uloop run-tests --filter-type regex --filter-value "RunTestsUseCaseTests|PlayModeTestExecuterTests|DomainReloadDisableScopeTests" (25 passed)

Made with Cursor

Review in cubic

…ishes

Timeout and disconnect cancels used to dispose DomainReloadDisableScope as soon
as the await ended, re-enabling domain reload while Test Runner work could still
be active. Run a no-throw stop/restore step with its own wait budget before
scope dispose, using public Play Mode exit until CancelTestRun access is decided.

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

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 87c55c83-3be2-4c6e-b75b-30d5ee2ccd4b

📥 Commits

Reviewing files that changed from the base of the PR and between fea3679 and 142bc5f.

⛔ Files ignored due to path filters (3)
  • Packages/src/Editor/FirstPartyTools/RunTests/RunTestsCancelStopRestore.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/RunTests/TestFramework/RunTestsCancelStopRestoreUnityHooks.cs.meta is excluded by none and included by none
  • tests/RunTestsExecutionTimeout.UnitTests/RunTestsExecutionTimeout.UnitTests.csproj is excluded by none and included by none
📒 Files selected for processing (7)
  • Packages/src/Editor/FirstPartyTools/RunTests/RunTestsCancelStopRestore.cs
  • Packages/src/Editor/FirstPartyTools/RunTests/RunTestsExecutionTimeout.cs
  • Packages/src/Editor/FirstPartyTools/RunTests/RunTestsUseCase.cs
  • Packages/src/Editor/FirstPartyTools/RunTests/TestFramework/PlayModeTestExecuter.cs
  • Packages/src/Editor/FirstPartyTools/RunTests/TestFramework/RunTestsCancelStopRestoreUnityHooks.cs
  • tests/RunTestsExecutionTimeout.UnitTests/RunTestsCancelStopRestoreTests.cs
  • tests/RunTestsExecutionTimeout.UnitTests/RunTestsExecutionTimeoutTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/run-tests-cancel-stop-restore

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.

…e cancel notes

The flag was always set before any await, so the catch branch could never see it
false. Also avoid warning about missing CancelTestRun after Play Mode exit is
already confirmed, which only confused agents.

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

Copy link
Copy Markdown
Owner Author

LGTM (reviewer: Fable). Design-agreement conditions verified: no-throw StopAndRestore, CancellationToken.None + 10s bounded waits, DomainReloadDisableScope disposed only after the stop wait, and the null TryCancelTestRun shape stays compatible with a future Option A fallback. Review fixes confirmed at 142bc5f (unreachable executionStarted guard removed; degradation note quieted on confirmed PlayMode exit). Local pure C# tests 16/16 green.

@hatayama hatayama merged commit e6fb0c9 into feature/run-tests-hang-hardening Jul 13, 2026
2 checks passed
@hatayama hatayama deleted the feat/run-tests-cancel-stop-restore branch July 13, 2026 06:04
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