Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/core/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,17 @@ fn run_server_command(args: &[String]) -> Result<()> {
crate::core::logging::init_for_cli_run(verbose, log_scope);

// Initialize the Tokio multi-threaded runtime.
//
// A single agent turn is a very large async state machine (system prompt +
// hundreds of tool specs + the nested provider/tool loop), and delegating
// to a sub-agent runs another full turn one level down. Even with the inner
// sub-agent future boxed (`subagent_runner::ops`), that nesting overflows
// tokio's default 2 MiB worker-thread stack and aborts the whole process
// (SIGABRT: "thread 'tokio-rt-worker' has overflowed its stack"), taking
// the JSON-RPC server down mid-request. Give workers a roomier stack.
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.thread_stack_size(16 * 1024 * 1024)
.build()?;
rt.block_on(async {
crate::core::jsonrpc::run_server(host.as_deref(), port, socketio_enabled).await
Expand Down
Loading