ServeRun sent a call to the child server and only then opened the call's
SSE stream. A server that asks roots/list at once could have the ask
land before that stream existed: it went to an older session stream, or
nowhere, and the call's own reply came first. That is #5433's red,
TestRunServerAsks seeing "roots " with nothing after it, which came back
on ubuntu CI at 296a9292c. The stream is now opened before the send and
closed on every return, a failed send included.
This is skygunner's patch (5acae7bee on their fork, posted on #5433 on
11-08), applied to main unchanged.
Run on mote at origin/main 0cc91af3d plus this change: TestRun* -race
-count=10 ok; ./internal/library ok (190s); go vet ok, and GOOS=windows
and GOOS=linux -tags nogui vet ok; gofmt clean.
Red on the old code: the new TestRunServerAsksOnCallStreamBeforeSendReturns,
with main's mcp_run.go, fails 3 of 3: "roots/list delivered to session
stream instead of call stream".
Not tried: Windows and Linux runs (the WSL box answered
Wsl/Service/E_UNEXPECTED), and the full suite.
Co-authored-by: vincent <vincent@users.noreply.github.com>