Skip to content

Remove use of AsyncLocal to track Task input_required status #1185

Open

Description

@halter73

Do we really need to use the execution context to track the automatic status updates? Any request would be made via the request context. It also seems weird to me that this PR doesn't make any changes to McpSessionHandler. I figured a lot of the task handling would be the same for the client and server, so it makes sense for the logic tracking related requests to go there.

Originally posted by @halter73 in #1170 (comment)

Activity

  1. added
    enhancement
    ready for work
    P2
    on Mar 5, 2026
  2. jstar0 commented on Jul 15, 2026

    @jstar0
    Contributor

    Hi, I'd like to work on this.

    I checked current main after the Tasks extension extraction and confirmed the task input path again uses a static AsyncLocal outgoing-request interceptor. My proposed approach is to bind that interceptor to the request-scoped McpServer/request context instead, while preserving nested scope restoration.

    I plan to add a concurrency regression with two task-augmented tool calls forced to interleave, each using a different task/store route, and assert that sampling/elicitation/roots requests cannot cross between them. I will keep the change focused on request routing and avoid changing the Tasks wire format or store semantics.

    I do not have permission to self-assign this issue. Could a maintainer assign it to me if this approach looks appropriate?

  3. added this to the 2.x milestone on Jul 27, 2026
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

    P2enhancementready for work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions