Fully Automated - 100% Backpressure - Pipeline runner ๐Ÿƒ for AI workflows. ๐Ÿš€

Commit 2c93b92e

2c93b92e9c86Merged

Scott Nixon <[email protected]> ยท 9 months ago ยท 2 files ยท ~2 modified

Description

Implement real shell execution in ToolHandler and fix conditional routing

ToolHandler now spawns shell commands with timeout, captures stdout/stderr, tracks exit codes, and supports dry-run mode. Conditional nodes with a prompt attribute are routed to codergen so the prompt gets executed via the LLM. CodergenHandler now passes --dangerously-skip-permissions.

Details

Commit
2c93b92e9c86
Parent
e1c7ea7ece93

crates/attractor-pipeline/src/handler.rsmodifiedView file

@@ -88,11 +88,21 @@
8888 /// 1. Explicit `type` attribute on the node
8989 /// 2. Shape-based mapping
9090 /// 3. Default: `"codergen"`
91+ ///
92+ /// Special case: conditional nodes with a prompt are routed to `"codergen"`
93+ /// so the prompt actually gets executed via Claude. The `ConditionalHandler`
94+ /// is a pass-through for pure routing nodes with no prompt.
9195 pub fn resolve_type(&self, node: &PipelineNode) -> String {
9296 if let Some(ref t) = node.node_type {
97+ if t == "conditional" && node.prompt.is_some() {
98+ return "codergen".to_string();
99+ }
93100 return t.clone();
94101 }
95102 if let Some(t) = self.shape_to_type.get(&node.shape) {
103+ if t == "conditional" && node.prompt.is_some() {
104+ return "codergen".to_string();
105+ }
96106 return t.clone();
97107 }
98108 "codergen".to_string()
@@ -243,6 +253,32 @@
243253 }
244254
245255 #[test]
256+ fn resolve_type_conditional_without_prompt_stays_conditional() {
257+ let reg = HandlerRegistry::new();
258+ // Diamond with no prompt โ†’ conditional (pass-through)
259+ let node = make_node("check", "diamond", None);
260+ assert_eq!(reg.resolve_type(&node), "conditional");
261+ }
262+
263+ #[test]
264+ fn resolve_type_conditional_with_prompt_becomes_codergen() {
265+ let reg = HandlerRegistry::new();
266+ // Diamond with a prompt โ†’ codergen (needs LLM to run the prompt)
267+ let mut node = make_node("check", "diamond", None);
268+ node.prompt = Some("Check if tasks remain".to_string());
269+ assert_eq!(reg.resolve_type(&node), "codergen");
270+ }
271+
272+ #[test]
273+ fn resolve_type_explicit_conditional_with_prompt_becomes_codergen() {
274+ let reg = HandlerRegistry::new();
275+ // Explicit node_type="conditional" with a prompt โ†’ codergen
276+ let mut node = make_node("check", "diamond", Some("conditional"));
277+ node.prompt = Some("Check if tasks remain".to_string());
278+ assert_eq!(reg.resolve_type(&node), "codergen");
279+ }
280+
281+ #[test]
246282 fn register_and_get_handler() {
247283 let mut reg = HandlerRegistry::new();
248284 reg.register(StartHandler);