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
feat(browser): extract Drop impl into dedicated module
Steven Enamakel1081b8965cc6
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rsindex 287d12cece..b1f310704f 100644--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs@@ -1,6 +1,8 @@//! Agent-facing browser backed by the TinyComputer module's browser and task members.#[path = "browser_session_pool.rs"]mod session_pool;+#[path = "browser_drop.rs"]+mod browser_drop;use crate::modules::browser::BrowserClient;use crate::security::approval::{ApprovalGate, GateOutcome};@@ -731,26 +733,6 @@ 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;- });- }- }- }- }-}-#[cfg(test)]#[path = "browser_computer_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_drop.rs b/crates/openhuman-core/src/tools/impl/browser/browser_drop.rsnew file mode 100644index 0000000000..efadaa0f72--- /dev/null+++ b/crates/openhuman-core/src/tools/impl/browser/browser_drop.rs@@ -0,0 +1,21 @@+use super::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;+ });+ }+ }+ }+ }+}