Skip to content

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

fix(runtime): box tasks before propagating execution scopes

Steven Enamakel9a2c6a9b5cd5
diff --git a/crates/openhuman-core/src/core/runtime/spawn.rs b/crates/openhuman-core/src/core/runtime/spawn.rs
index ce3225f267..62a5a68059 100644
--- a/crates/openhuman-core/src/core/runtime/spawn.rs
+++ b/crates/openhuman-core/src/core/runtime/spawn.rs
@@ -47,6 +47,10 @@ where
{
let identity = crate::memory::scope::current();
let ctx = captured();
+ // Box before either task-local wrapper. Their branching async states
+ // otherwise multiply a large task's inline size before Tokio can box it,
+ // overflowing the spawning thread (including the CLI's main stack).
+ let fut = Box::pin(fut);
let fut = async move {
match ctx {
Some(ctx) => CoreContext::scope(ctx, fut).await,