fix(domain,application,infrastructure,backend,app-tauri,frontend): Stop demande agent préserve la conversation ouverte — arrêt sans fermeture/clôture du chat, états cohérents après cancel sur les 3 adapters de session, cellule et workstate synchronisés — #343 (QA verte)

This commit is contained in:
2026-09-13 10:03:36 +02:00
parent a1e8a6466f
commit c37638ff24
26 changed files with 1210 additions and 232 deletions

View File

@ -245,13 +245,12 @@ pub trait StopAgentExecutionCascade: Send + Sync {
) -> Result<(), AppError>;
}
/// Stops an already-running agent's current work.
/// Destructively stops an already-running agent runtime.
///
/// Resolves the session by agent (structured first, then PTY). A structured
/// session keeps its registry entry and receives `cancel_current_turn()`, so the
/// provider conversation/context survives the stop. A PTY session has no finer
/// turn boundary, so it is torn down through the existing [`CloseTerminal`]
/// primitive (registry removal + process kill).
/// Both structured and PTY runtimes are removed. Structured sessions first
/// receive `cancel_current_turn()` so a per-turn child cannot survive teardown,
/// then `shutdown()` is called. Conversation-level cancellation uses the
/// separate [`crate::CancelAgentChat`] use case and never enters this path.
pub struct StopAgentRuntime {
live: Arc<LiveSessions>,
close: Arc<CloseTerminal>,
@ -317,7 +316,7 @@ impl StopAgentRuntime {
self
}
/// Stops the agent's current work.
/// Stops the agent's complete live runtime.
///
/// # Errors
/// Repeated stops are successful. A cancellation or runtime failure is returned