Invalidate thread skills when replacing environments

This commit is contained in:
jif-oai
2026-07-09 13:20:43 +01:00
parent a2a0e0978b
commit d87cfda0ac
3 changed files with 52 additions and 11 deletions
+8 -5
View File
@@ -298,13 +298,14 @@ impl EnvironmentManager {
/// Adds or replaces a named remote environment without changing the
/// manager's default environment selection. Uses the default WebSocket
/// connection timeout when none is provided.
/// connection timeout when none is provided. Returns whether an existing
/// environment was replaced.
pub fn upsert_environment(
&self,
environment_id: String,
exec_server_url: String,
connect_timeout: Option<std::time::Duration>,
) -> Result<(), ExecServerError> {
) -> Result<bool, ExecServerError> {
if environment_id.is_empty() {
return Err(ExecServerError::Protocol(
"environment id cannot be empty".to_string(),
@@ -329,11 +330,13 @@ impl EnvironmentManager {
self.local_runtime_paths.clone(),
));
environment.start_connecting();
self.environments
let replaced = self
.environments
.write()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.insert(environment_id, environment);
Ok(())
.insert(environment_id, environment)
.is_some();
Ok(replaced)
}
/// Adds or replaces a named remote environment that connects through an