fix: Compile no longer leaves Unity busy after finishing#1237
Conversation
Unity can leave the compile command waiting forever if EditorApplication.isCompiling drops before compilationFinished reaches the controller. Watch the compile lifecycle after start and complete the request as indeterminate so the execution slot is released and follow-up commands can run. - Preserve the existing start-timeout behavior in the watchdog. - Add focused EditMode tests for missed callback recovery and normal callback completion.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds CompileLifecycleWatchdog (polling state machine) plus a new protocol constant, integrates it into CompileController to replace start-only polling, produces indeterminate results when finish callbacks are missed, and adds tests that validate start-timeout, missed-callback recovery, and fault propagation. ChangesCompile Lifecycle Watchdog
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Packages/src/Editor/FirstPartyTools/Compile/CompileController.cs`:
- Line 165: The call in CompileController.cs currently fire-and-forgets
WatchCompileLifecycleAsync(ct), which lets CompileLifecycleWatchdog.WatchAsync
fault silently and prevents watchdog callbacks (e.g., AbortCompile*,
compilationFinished) from running; instead, capture the returned Task from
WatchCompileLifecycleAsync(ct) and attach an observed continuation (or await it
on a safe background Task) that catches exceptions, logs the error, and invokes
the appropriate abort/cleanup path (e.g., call the AbortCompile* methods or
signal compilationFinished) so faults don't leave the controller waiting;
reference WatchCompileLifecycleAsync, CompileLifecycleWatchdog.WatchAsync,
AbortCompile* and compilationFinished when adding this try/catch/continuation
handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eba5330c-57ee-4ff8-803c-bdb07888880f
⛔ Files ignored due to path filters (2)
Assets/Tests/Editor/CompileLifecycleWatchdogTests.cs.metais excluded by none and included by nonePackages/src/Editor/FirstPartyTools/Compile/CompileLifecycleWatchdog.cs.metais excluded by none and included by none
📒 Files selected for processing (4)
Assets/Tests/Editor/CompileLifecycleWatchdogTests.csPackages/src/Editor/FirstPartyTools/Compile/CompileController.csPackages/src/Editor/FirstPartyTools/Compile/CompileLifecycleWatchdog.csPackages/src/Editor/ToolContracts/UnityCliLoopConstants.cs
There was a problem hiding this comment.
2 issues found across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Keep the missed-callback recovery from leaving a pending compile request if the watchdog itself faults, and preserve the force-compile result contract for indeterminate recovery results.
|
Actionable comments posted: 0 |
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Prevent a delayed watchdog fault from aborting a newer compile by carrying the original compile task through fault handling and delayCall recovery. Add focused coverage for matching and stale compile request identity.
|
Actionable comments posted: 0 |
Summary
uloop compilenow recovers when Unity finishes compiling but the completion signal is missed.get-logsno longer stay blocked behind a stale busy state.User Impact
uloop compilecould remain in progress indefinitely even after Unity had stopped compiling, and later commands could keep returningUNITY_SERVER_BUSYuntil the Editor was restarted.Changes
Verification
Packages/src/Cli~/dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"Packages/src/Cli~/dist/darwin-arm64/uloop run-tests --test-mode EditMode --filter-type regex --filter-value ".*CompileLifecycleWatchdogTests.*" --project-path "$(git rev-parse --show-toplevel)"Packages/src/Cli~/dist/darwin-arm64/uloop compile --force-recompile --project-path "$(git rev-parse --show-toplevel)"Packages/src/Cli~/dist/darwin-arm64/uloop get-logs --project-path "$(git rev-parse --show-toplevel)"codex-review v3-beta --parallel-tests ...