fix(application,backend,app-tauri): libère l'état busy après Final et draine la queue des messages agents — Final/Error terminent immédiatement le pump structuré via reply_event_ends_turn (le provider n'est pas tenu de fermer son itérateur), release busy/FIFO idempotente bornée au ticket observé (release_turn_accounting: cancel_head + mark_idle seulement si le ticket appartient toujours au tour), cleanup tardif Final/close/timeout/cancel sans libérer un tour successeur, factoring CancelAgentChat sur la même primitive, régression #357 préservée — #362 (QA verte: cargo fmt --check, chat_bridge 36 tests, cancel_agent_chat 4 tests, backend 106 tests, drain_with_readiness_lot1 7 tests)
This commit is contained in:
@ -390,6 +390,16 @@ pub fn chunk_from_event(event: ReplyEvent) -> Option<ReplyChunk> {
|
||||
chunk_from_event_at(event, None)
|
||||
}
|
||||
|
||||
/// Returns whether one provider event closes the concrete structured turn.
|
||||
///
|
||||
/// This is the control-plane boundary used by the `agent_send` pump. In
|
||||
/// particular, the provider is not required to close its iterator after a
|
||||
/// terminal event: keeping the iterator alive must not keep the agent Busy.
|
||||
#[must_use]
|
||||
pub fn reply_event_ends_turn(event: &ReplyEvent) -> bool {
|
||||
matches!(event, ReplyEvent::Final { .. } | ReplyEvent::Error { .. })
|
||||
}
|
||||
|
||||
/// Maps a domain reply event while preserving the backend acceptance time.
|
||||
#[must_use]
|
||||
pub fn chunk_from_event_at(event: ReplyEvent, at_ms: Option<u64>) -> Option<ReplyChunk> {
|
||||
|
||||
Reference in New Issue
Block a user