Skip to content

v2.23.1 — Fix Multi-Agent Shared State Contamination

Choose a tag to compare

@francoios francoios released this 11 Mar 17:00

Fix: Instance Selection Shared State Breaks Parallel Multi-Project Workflows

This release fixes a critical bug where multiple Claude agents targeting different Unity projects would interfere with each other's instance selection.

The Problem

When Claude Desktop spawns multiple agents/tasks — each getting its own MCP stdio process — they all shared the same mcp-session-state.json file for instance selection state. If Agent A selected Project A (port 7892), Agent B would restore that selection on startup and send commands to Project A instead of its own target project.

What Changed

Instance selection is now purely in-memory, per-process. Each MCP stdio process maintains its own _selectedInstance and _instanceSelectionRequired state with no disk persistence. Since each agent gets its own process, there is zero cross-contamination.

  • Removed restorePersistedState() from instance discovery — no more loading stale selections from disk
  • Removed all persistState() calls for selectedInstance, instanceSelectionRequired, and instanceDiscoveryDone
  • Auto-discovery runs fresh on each process startup, naturally re-selecting the correct instance

What Wasn't Changed

All resilience features from v2.22.2 remain intact:

  • Port identity validation — still verifies project name + path match on reconnection
  • Compile-time resilience — still checks the registry when a port is unresponsive
  • Crash detection — still clears stale registry entries after heartbeat timeout
  • Registry-based fallback — still works for all three scenarios (normal shutdown, long compile, crash)

How to Update

Pull the latest from the repo and restart Claude Desktop to pick up the new MCP server version.

Reported By

Thanks to the community bug report: "unity_select_instance is global shared state — breaks parallel multi-project workflows"