My apologies if you are running into this issue. In the short term, we landed one mitigation for this issue yesterday, and we have one more in flight that should start rolling out next week. We’ll also continue to monitor this, and won’t be happy until this issue is fully resolved, at least in the vast majority of cases.
If you still need to apply this workaround, please file an issue with relevant details so we can follow up. Also, please ensure at least one user and model turn remain in the history(see "Cannot read properties of undefined (reading 'role')" — triggered on every prompt, even with empty context. Seems like a middleware or handler bug with no fallback on missing role - #9 by Joshua_Litt, but TLDR this will be fixed on prod this week).