This should probably do a copy, or deep copy on this.   *Or*, alternatively, you should first update the kwargs, then do the below stuff against kwargs.  What we're hitting here is that we've got a reference to a dict, so sometimes it is one thing (a dict) and other times another (a TaskRetryOptions object).  We just need to get that consistent, and safe.