I think (I haven't tested this myself) that the issue is because the federated_identity is not encoded. Try replacing the question mark with %3F
. Also make sure the url
https://google.com/accounts/o8/site-xrds?hd=example.com
works.
The test I did was to go to the url
http://testsk2012.appspot.com/_ah/login_redir?claimid=https://www.google.com/accounts/o8/site-xrds%3Fhd=somesite.com&continue=http://testsk2012.appspot.com/
and it succeeded.