fix: Unity commands recover reliably after editor reloads#1182
Conversation
Start server recovery even when a reload reports no previous bridge session, so launch and restart can recover from cold startup state instead of leaving server-state stopped. Also stop launch readiness from waiting until the full timeout when stopped state remains unchanged after a short recovery grace period.
|
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 ignored due to path filters (3)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR introduces server manual-stop tracking to gate recovery on user intent rather than server running state. A new session-state flag ( ChangesManual Stop State Tracking and Recovery Control
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
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: 2
🤖 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/Cli`~/internal/cli/tool_readiness.go:
- Around line 124-126: The stopped-state wait path is returning
context.DeadlineExceeded because it calls toolReadinessDoneError(ctx) using the
derived/internal timeout context; change the call so it passes the original
user-facing context (the parent/original context that carries the user-visible
deadline) instead of the derived internal ctx when handling the
graceTimer.C/timeout path so the same user-facing timeout message is returned;
update the branch handling case <-graceTimer.C (and any other place that uses
the derived ctx for error mapping) to call toolReadinessDoneError with the
original context variable rather than the internal ctx.
In `@Packages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.cs`:
- Around line 218-220: The restart path must abort if cleanup fails: update the
code that calls StopServerForRestartAsync and the subsequent
useCase.ExecuteAsync call (the block around _bridgeServer and StartServer logic)
to inspect the shutdown result and return early when shutdown/cleanup did not
succeed; specifically, have StopServerForRestartAsync propagate a
success/failure (or have it return the useCase.ExecuteAsync result) and then
check that result after calling StopServerForRestartAsync (and after
useCase.ExecuteAsync) and skip starting a new server when Success == false so
you don't proceed to create/Start a fresh bridge server; apply the same
check/update to the other restart path mentioned (the block covering lines
266-315).
🪄 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: 45a05100-3874-4d33-b81d-5a9bf4ec2b21
⛔ Files ignored due to path filters (3)
Packages/src/Cli~/dist/darwin-amd64/uloopis excluded by!**/dist/**and included by nonePackages/src/Cli~/dist/darwin-arm64/uloopis excluded by!**/dist/**and included by nonePackages/src/Cli~/dist/windows-amd64/uloop.exeis excluded by!**/dist/**,!**/*.exeand included by none
📒 Files selected for processing (13)
Assets/Tests/Editor/DomainReloadDetectionServiceTests.csAssets/Tests/Editor/DomainReloadRecoveryUseCaseTests.csAssets/Tests/Editor/UnityCliLoopEditorSessionStateRepositoryTests.csAssets/Tests/Editor/UnityCliLoopEditorSessionStateTestFactory.csAssets/Tests/Editor/UnityCliLoopServerControllerStartupLockTests.csPackages/src/Cli~/internal/cli/tool_readiness.goPackages/src/Cli~/internal/cli/tool_readiness_test.goPackages/src/Editor/Application/SessionRecoveryService.csPackages/src/Editor/Application/UnityCliLoopServerStartupService.csPackages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.csPackages/src/Editor/Infrastructure/Server/DomainReloadDetectionFileService.csPackages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.csPackages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSessionStateRepository.cs
There was a problem hiding this comment.
1 issue found across 16 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Normalize stopped-state readiness timeout mapping so internal timeout expiry keeps the same user-facing error as other readiness paths. Also abort manual restart startup when pre-start cleanup fails, preserving the original shutdown failure instead of hiding it behind a second bind attempt.
Summary
Closes #1175
User Impact
Changes
Verification
scripts/check-go-cli.shPackages/src/Cli~/dist/darwin-arm64/uloop run-tests --project-path <PROJECT_ROOT> --test-mode EditMode --filter-type regex --filter-value ".*(DomainReloadRecoveryUseCaseTests|DomainReloadDetectionServiceTests|UnityCliLoopEditorSessionStateRepositoryTests|UnityCliLoopServerControllerRecoveryTests|UnityCliLoopEditorSettingsRecoveryTests).*"(37 tests passed)Packages/src/Cli~/dist/darwin-arm64/uloop compile --project-path <PROJECT_ROOT>~/.codex/skills/codex-review/scripts/codex-review v3-beta