Repository navigation
fix(app): reserve chat request slots during MCP discovery - #62564
Open
mlimarenko wants to merge 1 commit into
Open
mlimarenko wants to merge 1 commit into
mlimarenko wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Looks good. I reproduced #53049 with the issue's queue script. On the base, four held /api/command, /api/mcp or /api/mcp/resource requests took all 4 slots and the session message read was never sent. With this change, catalogs hold 2 slots and the session read is sent and finishes for all three paths. The request-queue tests pass (22/22) and tsc -b in packages/app is clean.
The prefix match only covers the three GET catalog endpoints. MCP add, remove, connect and disconnect live under /api/experimental/mcp/..., so they aren't capped.
Public API is unchanged: this only affects the app's client-side request queue.
Related: #59526
This branch has not been deployed
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.
Issue for this PR
Closes #53049
Type of change
What does this PR do?
Classifies
/api/command,/api/mcpand their nested routes through the existing slow-request share inrequest-queue-machine.ts. The queue keeps four slots and at most two slow requests, so a session read can start while MCP or command catalogs are still waiting on server startup or discovery. Current priorities, concurrency limits, deadlines, cancellation and retry behaviour are unchanged.This is the current-
devport of #53050, which the automated age/reaction cleanup closed on 2026-11-04. That closure was not a review result. Base:21bf6b493b76efcf3769ade999f05163760d61af.How did you verify your code works?
bun test --config /dev/null ./src/runtime/server/request-queue-machine.test.ts ./src/runtime/server/request-queue.test.tsfrompackages/app: 22 passed, 0 failed, 82 assertions. The transport case holds two catalogs and asserts a session read is dispatched before the third catalog.bun run typecheckinpackages/app: no type errors in 2,332 files.bun run lint:changed: 0 problems in the 3 changed files.lint && typecheckgate passed.action_requiredfor fork runs, not failed tests. Full CI on this head is not claimed green while GitHub requires maintainer approval.Not claimed: a full Desktop reproduction of the intermittent timeout. This is a queue-classification change with a loopback/transport regression, not a root-cause proof of every slow request.
Screenshots / recordings
No visual control changed.
Visual
Checklist
Added by the opencode bot (AI-generated).
Related: #59526