From 214d589336f58c315a743423ccda23989bcf23f3 Mon Sep 17 00:00:00 2001 From: hatayama Date: Tue, 19 May 2026 10:37:11 +0900 Subject: [PATCH] Suppress server busy Console logging Busy tool requests are protocol-level retry signals, not Editor-side failures. Keep the server_busy JSON response while avoiding noisy Unity Console errors for expected single-flight rejections. --- .../Editor/JsonRpcProcessorCliVersionGateTests.cs | 11 ++--------- .../Editor/Infrastructure/Api/JsonRpcProcessor.cs | 12 +++++++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Assets/Tests/Editor/JsonRpcProcessorCliVersionGateTests.cs b/Assets/Tests/Editor/JsonRpcProcessorCliVersionGateTests.cs index 1ef3462b0..0b80d8ae5 100644 --- a/Assets/Tests/Editor/JsonRpcProcessorCliVersionGateTests.cs +++ b/Assets/Tests/Editor/JsonRpcProcessorCliVersionGateTests.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -108,10 +107,6 @@ public async Task ProcessRequest_WhenFirstToolWaitsForMainThread_ReturnsServerBu Assert.That(dispatcher.PendingContinuationCount, Is.EqualTo(1)); - LogAssert.Expect( - LogType.Error, - new Regex("\\[JsonRpcProcessor\\] Error: Unity tool execution is busy running 'single-flight-test'")); - secondResponseTask = JsonRpcProcessor.ProcessRequestWithEarlyResponseAsync( BuildToolRequest(SingleFlightTestTool.Name, 2), CancellationToken.None, @@ -123,6 +118,7 @@ public async Task ProcessRequest_WhenFirstToolWaitsForMainThread_ReturnsServerBu Assert.That(data["type"]?.ToString(), Is.EqualTo("server_busy")); Assert.That(data["runningToolName"]?.ToString(), Is.EqualTo(SingleFlightTestTool.Name)); Assert.That(data["requestedToolName"]?.ToString(), Is.EqualTo(SingleFlightTestTool.Name)); + LogAssert.NoUnexpectedReceived(); } finally { @@ -171,10 +167,6 @@ public async Task ProcessRequest_WhenExecuteDynamicCodeWaitsForMainThread_Allows Assert.That(dispatcher.PendingContinuationCount, Is.EqualTo(2)); Assert.That(secondDynamicCodeTask.IsCompleted, Is.False); - LogAssert.Expect( - LogType.Error, - new Regex("\\[JsonRpcProcessor\\] Error: Unity tool execution is busy running 'execute-dynamic-code'")); - otherToolTask = JsonRpcProcessor.ProcessRequestWithEarlyResponseAsync( BuildToolRequest(SingleFlightTestTool.Name, 3), CancellationToken.None, @@ -186,6 +178,7 @@ public async Task ProcessRequest_WhenExecuteDynamicCodeWaitsForMainThread_Allows Assert.That(data["type"]?.ToString(), Is.EqualTo("server_busy")); Assert.That(data["runningToolName"]?.ToString(), Is.EqualTo(UnityCliLoopConstants.TOOL_NAME_EXECUTE_DYNAMIC_CODE)); Assert.That(data["requestedToolName"]?.ToString(), Is.EqualTo(SingleFlightTestTool.Name)); + LogAssert.NoUnexpectedReceived(); } finally { diff --git a/Packages/src/Editor/Infrastructure/Api/JsonRpcProcessor.cs b/Packages/src/Editor/Infrastructure/Api/JsonRpcProcessor.cs index 95f6903f5..4b95f3e05 100644 --- a/Packages/src/Editor/Infrastructure/Api/JsonRpcProcessor.cs +++ b/Packages/src/Editor/Infrastructure/Api/JsonRpcProcessor.cs @@ -191,11 +191,21 @@ private static async Task ProcessRpcRequest( } catch (Exception ex) when (!(ex is OperationCanceledException)) { - UnityEngine.Debug.LogError($"[JsonRpcProcessor] Error: {ex.Message}\nStack trace: {ex.StackTrace}"); + LogRpcExceptionIfNeeded(ex); return CreateErrorResponse(request.Id, ex); } } + private static void LogRpcExceptionIfNeeded(Exception ex) + { + if (ex is UnityCliLoopToolBusyException) + { + return; + } + + UnityEngine.Debug.LogError($"[JsonRpcProcessor] Error: {ex.Message}\nStack trace: {ex.StackTrace}"); + } + private static bool IsCliUpdateRequired(string currentCliVersion) { if (string.IsNullOrWhiteSpace(currentCliVersion))