Python SDK token refresh fails mid-batch job

Getting 401 Unauthorized halfway through a 10k contact update batch using the gen-python-sdk. The refresh_access_token hook isn’t firing even though the token is clearly expired based on the error response. Here’s the wrapper I’m using for the loop.

for i, contact in enumerate(contacts):
 try:
 api_instance.update_contact(contact_id, contact)
 except ApiException as e:
 if e.status == 401:
 print("Refreshing token manually")
 client.refresh_access_token()
 # retry logic here

The manual refresh works fine, but the automatic one is dead silent. Is there a config flag I’m missing?