fix(ticket-assistant): rendre visible l'échec « aucune réponse » de l'assistant de ticket (#60)

Introduit un variant terminal `ReplyEvent::Error { message }` (domain/ports)
propagé jusqu'au chat : l'adapter OpenAI-compat récupère `reasoning_content`
quand `content` est vide, et un `Final` vide est converti en `Error` visible
plutôt qu'un tour silencieux qui pend. Le front (`ReplyChunk` + useTicketAssistant)
rend ce message d'erreur dans la cellule.

- domain: variant `ReplyEvent::Error`, bras non terminal (readiness, structured drain)
- infra/session: parse `reasoning_content` (delta/completion), fallback visible
- app-tauri: mapping ReplyEvent::Error -> ReplyChunk::Error, Final vide -> Error
- frontend: ReplyChunk `error`, rendu dans useTicketAssistant (+ test .test.tsx)

NB: commit sur la feature branch, PAS un merge. #60 reste inProgress.
Les 10 tests `cargo test -p infrastructure --lib session` échouent SOUS SANDBOX
uniquement (bind loopback 127.0.0.1:0 interdit -> Os PermissionDenied), pas une
régression : revérification hors-sandbox requise avant tout merge vers develop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 08:32:59 +02:00
parent ce5aa2811c
commit 2f7f111545
14 changed files with 571 additions and 25 deletions

View File

@ -1745,10 +1745,11 @@ impl From<TerminalSession> for TerminalSessionDto {
/// twin of a [`domain::ports::ReplyEvent`]: the `agent_send` pump maps each turn
/// event to one of these and pushes it to the frontend `AgentChatView`.
///
/// Tagged on `kind` (camelCase: `"textDelta"` | `"toolActivity"` | `"final"`), so
/// the front branches without positional parsing. `Final` is the **deterministic
/// terminal** chunk of a turn — after it the turn is frozen and the stream ends.
/// `Deserialize` is derived too so tests (and a mock gateway) can round-trip it.
/// Tagged on `kind` (camelCase: `"textDelta"` | `"toolActivity"` | `"final"` |
/// `"error"`), so the front branches without positional parsing. `Final` is the
/// normal deterministic terminal chunk of a turn; `Error` is a visible terminal
/// fallback for an otherwise silent/empty turn. `Deserialize` is derived too so
/// tests (and a mock gateway) can round-trip it.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "camelCase")]
pub enum ReplyChunk {
@ -1770,6 +1771,12 @@ pub enum ReplyChunk {
/// The aggregated final content of the turn.
content: String,
},
/// A visible terminal fallback when the model stream produced no usable answer.
#[serde(rename_all = "camelCase")]
Error {
/// Human-readable explanation to render in the chat cell.
message: String,
},
}
/// Response DTO for `reattach_agent_chat`: the retained **conversation