The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(channels): keep logout lifetime regression in channel domain
Eloi Torrents89f56b6bb126
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.ymlindex c6735d7992..5e30e33cfa 100644--- a/.github/workflows/ci-lite.yml+++ b/.github/workflows/ci-lite.yml@@ -570,11 +570,6 @@ jobs:bash scripts/ci-cancel-aware.sh cargo test --manifest-path Cargo.toml \-p openhuman --no-default-features --lib -- \core::all:: core::cli:: core::jsonrpc:: core::legacy_aliases:: core::runtime:: agent::registry::agents::loader:: memory::people::contacts_gate_tests:: openhuman::config:: openhuman::platform::socket::event_handlers:: tools::schemas:: tools::ops::tests::- # Logout mutates process-wide session state; isolate this module- # from the other gate-contract tests and run its cases serially.- bash scripts/ci-cancel-aware.sh cargo test --manifest-path Cargo.toml \- -p openhuman --no-default-features --lib \- security::credentials::ops::tests::provider_oauth_tests:: -- --test-threads=1bash scripts/ci-cancel-aware.sh cargo test --manifest-path Cargo.toml \-p openhuman --no-default-features --features mcp --lib -- \mcp::server::resources::@@ -696,7 +691,6 @@ jobs:mcp/server/tools/mod.rsplatform/socket/event_handlers.rsplatform/socket/ops.rs- security/credentials/ops_provider_oauth_tests.rsskills/bundled/mod.rsskills/mod.rsskills/search.rsdiff --git a/crates/openhuman-core/src/channels/runtime/session_tests.rs b/crates/openhuman-core/src/channels/runtime/session_tests.rsindex e793c882f0..fe3fa7439b 100644--- a/crates/openhuman-core/src/channels/runtime/session_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/session_tests.rs@@ -58,3 +58,45 @@ async fn logout_drops_the_old_runtime_and_aborts_owned_workers() {dropped_rx.await.unwrap();assert!(!touched_after_logout.load(Ordering::SeqCst));}++#[tokio::test]+async fn clear_session_invalidates_old_channels_and_opens_a_fresh_generation() {+ // Logout resolves the signed-out workspace through HOME. Keep the real+ // user profile untouched and restore the process environment on panic too.+ let _env_guard = crate::config::TEST_ENV_LOCK+ .lock()+ .unwrap_or_else(|e| e.into_inner());+ struct RestoreHome(Option<std::ffi::OsString>);+ impl Drop for RestoreHome {+ fn drop(&mut self) {+ unsafe {+ match self.0.take() {+ Some(value) => std::env::set_var("HOME", value),+ None => std::env::remove_var("HOME"),+ }+ }+ }+ }+ let tmp = tempfile::TempDir::new().unwrap();+ let _home = RestoreHome(std::env::var_os("HOME"));+ unsafe { std::env::set_var("HOME", tmp.path()) };+ let config = crate::config::Config {+ workspace_dir: tmp.path().join("workspace"),+ action_dir: tmp.path().join("workspace"),+ config_path: tmp.path().join("config.toml"),+ ..Default::default()+ };+ crate::memory::binding::install_diagnostics_for_test(+ &config.workspace_dir,+ &config.subsystems.memory,+ Default::default(),+ Default::default(),+ );+ let _signed_out = crate::cron::scheduler_gate::SignedOutTestGuard::set(false);+ let old_session = channel_session();+ crate::security::credentials::ops::clear_session(&config)+ .await+ .unwrap();+ assert!(old_session.is_cancelled());+ assert!(!channel_session().is_cancelled());+}diff --git a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rsindex b8956fe828..bb9547f9e5 100644--- a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs+++ b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs@@ -32,14 +32,7 @@ async fn clear_session_on_empty_store_reports_removed_false() {let tmp = TempDir::new().unwrap();let _home = EnvVarGuard::set_to_path("HOME", tmp.path());let config = test_config(&tmp);- #[cfg(feature = "channels")]- let old_channel_session = crate::channels::session::channel_session();let result = clear_session(&config).await.unwrap();- #[cfg(feature = "channels")]- {- assert!(old_channel_session.is_cancelled());- assert!(!crate::channels::session::channel_session().is_cancelled());- }assert_eq!(result.value["removed"], false);}