Skip to content

fix: restore TerminalLauncher tests, Windows prerelease source match, read_console log types - #1477

Merged
Scriptwonder merged 3 commits into
betafrom
fix/console-type-source-compare
Oct 19, 2026
Merged

Scriptwonder merged 3 commits into
betafrom
fix/console-type-source-compare

Conversation

@Scriptwonder

@Scriptwonder Scriptwonder commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Three maintainer fixes, one commit each.

1. Restore the TerminalLauncher tests removed with #1451

The cleanup commit in #1451 (c1f9344) deleted the whole TerminalLauncherTests.cs (375 lines), not just the Unicode-path case the PR added. That removed the 24 tests that existed before, including the #1279 guard CreateHeadlessProcessStartInfo_RedirectsStdinFromNul, and left an orphan .meta on beta. This restores the file exactly as it was before #1451 (from 31429ff). #1451's own test is not brought back.

2. Match identical package sources before comparing them as paths

Prerelease packages expect --from mcpforunityserver>=0.0.0a0. McpConfigurationHelper.PathsEqual passed both values to Path.GetFullPath, which throws on > in Unity's Mono on Windows, and the catch returned false. As a result:

  • JSON clients (McpClientConfiguratorBase.cs:254), Codex (:498) and OpenClaw (OpenClawConfigurator.cs:347) reported VersionMismatch: "Server version doesn't match the plugin" for a correct stdio config.
  • The startup auto-rewrite rewrote that config every session.

macOS/Linux and stable pins (==x.y.z) were not affected. The fix compares the trimmed text first, so every caller is fixed in one place. Local paths still go through GetFullPath.

3. read_console: take the log type from Unity's mode bits

InferTypeFromMessage searched the whole message, including the appended stack trace, and its result won over the mode bits for any Debug.Log. With Full stack traces the frames contain System.Exception&, so a Debug.Log came back as Exception and was returned by types: ["error"]. This is the second bug in #1433, which closed when #1443 fixed the first. Body text did the same in every stack-trace mode: a Debug.Log containing "TimeoutException", "LogError" or "Assertion" was typed Exception/Error/Assert. The mode-bit table was corrected in #1348, so the type now comes from it alone, and the text scan is deleted.

Part of #1433.

Verification (local, Windows)

Each new test was run on the code before the fix and on the fixed code:

Unity 2021.3.45f2 Unity 2022.3.62f2
CheckStatus_Configured_WhenStdioUsesPrereleasePackageRange, old code fails: VersionMismatch fails: VersionMismatch
HandleCommand_Get_KeepsDebugLogOutOfErrors_WithFullStackTrace, old code fails: Debug.Log read as error fails
Both, fixed code pass pass
ReadConsoleTests / CheckStatusUrlPropertyTests / TerminalLauncherTests, fixed code 23/23, 4/4, 24/24 23/23, 4/4, 24/24

A temporary probe (not committed) logged Debug.Log, LogWarning, LogError, LogException and LogAssertion, plus Log/Warning/Error bodies containing those keywords, under Full, ScriptOnly and None stack traces. That is 10 cases × 3 modes on each version.

  • Old code: on Full, Debug.Log was typed Exception and LogAssertion was typed Exception. In all modes, a Log with a keyword in its body was typed Exception/Error/Assert. On 2021.3 with None, a LogWarning containing "error CS0103" was typed Error, and a LogError containing "Exception" was typed Exception.
  • Fixed code: 30/30 correct on 2021.3 and on 2022.3.

Full EditMode suite on 2021.3 with the fix (probe excluded): 1564 tests, 1484 passed, 79 skipped, 1 failed. The failure is ExecPathBatchShimTests.FindAllInPath_ReturnsEveryMatchInPathOrder, a local artifact: this machine's TEMP is an 8.3 short path and where prints long paths. It fails on beta too.

Unity 6000.6.4f1: the package compiles. The test project does not compile there: existing tests call GetInstanceID(), which 6000.6 marks obsolete as an error, and com.unity.ide.windsurf also fails. Both are unrelated to this PR, and 6000.5+ is outside the CI matrix.

Not verified at runtime: a real C# compile error read through read_console. The mode table maps its bit (ScriptCompileError, 1<<11), and that table is unit-tested.

Summary by CodeRabbit

  • Bug Fixes
    • Console entries are now categorized by their recorded severity, so messages with full stack traces are less likely to appear under the wrong log type.
    • Matching configuration values now works when the trimmed values are identical, even if they cannot be normalized as file paths.

The cleanup commit in #1451 deleted the whole TerminalLauncherTests.cs instead of only
the Unicode-path case the PR added. This brings back the 24 tests that existed before
(including the #1279 stdin-redirect guard) and pairs the file with its .meta again.
…s paths

Prerelease packages expect "mcpforunityserver>=0.0.0a0". PathsEqual passed it to
Path.GetFullPath, which throws on '>' in Unity's Mono on Windows, so the comparison
returned false. JSON clients, Codex and OpenClaw then reported VersionMismatch for a
correct stdio config, and the startup auto-rewrite rewrote it every session.
InferTypeFromMessage searched the whole message, including the appended stack trace.
With Full stack traces the frames contain "System.Exception&", so a Debug.Log was
typed Exception and returned by types=["error"] (the second bug in #1433). Body text
such as "TimeoutException" in a plain log did the same. The mode bit table was fixed
in #1348, so read the type from it alone.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 02:54
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 686e2a5b-60f6-4869-a4c0-f161f36ba9c8
📥 Commits

Reviewing files that changed from the base of the PR and between 308efc0 and 20ed40e.

📒 Files selected for processing: 5
  • MCPForUnity/Editor/Helpers/McpConfigurationHelper.cs
  • MCPForUnity/Editor/Tools/ReadConsole.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Clients/CheckStatusUrlPropertyTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Services/Server/TerminalLauncherTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ReadConsoleTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The changes update path comparison and console log severity classification. They also add edit-mode tests for prerelease package status, console filtering, and terminal launching.

Changes: Configuration status

Layer / File(s) Summary
Path comparison and status validation
MCPForUnity/Editor/Helpers/McpConfigurationHelper.cs, TestProjects/UnityMCPTests/Assets/Tests/EditMode/Clients/CheckStatusUrlPropertyTests.cs
PathsEqual checks trimmed inputs for ordinal equality before path normalization. A new test checks that CheckStatus reports Configured for a stdio configuration with a prerelease package range.

Console severity

Layer / File(s) Summary
Mode-based severity classification
MCPForUnity/Editor/Tools/ReadConsole.cs, TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ReadConsoleTests.cs
GetConsoleEntries derives log type from entry mode bits instead of message and stack-trace text. A test checks that a log with a full stack trace is excluded from error results and returned as a log.

Terminal launcher tests

Layer / File(s) Summary
Project root and terminal process start information
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Services/Server/TerminalLauncherTests.cs
Tests check project-root lookup, terminal command validation and process properties, interface use, and platform-specific terminal selection.
Headless process start information
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Services/Server/TerminalLauncherTests.cs
Tests check headless command validation, output redirection, Windows stdin redirection, quoting, newline handling, and log-path construction.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: msanatan

Merge Risk: ⚪ Minimal · up to 20ed4

The changes are mergeable after normal checks. Real C# compile-error filtering has not been validated, but no failure was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the three main changes: restoring TerminalLauncher tests, fixing Windows prerelease source matching, and correcting read_console log types.
Description check Passed The description is detailed, relevant, and covers the changes, affected behavior, test results, supported Unity versions, known unrelated failures, and verification limits. It does not follow every te…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed, relevant, and covers the changes, affected behavior, test results, supported Unity versions, known unrelated failures, and verification limits. It does not follow every template heading or checklist, but it provides the required review context.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fixes have regression coverage, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

This PR fixes package-source matching and console log classification in the Unity Editor bridge, and restores previously removed terminal-launcher tests.

Changes:

  • Match identical package sources before filesystem normalization.
  • Classify console entries using Unity’s mode bits rather than message text.
  • Restore terminal-launcher coverage and add regression tests for both fixes.
File Description
TestProjects/​UnityMCPTests/​Assets/​Tests/​EditMode/​Tools/​ReadConsoleTests.cs Tests log filtering with Full stack traces.
TestProjects/​UnityMCPTests/​Assets/​Tests/​EditMode/​Services/​Server/​TerminalLauncherTests.cs Restores launcher tests, including Windows stdin redirection.
TestProjects/​UnityMCPTests/​Assets/​Tests/​EditMode/​Clients/​CheckStatusUrlPropertyTests.cs Tests prerelease source recognition.
MCPForUnity/​Editor/​Tools/​ReadConsole.cs Removes text-based severity inference.
MCPForUnity/​Editor/​Helpers/​McpConfigurationHelper.cs Compares identical source strings before normalizing paths.

Review effort: Balanced

@Scriptwonder
Scriptwonder merged commit 1879a6a into beta Oct 19, 2026
15 of 18 checks passed
@Scriptwonder
Scriptwonder deleted the fix/console-type-source-compare branch October 19, 2026 18:36
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.

2 participants