fix(runtime): isolate agent state by project (#101)

This commit is contained in:
2026-07-25 22:14:02 +02:00
parent 6a87c4635f
commit 6e98fd89f7
52 changed files with 1894 additions and 805 deletions

View File

@ -1146,7 +1146,8 @@ async fn stop_agent_call_closes_the_live_session() {
let (service, sessions) = build_service(contexts);
// Pre-bind a live PTY session for the agent so StopAgent has something to close.
let session_id = SessionId::from_uuid(Uuid::from_u128(555));
sessions.insert(
sessions.insert_in_project(
project().id,
PtyHandle { session_id },
TerminalSession::starting(
session_id,
@ -1156,7 +1157,9 @@ async fn stop_agent_call_closes_the_live_session() {
PtySize { rows: 24, cols: 80 },
),
);
assert!(sessions.session_for_agent(&agent_id).is_some());
assert!(sessions
.session_for_agent_in_project(project().id, &agent_id)
.is_some());
let server = server(service);
let raw = tools_call(1, "idea_stop_agent", json!({ "target": "dev" }));
@ -1166,7 +1169,9 @@ async fn stop_agent_call_closes_the_live_session() {
// CloseTerminal ran → the agent no longer has a live session.
assert!(
sessions.session_for_agent(&agent_id).is_none(),
sessions
.session_for_agent_in_project(project().id, &agent_id)
.is_none(),
"stop_agent should have removed the session"
);
}