Skip to content

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

chore: remove unused imports across core modules

Steven Enamakelc991a2a5812f
diff --git a/crates/openhuman-core/src/agent/artifacts/store_documents.rs b/crates/openhuman-core/src/agent/artifacts/store_documents.rs
index 6a72535857..09b3f260ac 100644
--- a/crates/openhuman-core/src/agent/artifacts/store_documents.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store_documents.rs
@@ -267,7 +267,7 @@ pub(super) async fn on_docs<T: Send + 'static>(
docs: Docs,
f: impl FnOnce(Docs) -> anyhow::Result<T> + Send + 'static,
) -> Result<T, String> {
- crate::core::runtime::spawn_blocking_scoped(move || f(docs))
+ crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || f(docs))
.await
.map_err(|e| format!("[artifacts] storage task failed: {e}"))?
.map_err(|e| format!("[artifacts] storage: {e:#}"))
diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
index 573149f55b..54ea31fa34 100644
--- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
+++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
@@ -189,7 +189,7 @@ pub async fn start_member_run(
// worker keeps the label the approval gate needs. Inherit-only: no origin
// in scope means the worker stays unlabelled and fails closed as before.
let inherited_origin = crate::agent::turn_origin::capture();
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
crate::agent::turn_origin::with_inherited_origin(
inherited_origin,
run_member_loop(
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index a0be94f1af..e17dcaf4f9 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -273,7 +273,7 @@ fn schedule_delivery_inner(
.push((thread_id.clone(), delay));
// Scoped: the thread -> workspace table is keyed per profile, so the
// delayed task must run under the profile that scheduled it.
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
let turn_fence = fence.clone();
let turn_thread = thread_id.clone();
let outcome = run_drain(
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
index a133d85552..29c0314445 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
@@ -393,7 +393,7 @@ impl SpawnAsyncSubagentTool {
// the off-task delivery subscriber resolves.
let detached_run_context = detached_parent.data.child();
let mut abort_report = AbortReport::arm(progress_sink.clone(), &definition.id, &task_id);
- let join = crate::core::runtime::spawn_scoped(crate::agent::turn_origin::propagate(
+ let join = crate::core::runtime::DispatchCtx::ambient().spawn(crate::agent::turn_origin::propagate(
async move {
let options = SubagentRunOptions {
skill_filter_override: None,
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
index f1b1ae881a..b686bfad6b 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
@@ -70,7 +70,7 @@ pub async fn start_workflow_run(
// Inherit-only: `None` leaves the loop unlabelled and failing closed.
let inherited_origin = crate::agent::turn_origin::capture();
let task_ctx = ctx.clone();
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
match crate::config::ops::load_current_or_init(&task_ctx).await {
Ok(task_config) => {
crate::agent::turn_origin::with_inherited_origin(
@@ -221,7 +221,7 @@ pub async fn resume_workflow_run(
// loop runs on a fresh task, which would otherwise drop the caller's label.
let inherited_origin = crate::agent::turn_origin::capture();
let task_ctx = ctx.clone();
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
match crate::config::ops::load_current_or_init(&task_ctx).await {
Ok(task_config) => {
crate::agent::turn_origin::with_inherited_origin(
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
index 4ea28ff3aa..26dc263d04 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs
@@ -234,7 +234,7 @@ impl OpenHumanTurnPrelude {
)
.await;
};
- crate::core::runtime::spawn_scoped(deferred_memory_work(profile_context, work));
+ crate::core::runtime::DispatchCtx::ambient().spawn(deferred_memory_work(profile_context, work));
}
}
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
index f7c1dac202..21ab8642f1 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
@@ -75,7 +75,7 @@ where
elapsed_ms = elapsed_ms(started),
"[session-runtime] post-commit: turn completion published"
);
- let handle = crate::core::runtime::spawn_scoped(async move {
+ let handle = crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let started = Instant::now();
tail.await;
tracing::debug!(
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rs
index be4b4f9259..115ace0656 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs
@@ -77,7 +77,7 @@ pub async fn channel_relay_inbound(
chars = params.text.chars().count(),
"[channels::relay] relayed message accepted"
);
- crate::core::runtime::spawn_scoped(run_relay_turn(
+ ctx.spawn(run_relay_turn(
ctx.clone(),
config,
params,
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
index a74007623f..1ded4ba5f5 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
@@ -24,7 +24,7 @@ pub(super) fn spawn_scoped_typing_task(
let (finished_tx, finished_rx) = tokio::sync::oneshot::channel();
// The worker retains ownership across cancellation of the caller while
// StartTypingRefresh is in flight, then closes the returned module handle.
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
match channel
.begin_typing_refresh(&recipient, CHANNEL_TYPING_REFRESH_INTERVAL_SECS)
.await
@@ -43,7 +43,7 @@ pub(super) fn spawn_scoped_typing_task(
}
let _ = finished_tx.send(());
});
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
let _ = finished_rx.await;
})
}
diff --git a/crates/openhuman-core/src/channels/runtime/session.rs b/crates/openhuman-core/src/channels/runtime/session.rs
index 5ef6984578..289b2fb442 100644
--- a/crates/openhuman-core/src/channels/runtime/session.rs
+++ b/crates/openhuman-core/src/channels/runtime/session.rs
@@ -109,7 +109,7 @@ where
F: FnMut(CancellationToken) -> Fut + Send + 'static,
Fut: Future<Output = anyhow::Result<()>> + Send + 'static,
{
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
// A logout can race the service task's first poll. Do not let a
// service created during that window start with the replacement
// token before a credential has been installed again.
diff --git a/crates/openhuman-core/src/desktop/notifications/rpc.rs b/crates/openhuman-core/src/desktop/notifications/rpc.rs
index 8a310f6fed..bd8dcb2d9e 100644
--- a/crates/openhuman-core/src/desktop/notifications/rpc.rs
+++ b/crates/openhuman-core/src/desktop/notifications/rpc.rs
@@ -90,7 +90,7 @@ pub async fn handle_ingest(ctx: &DispatchCtx, params: Map<String, Value>) -> Res
let id_for_triage = id.clone();
let config_for_triage = config.clone();
let ctx = ctx.clone();
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
let envelope = TriggerEnvelope {
source: TriggerSource::WebviewIntegration {
provider: req.provider.clone(),
diff --git a/crates/openhuman-core/src/flows/bus/trigger.rs b/crates/openhuman-core/src/flows/bus/trigger.rs
index 66e14071ac..bacc3c701b 100644
--- a/crates/openhuman-core/src/flows/bus/trigger.rs
+++ b/crates/openhuman-core/src/flows/bus/trigger.rs
@@ -232,7 +232,7 @@ impl FlowTriggerSubscriber {
let config = self.config_for_scope(ctx);
// Scoped: the run keeps the owner's context the handler entered.
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
// Held for the lifetime of the run; released on drop (including
// on panic) by `InFlightGuard`.
let _guard = guard;
diff --git a/crates/openhuman-core/src/integrations/composio/ops/connections.rs b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
index 617826bee8..492b074076 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/connections.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
@@ -97,7 +97,7 @@ pub async fn composio_list_connections(
// connection-created subscriber's readiness window. Re-warm here so
// the next chat turn does not perform the three discovery requests.
let config = config.clone();
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let _ = fetch_connected_integrations_status(&config).await;
});
}
diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history.rs b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
index a3e7c1123e..03b4a888b7 100644
--- a/crates/openhuman-core/src/integrations/composio/trigger_history.rs
+++ b/crates/openhuman-core/src/integrations/composio/trigger_history.rs
@@ -87,7 +87,7 @@ impl TriggerHistory {
let client = self.client(&config);
// Keep ownership installation running if the caller is cancelled while
// OpenArchive completes. A later close can still release the handle.
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
let mut guard = lease.lock_owned().await;
Self::ensure_lease(&config, &mut guard, client).await?;
Ok(guard)
@@ -157,7 +157,7 @@ impl TriggerHistory {
/// Release the module resource while retaining all persisted documents.
pub async fn close(&self) -> Result<(), String> {
let lease = Arc::clone(&self.lease);
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
Self::release(&mut *lease.lock_owned().await).await
})
.await
diff --git a/crates/openhuman-core/src/integrations/task_sources/bus.rs b/crates/openhuman-core/src/integrations/task_sources/bus.rs
index 813f22d938..ca6c453989 100644
--- a/crates/openhuman-core/src/integrations/task_sources/bus.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/bus.rs
@@ -126,7 +126,7 @@ async fn fire_for_connection(
let config = config.clone();
let ctx = ctx.clone();
// Scoped: the fetch keeps the scope's agent context.
- crate::core::runtime::spawn_scoped(async move {
+ ctx.spawn(async move {
let _ = pipeline::run_source_once(&ctx, &config, &source, FetchReason::ConnectionCreated)
.await;
});
diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
index 9a9c8944bd..89df1b8f6e 100644
--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
@@ -81,7 +81,7 @@ pub fn start_periodic_poll() {
tracing::debug!("[task_sources:periodic] scheduler already running, skipping start");
return;
}
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
tracing::info!(
tick_seconds = TICK_SECONDS,
"[task_sources:periodic] scheduler starting"
diff --git a/crates/openhuman-core/src/mcp/server/module.rs b/crates/openhuman-core/src/mcp/server/module.rs
index 4e8843bf60..18faa5a940 100644
--- a/crates/openhuman-core/src/mcp/server/module.rs
+++ b/crates/openhuman-core/src/mcp/server/module.rs
@@ -411,7 +411,7 @@ impl ServerSession {
{
*pending = Some(PendingCallback::Running {
id: callback_id.clone(),
- task: crate::core::runtime::spawn_scoped((self.callback_dispatch)(call)),
+ task: crate::core::runtime::DispatchCtx::ambient().spawn((self.callback_dispatch)(call)),
});
}
let result = match pending.as_mut() {
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index 8fabeb9272..a1136ff1b8 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -350,7 +350,7 @@ async fn launch(
"[memory:import] run started"
);
let config = config.clone();
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
if mode == Mode::Import {
driver.run(begun).await;
} else {
diff --git a/crates/openhuman-core/src/memory/layout_migration/service.rs b/crates/openhuman-core/src/memory/layout_migration/service.rs
index dd4c0bbb42..1f699c0a49 100644
--- a/crates/openhuman-core/src/memory/layout_migration/service.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/service.rs
@@ -99,7 +99,7 @@ pub fn start(
return false;
}
let guard = RunGuard(workspace);
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let _guard = guard;
let outcome = lm::run(host.as_ref(), trigger, || {
let paused = paused();
diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks.rs b/crates/openhuman-core/src/memory/lifecycle/hooks.rs
index 96f51dd7ec..2f83c67710 100644
--- a/crates/openhuman-core/src/memory/lifecycle/hooks.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/hooks.rs
@@ -212,7 +212,7 @@ pub async fn pre_turn(
let dispatch = ctx.clone();
let identity = identity.clone();
let thread = input.thread_id.clone();
- let task = crate::core::runtime::spawn_scoped(async move {
+ let task = ctx.spawn(async move {
pre_turn_work(&dispatch, &config, &identity, input).await
});
let pack = match tokio::time::timeout(timeout, task).await {
diff --git a/crates/openhuman-core/src/memory/sources/sync.rs b/crates/openhuman-core/src/memory/sources/sync.rs
index e6e77ca7f4..82e2523988 100644
--- a/crates/openhuman-core/src/memory/sources/sync.rs
+++ b/crates/openhuman-core/src/memory/sources/sync.rs
@@ -200,7 +200,7 @@ pub fn start_sync(config: &Config, id: Option<&str>) -> MemoryResult<Vec<String>
for claim in claims {
started.push(claim.source().id.clone());
let config = config.clone();
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let result = match config
.memory
.sources
diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rs
index 54adced01b..96c8a43d61 100644
--- a/crates/openhuman-core/src/memory/tool_writes.rs
+++ b/crates/openhuman-core/src/memory/tool_writes.rs
@@ -434,7 +434,7 @@ pub(crate) async fn fence_and_clear(config: &Config) -> MemoryResult<WriteFence>
};
fence.guard = Some(state.barrier.clone().write_owned().await);
let snapshot_config = config.clone();
- crate::core::runtime::spawn_blocking_scoped(move || {
+ crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {
let _guard = LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -464,10 +464,10 @@ pub(super) fn schedule_all(config: Arc<Config>) {
if super::engine::switched_off(&config) {
return;
}
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let scan_config = config.clone();
let files =
- match crate::core::runtime::spawn_blocking_scoped(move || partitions(&scan_config))
+ match crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || partitions(&scan_config))
.await
{
Ok(Ok(files)) => files,
@@ -498,7 +498,7 @@ fn schedule_partition(config: Arc<Config>, file: PathBuf) {
let Ok(guard) = state.barrier.clone().try_lock_owned() else {
return;
};
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let _guard = guard;
let _owner_guard = owner_guard;
let _state = state;
diff --git a/crates/openhuman-core/src/modules/storage_host_endpoint.rs b/crates/openhuman-core/src/modules/storage_host_endpoint.rs
index 3cf1a716f2..a1eee19340 100644
--- a/crates/openhuman-core/src/modules/storage_host_endpoint.rs
+++ b/crates/openhuman-core/src/modules/storage_host_endpoint.rs
@@ -102,7 +102,7 @@ impl StorageHost {
let mut signals = binding.server.signals();
let tx = relay.tx.clone();
relay.fed_by = Some(Arc::downgrade(binding));
- relay.bridge = Some(crate::core::runtime::spawn_scoped(async move {
+ relay.bridge = Some(tokio::spawn(async move {
loop {
match signals.recv().await {
Ok(signal) => {
diff --git a/crates/openhuman-core/src/profiles/background.rs b/crates/openhuman-core/src/profiles/background.rs
index f9e864c96a..91f31d7c91 100644
--- a/crates/openhuman-core/src/profiles/background.rs
+++ b/crates/openhuman-core/src/profiles/background.rs
@@ -41,7 +41,7 @@ pub struct TickReport {
/// Start the loop. It runs until the process exits.
pub fn spawn(host: Arc<ProfileHost>) -> tokio::task::JoinHandle<()> {
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
log::info!(
"[profiles][background] started (every {}s)",
TICK_INTERVAL.as_secs()
diff --git a/crates/openhuman-core/src/profiles/lease.rs b/crates/openhuman-core/src/profiles/lease.rs
index 5b58630fa8..93d609b94a 100644
--- a/crates/openhuman-core/src/profiles/lease.rs
+++ b/crates/openhuman-core/src/profiles/lease.rs
@@ -191,7 +191,7 @@ pub fn heartbeat(host: Arc<ProfileHost>, operator: Arc<crate::core::runtime::Cor
}
}
});
- crate::core::runtime::spawn_scoped(renewals);
+ tokio::spawn(renewals);
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rs
index f83b792ff8..a374c8456d 100644
--- a/crates/openhuman-core/src/sandbox/shell_exec.rs
+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs
@@ -119,7 +119,7 @@ pub(crate) async fn run(config: &Config, mut run: NativeShellRun) -> anyhow::Res
// cancellation is acknowledged only after the command is gone.
let hold = tinytools_std::timeout::ProcessCleanup::hold();
let (_caller, abandoned) = tokio::sync::oneshot::channel::<std::convert::Infallible>();
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let _hold = hold;
run_owned(&config, run, abandoned, meter).await
})
diff --git a/crates/openhuman-core/src/storage/blob_sweep.rs b/crates/openhuman-core/src/storage/blob_sweep.rs
index a3fa1fa4de..f91b182b6a 100644
--- a/crates/openhuman-core/src/storage/blob_sweep.rs
+++ b/crates/openhuman-core/src/storage/blob_sweep.rs
@@ -174,7 +174,7 @@ pub async fn sweep_installed() -> u64 {
/// Spawns the sweeper: after `first_delay`, then every `interval`, until the
/// task is aborted. Missed ticks are skipped, not replayed.
pub fn spawn(first_delay: Duration, interval: Duration) -> tokio::task::JoinHandle<()> {
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
tracing::debug!(
first_delay_secs = first_delay.as_secs(),
interval_secs = interval.as_secs(),
diff --git a/crates/openhuman-core/src/voice/always_on/capture.rs b/crates/openhuman-core/src/voice/always_on/capture.rs
index 3ba4f5973e..24afa5c0dc 100644
--- a/crates/openhuman-core/src/voice/always_on/capture.rs
+++ b/crates/openhuman-core/src/voice/always_on/capture.rs
@@ -25,7 +25,7 @@ pub(super) async fn spawn_capture_thread(
let lease = CaptureLease::reserve(config, Kind::Stream).await?;
let stream = lease.start_stream().await?;
let mut stopped = STOP.subscribe();
- let task = crate::core::runtime::spawn_scoped(async move {
+ let task = tokio::spawn(async move {
loop {
if tx.is_closed() {
break;
diff --git a/crates/openhuman-core/src/voice/always_on/processor.rs b/crates/openhuman-core/src/voice/always_on/processor.rs
index 942d6bbdfb..a392510040 100644
--- a/crates/openhuman-core/src/voice/always_on/processor.rs
+++ b/crates/openhuman-core/src/voice/always_on/processor.rs
@@ -126,7 +126,7 @@ pub async fn start_if_enabled(app_config: &Config) {
let onset_threshold = vad.onset_threshold;
let mut stopped = super::capture::stop_subscription();
- let processor = crate::core::runtime::spawn_scoped(async move {
+ let processor = crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let _running = running;
let _pump = pump;
// The segmenter lives in the module now, so opening it can fail for
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener.rs b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
index 2ed8645fe0..6625d5478d 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
@@ -121,7 +121,7 @@ async fn start_module_hotkey_listener(
let (events_tx, events_rx) = tokio::sync::mpsc::channel(65);
let (ready_tx, ready_rx) = tokio::sync::oneshot::channel();
let worker_handle = handle.clone();
- let task = crate::core::runtime::spawn_scoped(async move {
+ let task = tokio::spawn(async move {
let generation = loop {
if worker_cancel.is_cancelled() || events_tx.is_closed() {
break None;
@@ -344,7 +344,7 @@ async fn start_globe_with_client(
let (ready_tx, ready_rx) = tokio::sync::oneshot::channel();
let cancel = server_cancel.child_token();
let task_cancel = cancel.clone();
- let task = crate::core::runtime::spawn_scoped(async move {
+ let task = tokio::spawn(async move {
let _admission = admission;
let started = match client.globe_start().await {
Ok(started) => started,
diff --git a/crates/openhuman-core/src/voice/server/runtime.rs b/crates/openhuman-core/src/voice/server/runtime.rs
index 25a94ee482..0aad5ff205 100644
--- a/crates/openhuman-core/src/voice/server/runtime.rs
+++ b/crates/openhuman-core/src/voice/server/runtime.rs
@@ -210,7 +210,7 @@ impl VoiceServer {
// event loop remains responsive to Release.
let (tx, rx) = tokio::sync::oneshot::channel();
let capture_config = app_config.clone();
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
let expected_app = capture_expected_app_name(&capture_config).await;
let result = audio_capture::start_recording(&capture_config).await
.map(|handle| (handle, expected_app));
@@ -386,7 +386,7 @@ impl VoiceServer {
"{LOG_PREFIX} [pipeline={pipeline_id}] spawning process_recording (generation={generation})"
);
- crate::core::runtime::spawn_scoped(async move {
+ crate::core::runtime::DispatchCtx::ambient().spawn(async move {
process_recording_bg(
&pipeline_id,
handle,
diff --git a/crates/openhuman-core/src/web_chat/ops/state.rs b/crates/openhuman-core/src/web_chat/ops/state.rs
index 950e59aab2..2c6ff3df18 100644
--- a/crates/openhuman-core/src/web_chat/ops/state.rs
+++ b/crates/openhuman-core/src/web_chat/ops/state.rs
@@ -220,7 +220,7 @@ pub(crate) async fn track_parallel_turn_for_test(
cancel: tokio_util::sync::CancellationToken,
) {
let watched = cancel.clone();
- let handle = crate::core::runtime::spawn_scoped(async move { watched.cancelled().await });
+ let handle = tokio::spawn(async move { watched.cancelled().await });
parallel_in_flight(ctx).lock_owned().await.insert(
key_for(ctx, request_id),
ParallelEntry {
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index 7e71eb09e1..c2931a5a1b 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -294,7 +294,7 @@ pub(crate) fn spawn_progress_bridge(
std::sync::Mutex<Option<super::turn_timing::TurnTimingSnapshot>>,
> = std::sync::Arc::new(std::sync::Mutex::new(None));
let timing_snapshot_for_task = timing_snapshot.clone();
- crate::core::runtime::spawn_scoped(async move {
+ dispatch_ctx.spawn(async move {
log::debug!(
"[web_channel][bridge] spawned client_id={} thread_id={} request_id={} speak_reply={:?} source={:?} session_id={:?} hold_text_stream={}",
client_id,
diff --git a/crates/openhuman-core/src/web_chat/turn_activity.rs b/crates/openhuman-core/src/web_chat/turn_activity.rs
index f9127a415c..77e5cdaf33 100644
--- a/crates/openhuman-core/src/web_chat/turn_activity.rs
+++ b/crates/openhuman-core/src/web_chat/turn_activity.rs
@@ -289,7 +289,7 @@ pub(crate) fn tap(
capacity: usize,
) -> mpsc::Receiver<AgentProgress> {
let (bridge_tx, bridge_rx) = mpsc::channel(capacity);
- crate::core::runtime::spawn_scoped(async move {
+ tokio::spawn(async move {
while let Some(event) = agent_rx.recv().await {
activity.observe(&event);
if bridge_tx.send(event).await.is_err() {