agent+acp: preserve session on retriable agent errors (#544)

This commit is contained in:
tlongwell-block
2026-05-12 13:57:02 -04:00
committed by GitHub
parent ef5fdca792
commit 385e1716b7
+6 -2
View File
@@ -1157,8 +1157,12 @@ pub async fn run_prompt_task(
}
Err(e) => {
tracing::error!(target: "pool::prompt", "session_prompt error: {e}");
// Invalidate only the affected session.
agent.state.invalidate(&source);
// AgentError means the agent caught a problem before mutating
// session state (e.g. bad LLM response). The session is healthy —
// don't invalidate it. Other errors may have corrupted state.
if !matches!(e, AcpError::AgentError(_)) {
agent.state.invalidate(&source);
}
let _ = result_tx.send(PromptResult {
agent,
source,