Detecting and Managing Bad Runs

While doing some testing, I came into a situation where my Assistant would “hang” and become unresponsive. Inspecting the Thread, I determined that a previous test left an incomplete Run on the thread (a failed tool call).

Once a bad Run like this is part of the thread, you can’t add any new messages. Some questions:

  1. What’s the intended workflow for dealing with this? Whenever the app is refreshed, get a list of Runs on the Thread, and cancel any that have a status equal to queued, in_progress, or requires_action?

  2. Is there a reason “orphaned” Runs can exist?

  3. Is there a case in which multiple Runs should have the above statuses on the same Thread at the same time?