fix(mcp): satisfy the tightened type discipline budget after merging main

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-09-23 23:04:14 +00:00
parent 8007215599
commit 595ced358a
2 changed files with 7 additions and 6 deletions

View file

@ -1189,7 +1189,7 @@ class MCPClient:
raise
_PendingOperation: TypeAlias = tuple[Callable[[ClientSession], Awaitable[object]], "asyncio.Future[object]"]
_PendingOperation: TypeAlias = "tuple[Callable[[ClientSession], Awaitable[object]], asyncio.Future[object]]"
_MAX_PENDING_OPERATIONS: Final = 64

View file

@ -1868,10 +1868,7 @@ class MCPServerManager:
discovery_ttl, discovery_clock, TypeAdapter(tuple[ResourceTemplate, ...])
)
self.registry: dict[str, MCPServer] = {}
# (gateway mcp-session-id, server_id, upstream auth fingerprint) -> the one upstream
# session every tool call of that gateway session reuses, so stateful upstreams keep
# their per-session state between calls. Released with the gateway session.
self._upstream_sessions: dict[tuple[str, str, str], PersistentMCPSession] = {}
self._upstream_sessions: dict[tuple[str, str, str], PersistentMCPSession] = {} # mutable-ok: session registry
self._openapi_health_probes: Callable[[str], _OpenAPIHealthProbe] = lru_cache(maxsize=128)(_OpenAPIHealthProbe)
self.config_mcp_servers: dict[str, MCPServer] = {}
"""
@ -5794,7 +5791,11 @@ class MCPServerManager:
raw_headers: Mapping[str, str] | None,
) -> PersistentMCPSession | None:
gateway_session_id: Final = next(
(value for key, value in (raw_headers or {}).items() if key.lower() == "mcp-session-id" and value),
(
value
for key, value in (raw_headers.items() if raw_headers else ())
if key.lower() == "mcp-session-id" and value
),
None,
)
if gateway_session_id is None or mcp_server.transport == MCPTransport.stdio: