Repository navigation
test: the MCP login test spawns the CLI only where it needs a process of its own - #984
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test/cli-mcp.test.ts's "MCP login gives a browser ticket, saves a grant/binding and disconnects without deleting the grant" timed out (45 s) on a loaded machine. The cause is the test's cost, not FastAgent.Root cause
The test spawned the CLI 7 times, besides its
--checkpolls and the two ticket steps' own processes, and each spawn is a cold start of the whole CLI. Timed per spawn in a Linux container (Node 26.13.0, 4 CPUs):mcp loginthat starts a ticket)The rest is the refused
disconnect, which waits outBUSY_TIMEOUT_MS(5 s) for the storage the test holds, by design.The fix
A process of its own only where the test needs one, as
AGENTS.mdasks of CLI tests:mcp logins that start a ticket, whose step command isprocess.argv[1], which in process is not the CLI;disconnectrefused while the test holds the storage, since a POSIX lock does not exclude its own process.mcp list, themcp loginrefused for having no--scopes, every--check, and the lastdisconnectnow run in process. 3 spawns instead of 7 plus the polls.Verification
Under the same load (the shard with 8 CPU-bound processes), the file took 24 s and 19 s, against 43 s and 33 s before. Alone it takes 8.7 to 10.5 s, a little more than before, since the worker now loads the CLI once. The whole suite passed on macOS and in the Linux container.