diff --git a/desktop/src-tauri/src/commands/global_agent_config_epoch_tests.rs b/desktop/src-tauri/src/commands/global_agent_config_epoch_tests.rs index 2e8365bfd..42dd8448a 100644 --- a/desktop/src-tauri/src/commands/global_agent_config_epoch_tests.rs +++ b/desktop/src-tauri/src/commands/global_agent_config_epoch_tests.rs @@ -24,6 +24,7 @@ use super::*; /// the captured definitions_dir so the spawn_fn can assert they arrive. #[tokio::test] async fn test_full_tail_stop_spawn_receipt_register_save() { + use crate::managed_agents::scope::SCOPE_GENERATION_TEST_LOCK; use crate::managed_agents::{ storage::save_managed_agents_at, BackendKind, ManagedAgentPairRuntime, ManagedAgentRecord, ManagedAgentRuntimeKey, @@ -31,6 +32,11 @@ async fn test_full_tail_stop_spawn_receipt_register_save() { use std::sync::{Arc, Mutex}; use tauri::Manager; + // Serialize generation-sensitive work across parallel tests. + let _gen_guard = SCOPE_GENERATION_TEST_LOCK + .lock() + .unwrap_or_else(|e| e.into_inner()); + let tmp = tempfile::tempdir().unwrap(); let pubkey = "bb".repeat(32); let relay_url = "wss://test.relay"; @@ -431,12 +437,18 @@ async fn test_full_tail_stop_spawn_receipt_register_save() { async fn test_relay_mesh_preflight_precedes_stop() { use super::super::restart_local_agent_on_config_change_for; use crate::commands::global_agent_config::RestartOutcome; + use crate::managed_agents::scope::SCOPE_GENERATION_TEST_LOCK; use crate::managed_agents::storage::save_managed_agents_at; use crate::managed_agents::{ BackendKind, ManagedAgentPairRuntime, ManagedAgentRecord, ManagedAgentRuntimeKey, }; use tauri::Manager; + // Serialize generation-sensitive work across parallel tests. + let _gen_guard = SCOPE_GENERATION_TEST_LOCK + .lock() + .unwrap_or_else(|e| e.into_inner()); + let tmp = tempfile::tempdir().unwrap(); let app = make_mock_app();