perf(agent): stabilkan async & parallel — satu runtime, bounded concurrency, isolasi error
Seperti Claude Code: satu runtime shared, concurrency dibatasi, error subagent terisolasi (satu node gagal tidak menggagalkan cycle). - feat(runtime): global tokio runtime via OnceLock — ganti 9+ titik Runtime::new() per tool call (spawn, parallel_delegate, workflow, explore, dir_cache, daemon handler). Hemat resource, hilangkan panic path Runtime::new().expect() di daemon compaction. - fix(workflow): execute_cycle ganti try_join_all (fail-fast) → buffer_unordered(8) + isolasi error per node; node gagal di-log dan diganti [ERROR], hasil node lain tetap dipakai (Claude Code-style). - fix(parallel_delegate): spawn subagent dibatasi per batch max_parallel (tidak unbounded threads). - perf(subagent): run_agent adaptif max_tokens (800/1600/4096), temp 0.2, truncate tool output 12k, error-recovery note utk tool error berulang. - test: runtime singleton + block_on (2 test).
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
//! read of up to 3 relevant files).
|
||||
//! 4. Join the result and return a concise bullet summary as a tool message.
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
use tracing::{info, warn};
|
||||
|
||||
@@ -118,7 +118,7 @@ impl Tool for ExploreCodebase {
|
||||
model,
|
||||
);
|
||||
|
||||
let rt = tokio::runtime::Runtime::new().context("create explore tokio runtime")?;
|
||||
let rt = crate::runtime::runtime();
|
||||
let result = rt.block_on(run_agent(
|
||||
subagent_ctx,
|
||||
&directive,
|
||||
|
||||
Reference in New Issue
Block a user