Repository navigation
Remove the stdio transport and the legacy TCP bridge - #38
Conversation
This fork only uses HTTP. Deletes the second, parallel transport stack: stdio on the Python side and the framed TCP bridge it used to reach Unity. Python: - Delete Server/src/transport/legacy/ (unity_connection, port_discovery, stdio_port_registry). Rescue _extract_response_reason / _is_reloading_response into models/unity_response.py, which the HTTP path still needs. - Drop the send_fn escape hatch from send_with_unity_instance; it is now a single HTTP path. Sweeps 60 files / 72 call sites. - Convert the four sites that bypassed the shim entirely (sync_tool_visibility_from_unity, script_apply_edits get_sha/read, the manage_script reload sentinel) rather than only dropping their imports. - Keep --transport, accepting only "http", so client configs written by older packages keep working on upgrade. Unity: - Delete StdioBridgeHost, StdioTransportClient, StdioBridgeReloadHandler, PortManager. Collapse TransportManager to one client and drop TransportMode. - Remove UseHttpTransport: with stdio gone a stale `false` from a prior install would have silently disabled auto-start and reload-resume. - Remove ConfiguredTransport.Stdio. A leftover stdio config now reports MissingConfig so the UI prompts re-Configure, and StdIoVersionMigration -> LegacyClientConfigMigration rewrites it on the next version bump. Test harness (tools/local_harness.py): - Port from the TCP bridge to HTTP: the harness starts its own MCP server, boots Unity against it via McpCiBoot.StartHttpForCi, discovers the instance through /api/instances and sends through /api/command. - Port isolation: never binds 8080 or $UNITY_MCP_HTTP_PORT, points its Editor at its own server with the UNITY_MCP_HTTP_URL env override (EditorPrefs are machine-wide, so writing them would repoint the developer's Editor), and no longer sets UNITY_MCP_ALLOW_BATCH — the flag that lets a batch Editor reach StopLocalHttpServerInternal, which terminates whatever owns the target port. - Scope UNITY_MCP_HTTP_URL to GetBaseUrl (the connection path), never GetLocalBaseUrl, so it cannot steer local-server management decisions. - Unwrap the /api/command envelope: its outer "status" collided with the UTF job status and made _poll_utf poll forever. - Own reload retries: /api/command routes to PluginHub.send_command, which has no retry wrapper, and the UTF legs trigger domain reloads. Also: delete e2e-bridge.yml and claude-nl-suite.yml (both pinned to a 2021.3 container that cannot open this 6.5 project) and tools/stress_*.py (they implement the deleted framed protocol directly); update docs; regenerate the reference pages, which were already stale on origin/main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Correction: the gate note above is wrong where it says Unity's native runner passes all three pre-existing failures. It passes only The two All three are fixed in #41 ( |
Removes the stdio transport and the legacy framed TCP bridge it used to reach Unity. This fork only uses HTTP, and stdio was still the Python default —
Server/Dockerfileandmanifest.jsonboth omitted--transportand inherited it, while Unity already defaultedUseHttpTransport = true. Net −9,000 lines across 29 deleted files.Python
Server/src/transport/legacy/(unity_connection,port_discovery,stdio_port_registry)._extract_response_reason/_is_reloading_responseare rescued intomodels/unity_response.py— the HTTP path still uses them.send_fnescape hatch fromsend_with_unity_instance; it is now a single HTTP path. 60 files / 72 call sites.sync_tool_visibility_from_unity,script_apply_editsget_sha/read, themanage_scriptreload sentinel) rather than only dropping their imports — deleting those would have silently broken them.--transportis retained, accepting onlyhttp, so client configs written by older packages keep working on upgrade.Unity
StdioBridgeHost(1134 lines),StdioTransportClient,StdioBridgeReloadHandler,PortManager.TransportManagercollapses to one client;TransportModegoes.UseHttpTransport. With stdio gone, a stalefalsefrom a prior install would have silently disabled auto-start and reload-resume.ConfiguredTransport.Stdio. A leftover stdio config now reportsMissingConfigso the UI prompts re-Configure, andStdIoVersionMigration→LegacyClientConfigMigrationrewrites it on the next version bump. (Kept, not deleted — it is the only thing that migrates upgrading users off stdio.)Test harness
tools/local_harness.pydrove Unity entirely over the TCP bridge, so it is ported to HTTP: it starts its own MCP server, boots Unity against it viaMcpCiBoot.StartHttpForCi, discovers the instance through/api/instances, and sends through/api/command.Port isolation — 8080 is the everyday local server port, and Unity's
StartLocalHttpServerterminates whatever process owns the port it is about to bind. The harness therefore:$UNITY_MCP_HTTP_PORT(--http-port 8080is a hard exit2);UNITY_MCP_HTTP_URLenv override rather than EditorPrefs, which are shared machine-wide per Unity version;UNITY_MCP_ALLOW_BATCH, the flag that lets a batch Editor reachStopLocalHttpServerInternalat all;Verified across seven runs against a live 8080 server — including one killed mid-flight and one where another Unity project connected to 8080 concurrently. The listener PID never changed and
/healthstayed 200.Four bugs in the port were found only by running it end-to-end:
/api/instancesfield names, a blocked main thread inMcpCiBoot(Unity registered but could not execute), the/api/commandenvelope colliding with the UTF job status in_poll_utf, and missing reload retry (/api/commandroutes toPluginHub.send_command, which has no retry wrapper, while the UTF legs trigger domain reloads).Also
e2e-bridge.ymlandclaude-nl-suite.yml— both pinned to a 2021.3 container that cannot open this 6.5 project, so both were already unrunnable.claude-nl-suite.ymlwasworkflow_dispatch-only and gated nothing.tools/stress_*.py— they implement the deleted framed socket protocol directly.CLAUDE.md,Server/README.md, the transports page, install/clients/guides, zh translations, the homepage cards, the bug-report template.website/docs/reference/— this drift is pre-existing onmain(verified in a clean worktree); CI'sdocs-generatecheck runs because this PR touchesServer/src/services/**, so it had to be fixed here.Gate
Python: 1502 passed, 3 skipped.
Harness unit tests: 139 passed (including 18 for port isolation, 7 for reload retry, 6 for envelope handling).
Unity compile (6000.5.5f1): pass.
Unity EditMode, native
-runTests: pass.Harness smoke leg: 7/7, exit 0.
Harness EditMode leg: 3 failures, all pre-existing —
Proven two independent ways: Unity's native runner (no MCP transport at all) passes all three, and running unmodified
origin/mainwith its original stdio harness in a separate worktree produces a character-identical failure set. They are artifacts of driving tests through an MCPrun_testsjob — the activity phase readsrunning_tests, and the console carries session traffic — and they predate this change. Not fixed here; they are unrelated to stdio and would block any Unity-touching PR.🤖 Generated with Claude Code