Skip to content

fix(app): reserve chat request slots during MCP discovery - #53050

Open
mlimarenko wants to merge 3 commits into
anomalyco:devfrom
mlimarenko:mcp-request-queue
Open

mlimarenko wants to merge 3 commits into
anomalyco:devfrom
mlimarenko:mcp-request-queue

Conversation

@mlimarenko

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #53049

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Includes /api/command and /api/mcp (and their nested routes) in the existing slow-request quota. MCP discovery can wait for server startup or catalog responses; it should not occupy all four client request slots ahead of chat reads.

No concurrency limits, deadlines or retry rules change. At most two slow requests remain active, allowing small session reads to bypass queued catalogs through the existing scheduler.

How did you verify your code works?

  • Red/green regression: before the fix, four command catalogs dispatched and the message read did not; after it, two catalogs and the message read dispatched immediately.
  • bun test src/runtime/server/request-queue.test.ts from packages/app: 12 passed, 0 failed, covering all three catalog endpoints plus existing timeout, cancellation, FIFO and event-stream behavior.
  • Loopback HTTP replay with the actual fetch implementation: chat returned HTTP 200 while two catalog responses remained held and two catalogs remained queued.
  • Changed-file Prettier and git diff --check passed. Native pre-push bun run check passed.

The full suite is deferred to CI. This networking-only change does not alter rendered controls; a full Desktop replay of the user's intermittent timeout has not been captured.

Screenshots / recordings

No visual change; the regression asserts request dispatch and completion.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@mlimarenko

Copy link
Copy Markdown
Contributor Author

Issue: #53049 (also linked with Closes #53049 in the description).

For the required v2 target, the default-branch PR-standards workflow's closingIssuesReferences-only check can produce a false needs:issue label. The existing v2 workflow already includes the PR-body fallback. Evidence and the request to bring that fallback to dev: #53040 (comment).

@mlimarenko

Copy link
Copy Markdown
Contributor Author

Rebased onto v2 at f72a103a4b94fb9a467294877bf6243dd99c6bdc; current head is f5c8aa3c07d432c9758b45bf30930e141061e2be. git range-diff confirms the patches are unchanged.

All 12 request-queue tests passed. Native pre-push bun run check also passed (36 typecheck tasks).

The upstream test, check and nix-eval runs on this head are action_required, rather than failed tests. Could a maintainer approve the fork workflow runs? Test run.

@mlimarenko

Copy link
Copy Markdown
Contributor Author

Rebased onto current v2 at 8eb2ebd96cb2e25f9607f753e892a533628b8d46. New head: a4586ade8a0c9e00a0b05196cc8c63983f601fd3.

Resolved the upstream formatting/rename/import conflicts while retaining the fix's behavior. All 12 request-queue tests passed. The native pre-push bun run check also passed all 36 tasks. GitHub reports this head as conflict-free.

The full upstream test/check result is not established on this head yet; only the local checks above are confirmed.

@mlimarenko

Copy link
Copy Markdown
Contributor Author

Rebased onto v2 at 216c31174. Current head: 6f57a9e9ea10eb15a689ff68702a003be8f0be21.

All 12 request-queue tests passed. The patch is unchanged according to git range-diff.

The native pre-push bun run check passed on this head. Full upstream CI remains subject to maintainer approval for fork workflow runs; it is not claimed green. Could a maintainer approve the test, check, and nix-eval workflows?

@mlimarenko

mlimarenko commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto current v2 at 7d179e83f42a9bb6377b6f34d8d4fcbf04707621 (package version 2.0.26). New head: 624d11ca2c0a88c327ab4c1297ab52351b63d0a2.

The patch is unchanged according to git range-diff. All 12 request-queue tests passed. The native pre-push bun run check passed all 36 tasks and the lease-protected push completed successfully. Existing lint warnings remain.

The description still references Closes #53049. Full upstream CI is not claimed green; fork workflows may require maintainer approval.

Base clarification: release commit 9b4ec5714d481559990db0a816d5dec19541a814 is a sibling of the current development line, not its ancestor; these PRs target and are rebased onto upstream/v2 as requested.

@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:30
@mlimarenko

mlimarenko commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto v2 at 4617210822bdbb31e5749751afbfb4584ccedac8; head: df02d846f4148e7976a42bf01a22da118357544f. git range-diff confirms the patch is unchanged.

All 12 request-queue tests and native pre-push bun run check passed (36 typecheck tasks; lint warnings remain). The PR's current dev target is unchanged.

Upstream CI is not green: check, test, and nix-eval on this exact head are action_required and need maintainer approval. PR standards passed.

@mlimarenko
mlimarenko force-pushed the mcp-request-queue branch 2 times, most recently from df02d84 to cbfeea9 Compare October 14, 2026 09:42
@mlimarenko

Copy link
Copy Markdown
Contributor Author

Rebased onto current dev at 34d8ded0c58dd66808c1d60e081e8c66da12a896, rather than the old v2 alias. Published head: cbfeea9de29b6ffd638ddc18374420c0b8b796b6.

Typed the existing queue diagnostic payload and documented test assertion invariants for the new whole-file GUI lint check. All 12 queue tests and app typecheck passed; scheduling behavior is unchanged. Required lint:changed and the native pre-push gate passed (36/36 typecheck tasks).

The exact-head test, check, and nix-eval workflows are action_required, not green; maintainer approval is still needed. PR standards passed.

@mlimarenko
mlimarenko force-pushed the mcp-request-queue branch 5 times, most recently from 2659a3e to 7243122 Compare October 21, 2026 08:04

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2: MCP discovery can starve chat reads in the client request queue

2 participants