Skip to content

Run Unity bridge commands through Python - #300

Merged
Eli Pinkerton (wallstop) merged 1 commit into
refactor/python-unity-bridgefrom
refactor/python-bridge-entrypoint
Oct 19, 2026
Merged

Eli Pinkerton (wallstop) merged 1 commit into
refactor/python-unity-bridgefrom
refactor/python-bridge-entrypoint

Conversation

@wallstop

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

Copy link
Copy Markdown
Collaborator

DISCLOSURE: LLM-GENERATED TEXT

Why: The validated Python bridge is not yet the default entry point.

What:

  • Route npm commands through uv and Python.
  • Keep legacy Node paths as small compatibility launchers.
  • Preserve HTTP continue and connection reuse.
  • Keep deadlines and health responsive when CLI input stalls.

Refs #171.

Type of Change

  • Refactor (code change that neither fixes a bug nor adds a feature)

Checklist

  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes do not introduce breaking changes, or breaking changes are documented

Note

Medium Risk
Changes the default MCP host/sync path and stdin/HTTP threading for the Unity bridge; behavior is heavily tested but affects devcontainer agent connectivity to Unity.

Overview
Makes the typed Python implementations the default for Unity MCP hosting and universal MCP sync, while keeping thin Node launchers for backward compatibility.

npm now runs uv run scripts/mcp_configure.py (mcp:sync) and uv run scripts/unity_mcp_host.py (unity:mcp:host). .llm/mcp/unity-mcp-host.mjs is reduced to a uv/Python 3.9+ delegator instead of hosting the full HTTP bridge.

The Python bridge decouples CLI stdin writes from request handling via a bounded input queue and writer thread, so a stalled Unity CLI reader no longer blocks RPC timeouts or /healthz. The HTTP handler advertises HTTP/1.1 for clients using Expect: 100-continue and connection reuse.

Docs in .llm/mcp/README.md describe the new entry points. Tests retire direct Node bridge coverage, extend the Python harness (stalled input, legacy .mjs launcher, HTTP continue), and skip the old Node HostTests class.

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

The Python implementation is ready to replace Node. Route npm commands through uv and preserve the old Node path as a small compatibility launcher.

Match Node HTTP behavior with HTTP/1.1 continue and connection reuse. A socket regression first timed out waiting for 100 Continue and now passes. A one-megabyte request to a CLI that stops reading also reproduced a blocked timeout; a per-child writer queue bounded to 128 messages keeps pipe writes outside the request lock, so request deadlines and health remain responsive.

Strict pyright, Python 3.9 focused cases, the full 17-step gate, and native Windows bridge contracts pass. Windows runs 17 cases with four expected legacy/platform skips; those Node hooks are removed in the final cleanup layer. The diff is 751 changed lines. Refs #171.
@wallstop
Eli Pinkerton (wallstop) force-pushed the refactor/python-bridge-entrypoint branch from 0732575 to c4e9d4e Compare October 18, 2026 21:30
@wallstop
Eli Pinkerton (wallstop) merged commit 81c08e6 into main Oct 19, 2026
3 checks passed
@wallstop
Eli Pinkerton (wallstop) deleted the refactor/python-bridge-entrypoint branch October 19, 2026 02:16
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.

1 participant