fix(orchestrator): la délégation simple vers UX renvoie son Final structuré (#207, QA verte)

Une demande idea_ask_agent vers UX échouait avec « finished without a structured Final response » alors qu'Architect répondait. Deux causes corrigées:

- session/process: un tour CLI terminé en code non nul SANS stdout (ex. erreur 401/auth) renvoyait une sortie vide au lieu du stderr réel; l'orchestrateur concluait alors à un « no Final ». On remonte désormais le stderr effectif (drain sync + async + helper process_exit_message + test dédié).

- orchestrator/service: la branche « ask waiting on background » masquait le premier Final structuré; la réponse synchrone redevient le premier Final (suppression de active_rendezvous_has_background_tasks / mark_rendezvous_task_waiting).

Nettoyage runtime corollaire (#204): arrêt du live runtime stale (PTY + structuré) d'un agent recréé afin que la délégation route vers l'agent courant (LiveSessions, stop_live_agent_runtime_in_project, wiring backend via DeleteAgent::with_runtime_cleanup, lifecycle, workstate cascade).
This commit is contained in:
2026-08-12 14:09:06 +02:00
parent ba176e3cf2
commit 646b9d9284
11 changed files with 673 additions and 203 deletions

View File

@ -73,15 +73,14 @@ pub enum AppError {
node_id: NodeId,
},
/// The delegation target finished its turn and **returned to its prompt without
/// calling `idea_reply`**, so the rendezvous could produce no answer. Surfaced
/// promptly (after a short grace window) instead of blocking the caller until the
/// long safety timeout. **Retryable**: the caller may re-ask, ideally reminding the
/// target to render its result via `idea_reply` (never plain text). Carries the
/// target's display name.
/// The delegation target finished its structured/headless turn without producing
/// a [`ReplyEvent::Final`](domain::ports::ReplyEvent::Final), so the rendezvous
/// could not capture an inline answer. Surfaced promptly instead of blocking the
/// caller until the long safety timeout. **Retryable**: the caller may re-ask for a
/// concise final response. Carries the target's display name.
#[error(
"agent {0} returned to its prompt without calling idea_reply (no answer was \
rendered); retry the request and ensure the agent replies via idea_reply"
"agent {0} finished without a structured Final response (no inline answer was \
captured); retry the request and ask for a concise final response"
)]
TargetReturnedNoReply(String),