Skip to content

Fix rewrite-csharp integTest: stop dotnet run build output corrupting the RPC stream#8006

Draft
knutwannheden wants to merge 1 commit into
mainfrom
surly-falcon
Draft

Fix rewrite-csharp integTest: stop dotnet run build output corrupting the RPC stream#8006
knutwannheden wants to merge 1 commit into
mainfrom
surly-falcon

Conversation

@knutwannheden

Copy link
Copy Markdown
Contributor

Motivation

main CI has been red since 2026-06-12, with every run failing identically at
:rewrite-csharp:integTest:

io.moderne.jsonrpc.JsonRpcException: {code=-32603, message='Internal error: JSON-RPC peer closed the stream'}

The failures appeared on commits entirely unrelated to C# (e.g. a
ChangeMethodInvocationReturnType fix, a Python type-attribution change),
which is the tell that the trigger was external rather than a code regression.

The integTest launches the C# server with dotnet run --project ... --framework net10.0.
dotnet run performs an implicit restore + build and writes MSBuild/NuGet
output to stdout — the same stream used for the JSON-RPC bridge. A NuGet
security advisory (NU1903 / GHSA-hv8m-jj95-wg3x) was published around
2026-06-12 for MessagePack 2.5.187 (pulled transitively). NuGet's restore
audit then started printing a warning to stdout, corrupting the RPC framing and
killing the peer. Reproduced locally, the warning is visible inline in the stream:

Invalid Request: Expected Content-Length header but received
'...OpenRewrite.csproj : warning NU1903: Package 'MessagePack' 2.5.187 has a
known high severity vulnerability, https://github.com/advisories/GHSA-hv8m-jj95-wg3x ...'

Production launches a pre-built apphost (buildToolPathCommand), so only the
test launcher (buildCsprojCommand) was affected.

Summary

  • Add --no-build to the dotnet run command in
    CSharpRewriteRpc.buildCsprojCommand. --no-build implies --no-restore,
    so no restore audit runs and no MSBuild/NuGet output can reach stdout.
  • This is safe because the project is always pre-built by the csharpBuild
    Gradle task that this command's only caller (integTest) depends on. It also
    matches the --no-build already used by the csharpTest task in the same
    build file.
  • --verbosity quiet was rejected: it does not suppress the NU1903 warning
    on stdout; only skipping restore/build does.

Test plan

  • ./gradlew :rewrite-csharp:integTest — 17 tests, 0 failures (was 16/17
    failing before the fix).
  • Confirmed via direct dotnet run invocation that --no-build yields a
    clean stdout (no NU1903), while --verbosity quiet still leaks it.

… the RPC stream

The integTest launches the C# server via `dotnet run`, which performs an
implicit restore + build and writes MSBuild/NuGet output to stdout — the
same stream used for JSON-RPC. A newly published NuGet security advisory
(NU1903 for the transitively-pulled MessagePack 2.5.187) made the restore
audit emit a warning on stdout, corrupting the RPC framing and killing the
peer ("JSON-RPC peer closed the stream"). This turned main CI red on commits
unrelated to C#.

Pass --no-build (which implies --no-restore) so dotnet run emits no build
output. The project is always pre-built by the csharpBuild Gradle task that
this command's only caller (integTest) depends on, matching the --no-build
already used by the csharpTest task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant