Skip to content

CI: investigate Ubuntu failure in TestStdioMCPTool #2

Closed

Description

@Balanov

Observed

While reviewing #1, test (ubuntu-latest) failed in TestStdioMCPTool in two observed attempts:

Both report:

--- FAIL: TestStdioMCPTool
    manager_test.go:68: unexpected result: "" MCP server closed stdio:

macOS and Windows passed in both attempts. The internal/agent package changed by #1 also passed on Ubuntu, and the PR does not modify internal/mcp.

On local Windows with Go 1.27.3, TestStdioMCPTool passed 50 consecutive runs. CI currently selects Go 1.25.x. WSL and Docker are unavailable locally, so an independent Linux reproduction is still needed.

Next step

Reproduce on Ubuntu with additional child-process exit diagnostics, then address the cause rather than repeatedly rerunning or skipping the test. It is not yet established whether this is a test-only race or a stdio client lifecycle bug.

Activity

  1. Balanov commented on Nov 13, 2026

    @Balanov
    OwnerAuthor

    Resolved, and it was not a test race.

    The cause is a race in the stdio client, not in the test. Call closed its done channel before its caller cancelled the request context. When the watcher goroutine was scheduled after both were ready, Go's select could pick the cancellation branch and kill the shared MCP server process even though that request had already completed. The next request then failed with MCP server closed stdio — exactly the symptom in the log.

    context.AfterFunc in #3 removes it: the callback is unregistered before Call returns, so a completed request can never take the cancellation branch. The regression test in that PR reproduces the original failure (244 of 1000 completed-call cycles on the old client) and passes on the new one.

    Closing this in favour of #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions