Skip to content

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

chore(web_chat): replace DEBUG_NOCACHE with DEBUG_CLEAR session reset

Steven Enamakeleef8f070902a
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
index 6c2a9e6363..e040cd42be 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
@@ -528,6 +528,10 @@ impl OpenHumanSessionHost {
));
}
+ pub fn debug_drop_runtime_session_only(&mut self) {
+ self.runtime_session = None;
+ }
+
/// Clears the agent's conversation history.
pub fn clear_history(&mut self) {
// Runtime `Session` owns the only generic history and has no mutable
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 1082c0f946..a80b82b2f7 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -321,6 +321,12 @@ pub(crate) async fn run_chat_task(
log::debug!("[web-channel] DEBUGSENDERS before-clear={}", progress_probe.strong_count());
agent.set_on_progress(None);
log::debug!("[web-channel] DEBUGSENDERS after-clear={}", progress_probe.strong_count());
+ if std::env::var("DEBUG_CLEAR").is_ok() {
+ agent.debug_drop_runtime_session_only();
+ log::debug!("[web-channel] DEBUGSENDERS after-drop-runtime-session={}", progress_probe.strong_count());
+ agent.clear_history();
+ log::debug!("[web-channel] DEBUGSENDERS after-clear-history={}", progress_probe.strong_count());
+ }
// The caller publishes the terminal `chat_done`/`chat_error` as soon as
// this returns. Let the bridge forward everything the turn queued first,
@@ -397,8 +403,6 @@ pub(crate) async fn run_chat_task(
thread_id,
request_id
);
- } else if std::env::var("DEBUG_NOCACHE").is_ok() {
- drop(agent);
} else {
checkin_session_agent(thread_id, agent, current_fp).await;
}
diff --git a/tests/saas_mode/support.rs b/tests/saas_mode/support.rs
index 8c0bd168cb..0904a8a38f 100644
--- a/tests/saas_mode/support.rs
+++ b/tests/saas_mode/support.rs
@@ -409,7 +409,7 @@ pub fn start_node_logging(
.env("HOME", d.tmp.path())
.env("USERPROFILE", d.tmp.path())
.env("RUST_LOG", rust_log)
- .env("DEBUG_NOCACHE", "1")
+ .env("DEBUG_CLEAR", "1")
.stdout(std::fs::File::create(&log).unwrap())
.stderr(Stdio::null());
for var in SCRUBBED_ENV {