fix(agent): don't eat /compact flag on failed turn; restore ctx fallback; requeue on SessionNotFound

This commit is contained in:
müde 2026-07-06 00:01:15 +02:00
commit b4f54a194b
4 changed files with 40 additions and 6 deletions

View file

@ -627,6 +627,13 @@ async fn handle_turn<S: Surface>(
tracing::warn!("prompt-too-long; session archived, requeueing message for a fresh turn");
S::requeue_inflight(socket).await;
}
if matches!(outcome, Err(turn::TurnError::SessionNotFound)) {
// "Shouldn't happen": resume missed and the lib's create self-heal
// didn't resolve it. Requeue rather than ack-and-drop so the wake
// message isn't silently lost; the next turn creates the session fresh.
tracing::warn!("session-not-found; requeueing message for a fresh turn");
S::requeue_inflight(socket).await;
}
if let Err(turn::TurnError::Failed(e)) = &outcome {
S::send_to_parent(socket, format_turn_failure(e)).await;
}