feat(backend,frontend): lot utilisateur #310 #311 #312 #313 — horodatage conversation, stop agent robuste, préférence terminal par défaut, paramètres projet (QA verte)

- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate).
- #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline.
- #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux.
- #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet.

QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets.

fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 21:26:16 +02:00
parent fc45594d9a
commit 402a60f213
74 changed files with 2105 additions and 531 deletions

View File

@ -330,15 +330,17 @@ async fn stop_pty_kills_and_removes_session() {
.execute(StopLiveAgentInput {
project: project(),
agent_id: a,
reason: None,
})
.await
.unwrap();
assert_eq!(out.agent_id, a);
assert_eq!(out.session_id, sid(1));
assert_eq!(out.node_id, nid(100));
assert_eq!(out.kind, LiveSessionKind::Pty);
assert_eq!(out.runtime_state, LiveRuntimeState::Stopped);
assert!(!out.already_stopped);
assert_eq!(out.stopped[0].session_id, sid(1));
assert_eq!(out.stopped[0].node_id, nid(100));
assert_eq!(out.stopped[0].kind, LiveSessionKind::Pty);
assert_eq!(out.stopped[0].state, LiveRuntimeState::Stopped);
// Delegated to the close primitive: process killed and registry emptied.
assert_eq!(f.pty_port.kills(), vec![sid(1)]);
assert!(f.pty.is_empty(), "live session removed from the registry");
@ -346,7 +348,7 @@ async fn stop_pty_kills_and_removes_session() {
}
#[tokio::test]
async fn stop_structured_cancels_turn_and_keeps_session() {
async fn stop_structured_shuts_down_and_removes_session() {
let f = fixture();
let a = aid(10);
let (shutdown_called, cancel_called) = insert_structured(&f.structured, sid(2), a, nid(100));
@ -356,26 +358,24 @@ async fn stop_structured_cancels_turn_and_keeps_session() {
.execute(StopLiveAgentInput {
project: project(),
agent_id: a,
reason: None,
})
.await
.unwrap();
assert_eq!(out.session_id, sid(2));
assert_eq!(out.kind, LiveSessionKind::Structured);
assert_eq!(out.runtime_state, LiveRuntimeState::Stopped);
assert_eq!(out.stopped[0].session_id, sid(2));
assert_eq!(out.stopped[0].kind, LiveSessionKind::Structured);
assert_eq!(out.stopped[0].state, LiveRuntimeState::Stopped);
assert!(!cancel_called.load(Ordering::SeqCst));
assert!(
cancel_called.load(Ordering::SeqCst),
"session.cancel_current_turn() was called"
shutdown_called.load(Ordering::SeqCst),
"session.shutdown() must be called"
);
assert!(
!shutdown_called.load(Ordering::SeqCst),
"session.shutdown() must not be called"
);
assert!(!f.structured.is_empty(), "live session is preserved");
assert!(f.structured.is_empty(), "live session is removed");
assert_eq!(
f.structured
.session_id_for_agent_in_project(project().id, &a),
Some(sid(2))
None
);
// No PTY was touched.
assert!(f.pty_port.kills().is_empty());
@ -395,21 +395,46 @@ async fn stop_structured_runs_execution_cascade_best_effort() {
.execute(StopLiveAgentInput {
project: project(),
agent_id: a,
reason: None,
})
.await
.unwrap();
assert_eq!(out.session_id, sid(2));
assert_eq!(out.stopped[0].session_id, sid(2));
assert_eq!(*cascade.calls.lock().unwrap(), vec![(project().id, a)]);
assert!(
cancel_called.load(Ordering::SeqCst),
"session.cancel_current_turn() was called"
!cancel_called.load(Ordering::SeqCst),
"session.cancel_current_turn() is not the runtime stop primitive"
);
assert!(
!shutdown_called.load(Ordering::SeqCst),
"session.shutdown() must not be called"
shutdown_called.load(Ordering::SeqCst),
"session.shutdown() must be called"
);
assert!(!f.structured.is_empty(), "live session is preserved");
assert!(f.structured.is_empty(), "live session is removed");
}
#[tokio::test]
async fn stop_removes_every_runtime_for_the_agent_across_registries() {
let f = fixture();
let agent = aid(10);
insert_pty(&f.pty, sid(1), agent, nid(100));
let (shutdown_called, _) = insert_structured(&f.structured, sid(2), agent, nid(200));
let out = f
.stop
.execute(StopLiveAgentInput {
project: project(),
agent_id: agent,
reason: Some("user requested".to_owned()),
})
.await
.unwrap();
assert_eq!(out.stopped.len(), 2);
assert!(f.pty.is_empty());
assert!(f.structured.is_empty());
assert_eq!(f.pty_port.kills(), vec![sid(1)]);
assert!(shutdown_called.load(Ordering::SeqCst));
}
#[tokio::test]
@ -423,6 +448,7 @@ async fn stop_pty_is_idempotent_after_success() {
.execute(StopLiveAgentInput {
project: project(),
agent_id: a,
reason: None,
})
.await
.unwrap();
@ -431,31 +457,31 @@ async fn stop_pty_is_idempotent_after_success() {
.execute(StopLiveAgentInput {
project: project(),
agent_id: a,
reason: None,
})
.await
.unwrap();
assert_eq!(first, second);
assert_eq!(second.runtime_state, LiveRuntimeState::Stopped);
assert!(!first.already_stopped);
assert!(second.already_stopped);
assert!(second.stopped.is_empty());
assert_eq!(f.pty_port.kills(), vec![sid(1)], "kill is not repeated");
}
#[tokio::test]
async fn stop_unknown_agent_is_not_found() {
async fn stop_unknown_agent_is_idempotent_success() {
let f = fixture();
let err = f
let out = f
.stop
.execute(StopLiveAgentInput {
project: project(),
agent_id: aid(999),
reason: None,
})
.await
.expect_err("absent agent ⇒ NOT_FOUND");
assert!(
matches!(err, application::AppError::NotFound(_)),
"got {err:?}"
);
.expect("absent agent is an idempotent success");
assert!(out.already_stopped);
assert!(out.stopped.is_empty());
assert!(f.pty_port.kills().is_empty(), "nothing killed");
}