From bc18129990bdfa47d35e57ad03437afd2eda1feb Mon Sep 17 00:00:00 2001 From: hatayama Date: Tue, 6 Oct 2026 11:53:25 +0900 Subject: [PATCH 1/2] Update the launch comment about how V3 schedules server recovery The comment pointed at a SignalTick call, by line number, that V3 no longer makes: V3 now queues its recovery on the main-thread dispatcher, which drains on update and tick and signals a tick when work is enqueued. Name the recovery method instead of line numbers so the reference does not go stale again. No code changes. --- .../internal/dispatcher/launch_v2_lockfile.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go b/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go index 8f1a6bb637..4eda60ad82 100644 --- a/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go +++ b/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go @@ -91,12 +91,12 @@ func waitForV2ProjectOpened( clierrors.WriteClassifiedError(stderr, err, clierrors.ErrorContext{ProjectRoot: projectRoot, Command: clicore.LaunchCommandName}) return 1 } - // Why: V2 server auto-start is scheduled on EditorApplication.delayCall. A CLI-spawned, - // backgrounded idle Editor may never tick on its own, so delayCall never runs - // (V3 documents this and uses EditorApplicationTickBridge.SignalTick — - // Packages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.cs:369-372). - // V2 has no equivalent workaround, so focus once after the lockfile gate. Focus failure - // is non-fatal: log and continue into the readiness probe. + // V2 server auto-start is scheduled on EditorApplication.delayCall, which does not run while + // the Editor window is unfocused (V3 moved its recovery onto the main-thread dispatcher, which + // drains on update and tick and signals a tick when work is enqueued; see + // UnityCliLoopServerController.OnServerLoopUnexpectedlyExited). V2 has no equivalent, so + // focus once after the lockfile gate. Focus failure is non-fatal: log and continue into the + // readiness probe. logLaunchV2FocusWithDeps(ctx, projectRoot, currentPid, deps) writeLaunchReadinessWait(stdout, spinner) if err := deps.waitForV2ServerReady(ctx, projectRoot, previousServerSessionID, launchV2ServerReadyPoll, launchReadinessTimeout); err != nil { From ab0b066dfd8ad81a1a76f24e086b54a6f49c47bd Mon Sep 17 00:00:00 2001 From: hatayama Date: Tue, 6 Oct 2026 12:02:50 +0900 Subject: [PATCH 2/2] State the unfocused delayCall stall as observed, not as a rule The stall was measured in one setup, so the comment should not claim that delayCall never runs in any unfocused Editor. --- cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go b/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go index 4eda60ad82..70edf9b521 100644 --- a/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go +++ b/cli/dispatcher/internal/dispatcher/launch_v2_lockfile.go @@ -91,9 +91,9 @@ func waitForV2ProjectOpened( clierrors.WriteClassifiedError(stderr, err, clierrors.ErrorContext{ProjectRoot: projectRoot, Command: clicore.LaunchCommandName}) return 1 } - // V2 server auto-start is scheduled on EditorApplication.delayCall, which does not run while - // the Editor window is unfocused (V3 moved its recovery onto the main-thread dispatcher, which - // drains on update and tick and signals a tick when work is enqueued; see + // V2 server auto-start is scheduled on EditorApplication.delayCall, which was observed not to + // run while the Editor window is unfocused (V3 moved its recovery onto the main-thread + // dispatcher, which drains on update and tick and signals a tick when work is enqueued; see // UnityCliLoopServerController.OnServerLoopUnexpectedlyExited). V2 has no equivalent, so // focus once after the lockfile gate. Focus failure is non-fatal: log and continue into the // readiness probe.