unity-mcp/MCPForUnity/Editor/Services
dsarno 39bff4ae27
Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554)
* Fix test job state management after domain reload

- TestRunnerService.RunFinished: Always clean up job state even when
  _runCompletionSource is null (happens after PlayMode domain reload)
- TestJobManager: Detect and clear stale jobs (5+ min without updates)
  on startup to recover from stuck state after domain reload
- refresh_unity.py: Add "could not connect" to retryable errors when
  wait_for_ready=True, so connection failures during domain reload
  trigger waiting instead of immediate failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add focus nudge to handle OS-level throttling during PlayMode tests

When Unity is unfocused, macOS App Nap (and similar OS features) can
throttle the process, causing PlayMode tests to stall even with Unity
No Throttling mode enabled.

Changes:
- Add ApplyNoThrottlingPreemptive() to TestRunnerNoThrottle for early
  throttle prevention before PlayMode Execute()
- Add focus_nudge.py utility that temporarily focuses Unity and returns
  focus to the original app (supports macOS, Windows, Linux)
- Integrate focus nudge into get_test_job polling - when tests appear
  stalled (unfocused + no progress for 10s), automatically nudge Unity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix code review issues in focus_nudge.py

- Remove redundant time import (already imported at module level)
- Escape window titles in PowerShell script to prevent injection
- Remove unused Callable import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Improve focus nudge logging and fix skipped tests

- Improve logging in focus_nudge.py: rate limit skip and focus return at INFO level
- Improve logging in run_tests.py: show nudge completion status
- Fix path resolution in test_logging_stdout.py and test_transport_framing.py
- Add PlayMode tests to UnityMCPTests project for testing PlayMode runner

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add troubleshooting note about focus permission requests

When running PlayMode tests with Unity in the background, the focus
nudge feature may trigger OS permission prompts (especially on macOS
for accessibility/automation). Document this expected behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:02:40 -08:00
..
Transport HTTP setup overhaul: transport selection (HTTP local/remote vs stdio), safer lifecycle, cleaner UI, better Claude Code integration (#499) 2026-01-01 17:08:51 -08:00
BridgeControlService.cs HTTP setup overhaul: transport selection (HTTP local/remote vs stdio), safer lifecycle, cleaner UI, better Claude Code integration (#499) 2026-01-01 17:08:51 -08:00
BridgeControlService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
ClientConfigurationService.cs Fix HTTP/Stdio Transport UX and Test Bug (#530) 2026-01-07 23:33:22 -04:00
ClientConfigurationService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
EditorPrefsWindowService.cs Add EditorPrefs management window for MCP configuration debugging (#491) 2025-12-29 13:30:45 -04:00
EditorPrefsWindowService.cs.meta Add EditorPrefs management window for MCP configuration debugging (#491) 2025-12-29 13:30:45 -04:00
EditorStateCache.cs v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
EditorStateCache.cs.meta Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
HttpBridgeReloadHandler.cs Fix manage prefabs (#405) 2025-11-28 18:47:11 -04:00
HttpBridgeReloadHandler.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
IBridgeControlService.cs HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
IBridgeControlService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
IClientConfigurationService.cs Simplify MCP client configs (#401) 2025-11-27 18:18:44 -04:00
IClientConfigurationService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
IPackageDeploymentService.cs [FEATURE] Deployment of local source code to Unity (#450) 2025-12-09 20:17:18 -05:00
IPackageDeploymentService.cs.meta [FEATURE] Deployment of local source code to Unity (#450) 2025-12-09 20:17:18 -05:00
IPackageUpdateService.cs HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
IPackageUpdateService.cs.meta Notify users when there's a new version (#329) 2025-10-18 20:42:18 -04:00
IPathResolverService.cs HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
IPathResolverService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
IPlatformService.cs Remove old UI and do lots of cleanup (#340) 2025-10-24 00:50:29 -04:00
IPlatformService.cs.meta Remove old UI and do lots of cleanup (#340) 2025-10-24 00:50:29 -04:00
IServerManagementService.cs HTTP setup overhaul: transport selection (HTTP local/remote vs stdio), safer lifecycle, cleaner UI, better Claude Code integration (#499) 2026-01-01 17:08:51 -08:00
IServerManagementService.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
ITestRunnerService.cs Add test filtering to run_tests tool (#462) 2025-12-17 16:59:21 -04:00
ITestRunnerService.cs.meta Add testing and move menu items to resources (#316) 2025-10-13 11:16:43 -04:00
IToolDiscoveryService.cs Optimise so startup is fast again (#494) 2025-12-29 18:39:03 -04:00
IToolDiscoveryService.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
MCPServiceLocator.cs [FEATURE] Deployment of local source code to Unity (#450) 2025-12-09 20:17:18 -05:00
MCPServiceLocator.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
McpEditorShutdownCleanup.cs HTTP setup overhaul: transport selection (HTTP local/remote vs stdio), safer lifecycle, cleaner UI, better Claude Code integration (#499) 2026-01-01 17:08:51 -08:00
McpEditorShutdownCleanup.cs.meta HTTP setup overhaul: transport selection (HTTP local/remote vs stdio), safer lifecycle, cleaner UI, better Claude Code integration (#499) 2026-01-01 17:08:51 -08:00
PackageDeploymentService.cs Fixes Windows installation failures caused by long path issues when cloning the full repository via git URL (MAX_PATH 260 char limit exceeded by files in TestProjects/). (#534) 2026-01-08 07:14:44 -08:00
PackageDeploymentService.cs.meta [FEATURE] Deployment of local source code to Unity (#450) 2025-12-09 20:17:18 -05:00
PackageUpdateService.cs Fix manage prefabs (#405) 2025-11-28 18:47:11 -04:00
PackageUpdateService.cs.meta Notify users when there's a new version (#329) 2025-10-18 20:42:18 -04:00
PathResolverService.cs Fix Claude Windows config and CLI status refresh (#412) 2025-12-01 18:01:14 -08:00
PathResolverService.cs.meta New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
PlatformService.cs Remove old UI and do lots of cleanup (#340) 2025-10-24 00:50:29 -04:00
PlatformService.cs.meta Remove old UI and do lots of cleanup (#340) 2025-10-24 00:50:29 -04:00
ServerManagementService.cs Fix HTTP/Stdio Transport UX and Test Bug (#530) 2026-01-07 23:33:22 -04:00
ServerManagementService.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
StdioBridgeReloadHandler.cs Fix HTTP/Stdio Transport UX and Test Bug (#530) 2026-01-07 23:33:22 -04:00
StdioBridgeReloadHandler.cs.meta Fix stdio reloads (#402) 2025-11-27 19:33:26 -04:00
TestJobManager.cs Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
TestJobManager.cs.meta Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
TestRunStatus.cs Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
TestRunStatus.cs.meta Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
TestRunnerNoThrottle.cs Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
TestRunnerNoThrottle.cs.meta Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
TestRunnerService.cs Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
TestRunnerService.cs.meta Add testing and move menu items to resources (#316) 2025-10-13 11:16:43 -04:00
ToolDiscoveryService.cs Optimise so startup is fast again (#494) 2025-12-29 18:39:03 -04:00
ToolDiscoveryService.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
Transport.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00