I have just been struggling with this implementation and would like to start by saying thanks for documenting the SSO function! Could not have done it without it!
However, the behavior I observed with a fresh test just now does not quite match this documentation. When the sso overrides groups option is specified the add_groups parameter does not add the listed groups. However the groups parameter does properly define the group memberships.
When the sso overrides groups option is not specified, then add_groups works but groups does not.
I also learned that the comma delimited list of groups is not tolerant of spaces around (or at least after) the commas. IIRC when there are spaces, only the first group gets recognized.