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
refactor(browser): extract Drop implementation into a separate module
Steven Enamakelf557ad03c19a
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rsindex 287d12cece..dfac58ba48 100644--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs@@ -731,25 +731,8 @@ impl Tool for BrowserTool {}}-impl Drop for BrowserTool {- fn drop(&mut self) {- if self.thread_key.lock().ok().is_some_and(|key| key.is_some()) {- // A later turn in this conversation reuses the module session.- // Explicit `close` removes it; module shutdown owns final cleanup.- return;- }- if let Ok(mut held) = self.session.try_lock() {- if let Some(id) = held.take() {- let client = self.client.clone();- if let Ok(runtime) = tokio::runtime::Handle::try_current() {- runtime.spawn(async move {- let _ = client.close_session(&id).await;- });- }- }- }- }-}+#[path = "browser_lifecycle.rs"]+mod lifecycle;#[cfg(test)]#[path = "browser_computer_tests.rs"]diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_lifecycle.rs b/crates/openhuman-core/src/tools/impl/browser/browser_lifecycle.rsnew file mode 100644index 0000000000..53ac03e97b--- /dev/null+++ b/crates/openhuman-core/src/tools/impl/browser/browser_lifecycle.rs@@ -0,0 +1,21 @@+use super::*;++impl Drop for BrowserTool {+ fn drop(&mut self) {+ if self.thread_key.lock().ok().is_some_and(|key| key.is_some()) {+ // A later turn in this conversation reuses the module session.+ // Explicit `close` removes it; module shutdown owns final cleanup.+ return;+ }+ if let Ok(mut held) = self.session.try_lock() {+ if let Some(id) = held.take() {+ let client = self.client.clone();+ if let Ok(runtime) = tokio::runtime::Handle::try_current() {+ runtime.spawn(async move {+ let _ = client.close_session(&id).await;+ });+ }+ }+ }+ }+}diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.jsonindex e8d3d41df6..3bb73a33c8 100644--- a/scripts/ci/agent-runtime-boundary-baseline.json+++ b/scripts/ci/agent-runtime-boundary-baseline.json@@ -1077,13 +1077,6 @@"text": "pub use tinyagents_graph::orchestration::OrchestrationTaskStatus;","occurrence": 1},- {- "rule": "openhuman-upstream-reexport",- "path": "crates/openhuman-core/src/agent/subagent_host/handoff.rs",- "line": 37,- "text": "pub(crate) use tinyagents_harness::handoff::{",- "occurrence": 1- },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/todos/ops.rs",