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:
@@ -471,8 +471,7 @@ fn handle_compact(state: &mut AppStateRest) {
|
||||
let client = zesdex_infrastructure::llm::provider::LlmClient::new(api_key, model, api_base);
|
||||
|
||||
if let Some(ref mut rt) = state.session_runtime {
|
||||
let tokio_rt =
|
||||
tokio::runtime::Runtime::new().expect("create tokio runtime for AI compaction");
|
||||
let tokio_rt = zesdex_infrastructure::runtime::runtime();
|
||||
if let Ok(()) = tokio_rt.block_on(
|
||||
zesdex_application::agent::turn_service::compact_messages_with_ai(
|
||||
&mut rt.messages,
|
||||
|
||||
Reference in New Issue
Block a user