Retry TUI reconnects while threads are closing (#42207)

## Why

An app-server thread can still be closing when the TUI reconnects. Its
`thread/resume` request then uses the same `-32600` error code as an unavailable
thread, even though the thread can be resumed once closing finishes.

## What changed

Treat the thread-specific "is closing" response as a transient reconnect error
so the existing reconnect loop retries instead of marking the conversation
unavailable.

## Testing

Extend the active reconnect and end-to-end reconnect tests to cover a closing
thread that resumes successfully on the next attempt.

GitOrigin-RevId: 30ce232b8894065fef346a86128b3ff9bf36ba1f
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-02 05:10:55 +00:00
1 parent 8813bd4b00
commit 27bf160f79
3 files changed
+51 -5

No files matched your search

+12
View File
@@ -83,6 +83,18 @@ pub(super) async fn reconnect(
{
return Err(error);
}
// Unloading threads use the same code as unavailable conversations, but
// ordinary resume can reattach once the unload finishes.
Err(error)
if matches!(
error.downcast_ref::<TypedRequestError>(),
Some(TypedRequestError::Server { method, source })
if method == "thread/resume" && source.code == -32600
&& source.message.starts_with(&format!("thread {thread_id} is closing;"))
) =>
{
return Err(error);
}
Err(error)
if matches!(
error.downcast_ref::<TypedRequestError>(),