Skip to content

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

chore(web-chat): add temporary sender-count probes to trace progress channel

Steven Enamakel51a99becd06e
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 915acf7b8c..d714ecebd0 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -152,6 +152,7 @@ pub(crate) async fn run_chat_task(
input: Some(message.to_string()),
output: None,
});
+ let progress_probe = progress_tx.downgrade();
agent.set_on_progress(Some(progress_tx));
agent.set_run_queue(Some(run_queue));
agent.set_thread_id(Some(thread_id));
@@ -317,7 +318,9 @@ pub(crate) async fn run_chat_task(
.await;
}
+ 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());
// The caller publishes the terminal `chat_done`/`chat_error` as soon as
// this returns. Let the bridge forward everything the turn queued first,
@@ -398,6 +401,14 @@ pub(crate) async fn run_chat_task(
checkin_session_agent(thread_id, agent, current_fp).await;
}
}
+ log::debug!("[web-channel] DEBUGSENDERS after-checkin={}", progress_probe.strong_count());
+ {
+ let probe = progress_probe.clone();
+ tokio::spawn(async move {
+ tokio::time::sleep(std::time::Duration::from_secs(5)).await;
+ log::debug!("[web-channel] DEBUGSENDERS after-5s={}", probe.strong_count());
+ });
+ }
result
}
diff --git a/tests/saas_isolation/storm.rs b/tests/saas_isolation/storm.rs
index a3efeb100c..c0ee4d8e21 100644
--- a/tests/saas_isolation/storm.rs
+++ b/tests/saas_isolation/storm.rs
@@ -160,6 +160,6 @@ fn zz_experiment_pin_after_turn() {
let paths: Vec<String> = llm.recorded().iter().skip(before).map(|r| r.path.clone()).collect();
eprintln!("backend paths: {paths:?}");
let log = std::fs::read_to_string(&node.log).unwrap_or_default();
- let pins: Vec<&str> = log.lines().filter(|l| l.contains("bridge] spawned") || l.contains("DEBUGBRIDGE") || l.contains("did not drain")).collect();
+ let pins: Vec<&str> = log.lines().filter(|l| l.contains("DEBUGSENDERS") || l.contains("DEBUGBRIDGE") || l.contains("did not drain")).collect();
eprintln!("PINS {}", pins[pins.len().saturating_sub(5)..].join("\n"));
}