Why does the optional argument for the bibdiv environment in AMSRefs not override the default text of the heading in the amsart document class?

In Section 4 Section titles for bibliographies: bibdiv, bibsection, bibchapter of the AMSRefs package documentation, the following is mentioned:

[bibdiv] will use the current value of \bibname or \refname for the heading text. However, if that’s not sufficient, there are three more ways of customizing its behavior:
...

1. All three environments [bibdiv, bibsection, bibchapter] take an optional argument to override the text of the heading:

\begin{bibchapter}[Annotated Bibliography]


...

I checked that this works in the standard document classes article, book, report and also memoir (after a small adjustment). However, in the amsart document class, the heading text is always printed as References. Here's an MCVE:

\documentclass{amsart}
\usepackage{amsrefs}

\begin{document}

\begin{bibdiv}[Annotated Bibliography]
\begin{biblist}

\bib{art1}{article}{
author={First Author},
title={Title of the paper},
journal={Journal of interesting results},
volume={10},
date={2021},
}

\end{biblist}
\end{bibdiv}

\begin{bibsection}[Annotated Bibliography]
\begin{biblist*}

\bib{art2}{article}{
author={First Author},
title={Title of the paper},
journal={Journal of interesting results},
volume={10},
date={2021},
}

\end{biblist*}
\end{bibsection}

\end{document}


Why is the header not changed when using the amsart document class? Is there a fix so that the optional argument for the bibdiv environment works even in the amsart document class?

I suppose an alternative is to use \renewcommand{\refname}{Annotated Bibliography}, but I would like to know why the behavior is different only for the amsart document class, and whether it can be made uniform.

In case it helps, I browsed through the documented source and it looks like the relevant portions are in lines 1198–1243, in the Subsubsection 6.12.8 Printing the bibliography:

1198 \providecommand{\bibname}{Bibliography}
1199 \providecommand{\refname}{References}

...

1210 \newenvironment{bibchapter}[1][\bibname]{%
1211     \begingroup
1212         \protected@edef\@{%
1213                 \endgroup
1214             \protect\chapter*{#1}%
1215             \protect\bib@div@mark{#1}%
1216         }%
1217         \@
1218 }{\par}

1219 \newenvironment{bibsection}[1][\refname]{%
1220     \begingroup
1221         \protected@edef\@{%
1222                 \endgroup
1223             \ifx\@bibtitlestyle\undefined
1224                 \protect\section*{#1}%
1225             \else
1226                 \protect\@bibtitlestyle
1227             \fi
1228             \protect\bib@div@mark{#1}%
1229         }%
1230         \@
1231 }{\par}

1232 \@ifundefined{chapter}{%
1233     \newenvironment{bibdiv}{\bibsection}{\endbibsection}
1234 }{%
1235     \newenvironment{bibdiv}{\bibchapter}{\endbibchapter}
1236 }

1237 \renewenvironment{thebibliography}[1]{%
1238     \bibdiv
1239     \biblist[\resetbiblist{#1}]%
1240 }{%
1241     \endbiblist
1242     \endbibdiv
1243 }


If you look at the definition of \bibsection you see that it contains a switch

  \ifx\@bibtitlestyle\undefined


and if you look then into amsart.cls you can find a definition for this

\newcommand{\@bibtitlestyle}{%
\@xp\section\@xp*\@xp{\refname}%
}


This means that amsrefs gives you some some flexibility when used with a "foreign" class, but force their style when used with their own class. Making this more uniform would require to redefine the internal command.