feat: created the RenderMode enum to suppress stdout streaming during parallel graph super-steps

This commit is contained in:
2026-05-20 15:32:03 -06:00
parent ad7f71df56
commit 1f4f4dfb75
6 changed files with 48 additions and 8 deletions
+7 -3
View File
@@ -9,7 +9,7 @@ use super::state::StateManager;
use super::types::{EndNode, Graph, Node, NodeType};
use super::user_interaction::{ApprovalNodeExecutor, InputNodeExecutor};
use super::validator::{AgentValidationContext, GraphValidator};
use crate::config::RequestContext;
use crate::config::{RenderMode, RequestContext};
use crate::utils::AbortSignal;
use anyhow::{Context, Result, anyhow, bail};
use futures_util::future::join_all;
@@ -144,7 +144,8 @@ impl GraphExecutor {
let snapshot = state.read_snapshot();
let semaphore = Arc::new(Semaphore::new(max_concurrency));
let mut branch_tasks = Vec::with_capacity(frontier.len());
let frontier_size = frontier.len();
let mut branch_tasks = Vec::with_capacity(frontier_size);
for node_id in &frontier {
let node = graph
.get_node(node_id)
@@ -153,7 +154,10 @@ impl GraphExecutor {
})?
.clone();
let branch_state = state.fork_for_branch_state();
let branch_ctx = ctx.fork_for_branch();
let mut branch_ctx = ctx.fork_for_branch();
if frontier_size > 1 {
branch_ctx.render_mode = RenderMode::Silent;
}
let script_exec_clone = script_executor.clone();
let graph_clone = Arc::clone(&graph);
let current = node_id.clone();
+4 -3
View File
@@ -4,14 +4,14 @@ use super::llm::LlmNodeExecutor;
use super::rag::RagNodeExecutor;
use super::state::StateManager;
use super::types::{MapNode, NodeType};
use crate::config::RequestContext;
use crate::config::{RenderMode, RequestContext};
use crate::graph::type_name;
use anyhow::{Context, Result, anyhow};
use futures_util::future::join_all;
use serde_json::Value;
use std::collections::HashMap;
use std::sync::Arc;
use tokio::sync::Semaphore;
use crate::graph::type_name;
// Map sub-branches are atomic — the branch node has no `next` (enforced by
// validator rule C.5). But LLM/RAG node executors require an `Option<&str>` for
@@ -66,7 +66,8 @@ impl MapNodeExecutor {
let as_name = node.as_name.clone();
let branch_clone = branch_node.clone();
let mut sub_state = state.fork_for_branch_state();
let sub_ctx = ctx.fork_for_branch();
let mut sub_ctx = ctx.fork_for_branch();
sub_ctx.render_mode = RenderMode::Silent;
let script_clone = step_ctx.script_executor.clone();
let sub_branch_id = node.branch.clone();
let sem = semaphore.clone();