Q: How to use an environment defined by the versions-package inside another environment When I use the versions package to conditionally exclude content like this:
\documentclass{article}
\usepackage{color}% just as example

\usepackage[tracing]{versions}
\excludeversion{vers}% opposite to \includeversion{vers}

\newenvironment{test}{%
START%
\vers%
\color{red}%
}{%
\endvers%
END% is excluded but should not be excluded 
}

\begin{document}
before

\begin{test}
% content is excluded for \excludeversion{vers}
%        and included for \includeversion{vers} above
inside
\end{test}

after
\end{document}

I can exclude the content of the vers environment, as intended by the use of the versions package. But also END gets excluded (after \endvers), opposed to my intention. With \includeversion{vers} also END gets included (as intended). What do I do wrong, and how do I fix it?
It is possible to define
\newcommand{\afterendvers}{%
END% and all other stuff I want to have executed here
}

and replace \end{test} by \end{test}\afterendvers in the whole document, but a more "TeXnical" solution would be nice.
Related issue: With \includeversion{vers} END is printed in red, although 

environments processed as if \begin{<version>} and \end{<version>}
  just were not present, however they form groups like
  \begin{relax} <code> \end{relax} or \begingroup  <code>  \endgroup

(from the versions manual), but 
\vers%
\bgroup%
\color{red}%
}{%
\egroup%
\endvers%
END%

leads to END being written in black, as expected. I.e.: \vers and \endvers do not appear to act as \begingroup and \endgroup in this case.

A: The problem occurs because when excluded \vers contains a \let\end\fi and \iffalse, so will ignore everything until the next \end{<current environment>}, where the current environment is set by the last \begin, i.e. test here. I don't think this \end is expanded, so the \endvers% and END in it is never seen. 
I tried to figure out a way for this by looking at the source code of the versions package, but this just confirmed that such a usage is not supported by it. Larger rewrites of this package would be required for this.

A: I'm not sure what your actual use case is, but it seems like your MWE is supposed to conditionally color some text based on the version.  This works for me:
\documentclass{article}
\usepackage{color}% just as example
\usepackage[tracing]{versions}
\excludeversion{vers}

\def\colorbyversion{\normalcolor}
\begin{vers}
\gdef\colorbyversion{\color{red}}
\end{vers}

\newenvironment{test}{
START
\bgroup\colorbyversion}{%
\egroup
END% should not be excluded
}

\begin{document}
before

\begin{test}
inside
\end{test}

after
\end{document}

With \includeversion{vers}:

With \excludeversion{vers}:

The \gdef is needed to make the redefinition of \colorbyversion global.  Otherwise, the definition inside the vers environment dies at \end{vers}.
