Skip to content

Reject Unity bridge project mismatches - #304

Merged
Eli Pinkerton (wallstop) merged 2 commits into
mainfrom
fix/bridge-project-reuse
Oct 19, 2026
Merged

Eli Pinkerton (wallstop) merged 2 commits into
mainfrom
fix/bridge-project-reuse

Conversation

@wallstop

@wallstop Eli Pinkerton (wallstop) commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

DISCLOSURE: LLM-GENERATED TEXT

Why: Bridge startup can silently reuse a different Unity project.

What:

  • Reject mismatched or unknown project ownership before reuse.
  • Preserve existing bridges and client settings when startup fails.
  • Accept equivalent project paths and matching unpinned startup.
  • Cover project mismatches and document recovery steps.

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_bridge takes the requested projectPath, compares it to /healthz via new same_project (os.path.samefile for absolute paths; empty strings match only when both sides are unpinned). A mismatch raises ValueError with 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 projectPath types, and alias acceptance. .llm/mcp/README.md documents the failure mode and recovery (different --port or stop the old bridge).

Reviewed by Cursor Bugbot for commit 30605b7. Bugbot is set up for automated code reviews on this repo. Configure here.

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.
@wallstop
Eli Pinkerton (wallstop) merged commit ed19756 into main Oct 19, 2026
3 checks passed
@wallstop
Eli Pinkerton (wallstop) deleted the fix/bridge-project-reuse branch October 19, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match project pins before reusing a Unity bridge

1 participant