Skip to content

fix: Domain reload waits complete during recovery#1573

Merged
hatayama merged 1 commit into
v3-betafrom
fix/coalesce-recovery-scheduling
Jul 6, 2026
Merged

fix: Domain reload waits complete during recovery#1573
hatayama merged 1 commit into
v3-betafrom
fix/coalesce-recovery-scheduling

Conversation

@hatayama

@hatayama hatayama commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Prevent duplicate recovery loops without dropping domain reload completion work.
  • Keep compile wait mode from hanging when startup recovery and after-domain-reload recovery overlap.

User Impact

  • A compile that waits for domain reload can now complete even when startup recovery is already pending.
  • Duplicate tracked recovery triggers reuse the active recovery task instead of starting parallel recovery loops.

Changes

  • Track whether the current recovery task is a tracked recovery or a startup placeholder.
  • Allow tracked recovery to supersede startup placeholders because after-domain-reload recovery carries completion bookkeeping.
  • Add regression coverage for tracked coalescing, startup coalescing, startup superseding, startup joining tracked recovery, and completed/faulted rescheduling.

Review Notes

  • Single-flight recovery means a trigger that joins an in-flight tracked recovery does not receive its own retry budget. This is an intentional tradeoff: give-up remains the terminal state that requires manual intervention, and adding re-arm behavior would complicate the recovery state machine for a rare edge case.

Verification

  • dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"
  • dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type exact --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.UnityCliLoopServerControllerRecoveryTests" (21/21 passed)
  • dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type exact --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.UnityCliLoopServerStartupProtectionTests" (4/4 passed)

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Refactors UnityCliLoopServerRecoveryTrackingService to track whether the active recovery task is a tracked (domain-reload) or startup recovery, introducing shared helpers for scheduling and joining active recoveries. Adds NUnit tests validating scheduling, joining, replacement, and restart behavior between tracked and startup recoveries.

Changes

Tracked vs Startup Recovery Scheduling

Layer / File(s) Summary
Recovery tracking service refactor
Packages/src/Editor/Infrastructure/Server/UnityCliLoopServerRecoveryTrackingService.cs
Adds _isCurrentRecoveryTracked flag; refactors ScheduleStartupRecovery and ScheduleTrackedRecovery around new ScheduleRecoveryTask, ShouldJoinActiveRecovery, and GetActiveRecoveryTask helpers; updates completion-clearing logic to reset tracking state consistently.
Startup lock tests for recovery interaction
Assets/Tests/Editor/UnityCliLoopServerControllerStartupLockTests.cs
Adds tests covering task reuse when recovery is running, startup placeholder replacement by tracked recovery, and new recovery starts after completion or fault with retry/backoff exhaustion.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1552: Implements the original tracked-vs-startup recovery scheduling/coalescing behavior that this PR refactors and adds tests for.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the main change: recovery handling so domain reload waits can complete.
Description check ✅ Passed The description is directly related to the recovery scheduling changes and regression tests in this PR.
✨ 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 fix/coalesce-recovery-scheduling

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Coalesce duplicate tracked recovery loops while allowing after-domain-reload recovery to supersede startup placeholders so compile wait mode still receives domain reload completion.
@hatayama
hatayama force-pushed the fix/coalesce-recovery-scheduling branch from fea06e0 to 44f4e7c Compare July 6, 2026 23:54
@hatayama
hatayama merged commit e80b630 into v3-beta Jul 6, 2026
9 checks passed
@hatayama
hatayama deleted the fix/coalesce-recovery-scheduling branch July 6, 2026 23:58
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