Fix stale thread-name resume lookups (#16646)

Addresses #15943

Problem: Name-based resume could stop on a newer session_index entry
whose rollout was never persisted, shadowing an older saved thread with
the same name.

Solution: Materialize rollouts before indexing thread names and make
name lookup skip unresolved entries until it finds a persisted rollout.
This commit is contained in:
Eric Traut authored and GitHub committed 2026-04-08 18:51:29 -07:00
1 parent 4dca906e19
commit 36586eafed
7 files changed
+256 -48

No files matched your search

+7 -5
View File
@@ -94,7 +94,7 @@ pub enum RolloutRecorderParams {
enum RolloutCmd {
AddItems(Vec<RolloutItem>),
Persist {
ack: oneshot::Sender<()>,
ack: oneshot::Sender<std::io::Result<()>>,
},
/// Ensure all prior writes are processed; respond when flushed.
Flush {
@@ -514,7 +514,7 @@ impl RolloutRecorder {
.await
.map_err(|e| IoError::other(format!("failed to queue rollout persist: {e}")))?;
rx.await
.map_err(|e| IoError::other(format!("failed waiting for rollout persist: {e}")))
.map_err(|e| IoError::other(format!("failed waiting for rollout persist: {e}")))?
}
/// Flush all queued writes and wait until they are committed by the writer task.
@@ -810,11 +810,13 @@ async fn rollout_writer(
.await;
if let Err(err) = result {
let _ = ack.send(());
return Err(err);
let kind = err.kind();
let message = err.to_string();
let _ = ack.send(Err(IoError::new(kind, message.clone())));
return Err(IoError::new(kind, message));
}
}
let _ = ack.send(());
let _ = ack.send(Ok(()));
}
RolloutCmd::Flush { ack } => {
// Deferred fresh threads may not have an initialized file yet.