diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py index 873a61a0127..bf2e1298091 100644 --- a/litellm/proxy/_experimental/mcp_server/server.py +++ b/litellm/proxy/_experimental/mcp_server/server.py @@ -3194,13 +3194,8 @@ if MCP_AVAILABLE: time.monotonic() ) - # Defensive cleanup: if the session has no auth-context - # tracking and no in-flight requests, the per-session lock - # would otherwise be orphaned (the periodic cleanup loop - # iterates ``_stateful_session_auth_context_last_seen`` and - # would never see it). This guards against narrow paths - # where a lock is created for a session_id that never - # entered ``_stateful_session_auth_contexts``. + # Periodic cleanup iterates _stateful_session_auth_context_last_seen, + # so locks for untracked sessions must be dropped here. if ( active_request_count <= 0 and session_id not in _stateful_session_auth_contexts