Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(browser): retain upstream drop module

Steven Enamakelb2844b4df76b
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_drop.rs b/crates/openhuman-core/src/tools/impl/browser/browser_drop.rs
new file mode 100644
index 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;
+ });
+ }
+ }
+ }
+ }
+}