Skip to content

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

chore(openhuman-rpc): remove flaky ignored test and reorder dependency

Steven Enamakelacf2d849a92f
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.toml
index 9cbc978f6e..68a3c2133e 100644
--- a/crates/openhuman-cli/Cargo.toml
+++ b/crates/openhuman-cli/Cargo.toml
@@ -426,8 +426,8 @@ tinymemory-api = { path = "../../vendor/tinymemory/crates/tinymemory-api" }
tinytools-agent = { path = "../../vendor/tinyagents/vendor/tinytools/crates/tinytools-agent" }
tokio = { version = "1", features = ["full", "test-util"] }
tokio-stream = { version = "0.1.18", default-features = false, features = ["sync"] }
-tokio-util = { version = "0.7", features = ["rt", "io"] }
tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "handshake", "rustls-tls-webpki-roots"] }
+tokio-util = { version = "0.7", features = ["rt", "io"] }
tower = { version = "0.5", default-features = false }
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
url = "2"
diff --git a/crates/openhuman-rpc/src/server/shims_tests.rs b/crates/openhuman-rpc/src/server/shims_tests.rs
index 00a6e14dda..0f7788f3c7 100644
--- a/crates/openhuman-rpc/src/server/shims_tests.rs
+++ b/crates/openhuman-rpc/src/server/shims_tests.rs
@@ -73,107 +73,3 @@ fn server_shim_refuses_public_bind_without_operator_token() {
.join()
.expect("test thread should not panic");
}
-
-async fn wait_until_port_accepts(port: u16) {
- let deadline = tokio::time::Instant::now() + Duration::from_secs(2);
- loop {
- if tokio::net::TcpStream::connect(("127.0.0.1", port))
- .await
- .is_ok()
- {
- return;
- }
- assert!(
- tokio::time::Instant::now() < deadline,
- "server did not start accepting on port {port}"
- );
- tokio::time::sleep(Duration::from_millis(25)).await;
- }
-}
-
-async fn wait_until_port_released(port: u16) {
- let deadline = tokio::time::Instant::now() + Duration::from_secs(2);
- loop {
- if tokio::net::TcpStream::connect(("127.0.0.1", port))
- .await
- .is_err()
- {
- return;
- }
- assert!(
- tokio::time::Instant::now() < deadline,
- "server did not release port {port}"
- );
- tokio::time::sleep(Duration::from_millis(25)).await;
- }
-}
-
-/// Regression test for issue #920 — the embedded server's `axum::serve`
-/// accept loop must stop within the cancellation timeout when its
-/// `CancellationToken` is fired.
-///
-/// **Ignored by default.** This test calls `run_server_embedded`,
-/// which triggers the full production bootstrap (`bootstrap_core_runtime`
-/// → `register_domain_subscribers` → `scheduler_gate::init_global` +
-/// `memory::tree::jobs::start` + `composio::start_periodic_sync` +
-/// cron scheduler). Those code paths spawn detached `tokio::spawn`
-/// background tasks and write to several process-global statics
-/// (`STATE: OnceLock`, `SIGNED_OUT: AtomicBool`, `LLM_PERMITS`
-/// semaphore, `GLOBAL_REGISTRY` agent.run_turn handler, `STARTED`
-/// `std::sync::Once`s, …) — *none of which have teardown semantics*.
-/// In a unit-test binary the leaked tasks then race with every other
-/// test, multiplying CI wall time by 10–20× (PR #1552 thread). The
-/// right shape for this regression is an integration test in a
-/// dedicated `tests/` binary where global pollution doesn't affect
-/// siblings — tracked as a follow-up.
-///
-/// To run manually: `cargo test --lib -p openhuman-rpc -- --ignored
-/// shutdown_token`.
-#[tokio::test]
-#[ignore = "calls full server bootstrap; leaks process-global state into sibling tests (#1552). Re-cover via integration test."]
-async fn shutdown_token_stops_axum_listener_within_timeout() {
- // Ignored and run on its own, so a plain write needs no restore guard.
- openhuman_core::cron::scheduler_gate::set_signed_out(false);
-
- let workspace = tempfile::tempdir().expect("workspace tempdir");
-
- // Pin scheduler-gate policy to Aggressive while this test runs so
- // the bootstrap's `init_global` snapshot can't capture transient
- // CPU pressure and freeze the cached policy at Paused.
- std::fs::write(
- workspace.path().join("config.toml"),
- "[scheduler_gate]\nmode = \"always_on\"\n",
- )
- .expect("seed scheduler_gate=always_on config.toml");
- let _env = EnvVarGuard::set_many(vec![
- (
- "OPENHUMAN_WORKSPACE",
- workspace.path().as_os_str().to_os_string(),
- ),
- ("OPENHUMAN_DISABLE_CHANNEL_LISTENERS", OsString::from("1")),
- (
- "OPENHUMAN_CORE_TOKEN",
- OsString::from("test-token-shutdown"),
- ),
- ]);
-
- let probe = std::net::TcpListener::bind("127.0.0.1:0").expect("allocate test port");
- let port = probe.local_addr().expect("local addr").port();
- drop(probe);
-
- let shutdown_token = CancellationToken::new();
- let server_token = shutdown_token.clone();
- let server = tokio::spawn(async move {
- super::run_server_embedded(Some("127.0.0.1"), Some(port), false, server_token).await
- });
-
- wait_until_port_accepts(port).await;
- shutdown_token.cancel();
-
- let result = tokio::time::timeout(Duration::from_secs(2), server)
- .await
- .expect("embedded server task should stop within timeout")
- .expect("embedded server task should not panic");
- result.expect("embedded server should shut down cleanly");
- wait_until_port_released(port).await;
-}