fix: Compile commands no longer hang across Unity reloads

Merged
HA
5mo ago
+1606-140

Summary

  • Compile commands now produce a result even when Unity reloads editor assemblies before the live response can finish.
  • Accepted compile requests can survive CLI disconnects long enough to persist the result the CLI is polling for.

User Impact

  • Before this change, a compile request could wait indefinitely or lose its result when Unity entered Domain Reload, especially during forced recompiles or after the CLI process was interrupted.
  • After this change, normal and forced compile flows either return the persisted compile result or recover an indeterminate result file that tells users to inspect Unity logs instead of waiting forever.

Changes

  • Store pending compile recovery data in Unity SessionState and complete missing compile result files after editor startup/reload recovery.
  • Keep reload-waiting compile requests alive after the accepted response when the client disconnects, while preserving cancellation for explicit no-reload compile requests.
  • Let the native CLI fall back to result-file polling after accepted final-response timeouts and regenerate the checked-in native binaries.
  • Add focused tests for pending compile recovery, SessionState persistence, cancellation policy, and compile result polling decisions.

Verification

  • git diff --check origin/v3-beta
  • Packages/src/Cli~/dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"
  • Packages/src/Cli~/dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "(PendingCompileResultRecoveryServiceTests|UnityCliLoopEditorSessionStateRepositoryTests|CompileLifecycleWatchdogTests|JsonRpcProcessorCliVersionGateTests|OnionAssemblyDependencyTests)"
  • scripts/check-go-cli.sh
  • go test ./internal/cli ./internal/unityipc
  • Manual compile smoke matrix: normal compile, no-wait compile, forced compile, forced no-wait compile, cancellation during normal compile, cancellation during forced compile, late cancellation during forced compile
  • Manual compile smoke on cli-loop-minecraft, cli-loop-block-kuzushi, and cli-loop-tetris with default and forced compile modes
  • codex-review v3-beta --parallel-tests ...