Skip to content

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

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

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

Conversation

@mlimarenko

@mlimarenko mlimarenko commented Oct 4, 2026 •

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?

Classifies /api/command, /api/mcp and their nested paths through the existing slow-request share in the canonical request-queue machine. At most two slow requests occupy the four available slots, leaving capacity for small session reads. Current upstream priorities, concurrency limits, deadlines, cancellation and retry behavior are preserved; no old queue implementation is restored.

How did you verify your code works?

  • 22 focused classification, machine and transport tests passed, including dispatching a session read while MCP catalog requests remain held.
  • Changed formatting and git diff --check passed. The actual native pre-push lint/typecheck gate passed all 35 tasks.
  • This is a networking-only change; no visual control changed. A full Desktop reproduction of the intermittent timeout is not claimed.
  • Full upstream CI is not established on this refreshed tip while the PR is closed.

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

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72">
  <style>@media(prefers-reduced-motion:no-preference){.chat{animation:pass 2s infinite}}@keyframes pass{0%,100%{opacity:.5}50%{opacity:1}}</style>
  <g fill="none" stroke="currentColor"><rect x="8" y="12" width="48" height="48" rx="6"/><rect x="66" y="12" width="48" height="48" rx="6"/><rect x="124" y="12" width="108" height="48" rx="6" class="chat"/></g>
  <g fill="currentColor" font-family="sans-serif" font-size="10" text-anchor="middle"><text x="32" y="40">MCP</text><text x="90" y="40">MCP</text><text x="178" y="40">Chat can continue</text></g>
</svg>

@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 6 times, most recently from 7243122 to 240d136 Compare October 22, 2026 13:48
@mlimarenko
mlimarenko force-pushed the mcp-request-queue branch 2 times, most recently from aba8de0 to d1bec62 Compare October 26, 2026 09:26
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@mlimarenko

Copy link
Copy Markdown
Contributor Author

This PR is still being maintained. Could a maintainer reopen it after the automated age/reaction cleanup?

I have ported the fix onto 893e8dc43f05e872d4cac603486ce8a7181170fa in 5b32f4d98fd1b1d882a6566ca1084886b2382184. Upstream moved request classification into request-queue-machine.ts; the patch now extends that owner rather than restoring the old queue implementation. /api/command, /api/mcp and their nested routes use the existing slow-request share, while current priorities, concurrency limits and timeouts remain unchanged.

The 22 focused machine/transport tests pass, including dispatching a session read while MCP catalog requests remain held. The native pre-push lint/typecheck gate also passed. This addresses the still-open #53049; it does not claim that every Desktop timeout has been reproduced or fixed.

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

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