Assistant API cancelling a run wait until expired for several minutes

I add extra timeout check for those run cost more than 30 seconds, and …
Most of the time, it stuck in “cancelling” status , and expect it to be cancelled in several seconds.
But, most of the time the cancelling status is not changed and after several minutes(sometimes it’s more than 10) it became expierd.

Is there any problem with thread run cancel operation?
Or we cannot cancel a long long waiting run?

Thanks

4 Likes

I am having the same issue. Api status “canceling” is stuck for several minutes.

1 Like

I am having this same issue. API status “canceling” is stuck for several minutes. Plz anyone here for help us

I have the same problem with canceling runs

Have this problem too. Using assistant API i can not cancel thread run because it is already on status ‘cancelling’ and can not create new ‘run’ because of error “Can’t add messages to [thread_id] while a run [run_id] is active”. It happens sometimes. What should we do with this issue? @logankilpatrick @rohancalum Tech team please help us.

Same happens to me. I solved it by detecting the run is in cancelling status and creating a new thread and executing the pipe on this new thread.
And praise for that if it’s in cancelling status, someday it will be cancelled.
Idk if that’s a good approach but I haven’t found another way.

Also having a similar problem— every once in a while the run gets stuck in “cancelling” until it expires

Hello, were you able to find a solution for this?

I have the same issue, but now a run that’s stuck in “cancelling” expires after approximately 3 minutes.

I am wondering whether one can "force expire” a run using some API method.

Otherwise, I cannot add any other run to the same thread and have to wait (too long) until it expires automatically.

I also have trouble with runs ending up in cancelled state and as a consequence, I can no longer add messages to the thread.

See also this post: Handling Errors When Adding Messages to an Active Run in OpenAI

Having the same problem here as well. Cancelling a run out-of-band seems to sometimes result in that run getting stuck in a “cancelling” state until it eventually becomes “expired”. Until this happens, my users are blocked from adding additional messages.

Seeing this as well. Used to be occasional but seems very common now. Most times cancelling a run doesn’t work and ends up getting stuck and eventually timing out. Causing a lot of headaches for our users.

I encountered the same issue. One thing I observed is that the expires_at field in the run object contains a timestamp, which is ideally set to 10 minutes ahead of the current time. After this time, the run object transitions to an end state, at which point we are allowed to create a new run. My idea is to display a pop-up with relevant information, while in the background, an event listener checks the status of the run.