Repository navigation
Reject Unity bridge project mismatches - #304
Merged
Merged
Conversation
Startup could claim success while tools still targeted another Unity project. Require filesystem identity before reusing a verified bridge, and fail clearly without changing its process or client configuration. Accept equivalent paths and explicitly unpinned repeats; reject unknown ownership. Regression: three real HTTP fixture mismatch cases failed before the fix and pass after it. Scoped fast check, 11-step local gate, and strict Pyright pass. Unity 6000.5.2f1 on Windows passes 395 EditMode and 15 PlayMode tests. Windows path variants will also run in CI; macOS was unavailable. Fixes #301
A null or malformed health project field does not prove that a bridge is unpinned. Report unknown ownership distinctly so the recovery diagnostic matches the rejection reason. The focused regression, fast checks, strict Pyright, and the 11-step local gate pass. Refs #301.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DISCLOSURE: LLM-GENERATED TEXT
Why: Bridge startup can silently reuse a different Unity project.
What:
Fixes #301
Note
Medium Risk
Changes when the host bridge short-circuits startup versus fails, which affects local dev workflows but is guarded by tests and leaves an existing listener untouched on mismatch.
Overview
Unity MCP host bridge reuse is now gated on project ownership, so startup no longer treats a healthy listener on the preferred port as reusable when its pinned (or unpinned) project does not match the requested settings.
existing_bridgetakes the requestedprojectPath, compares it to/healthzvia newsame_project(os.path.samefilefor absolute paths; empty strings match only when both sides are unpinned). A mismatch raisesValueErrorwith a clear message, exits startup with code 1, and does not alter the running bridge or.env.local. Equivalent spellings (trailing separators,.., symlinks, Windows case/slash variants) still count as the same project for the “already running” fast path.Integration and unit tests cover pinned↔unpinned mismatches, unknown
projectPathtypes, and alias acceptance..llm/mcp/README.mddocuments the failure mode and recovery (different--portor stop the old bridge).Reviewed by Cursor Bugbot for commit 30605b7. Bugbot is set up for automated code reviews on this repo. Configure here.