feat(TASK-011): traverse agent fallback edges in map peer-discovery BFS

This commit is contained in:
Dark-Alex-17 committed 2026-09-14 10:50:33 -06:00
1 parent 75cc2a4b9c
commit 18875a4cc9
1 file changed
+28
+28
View File
@@ -440,6 +440,7 @@ fn first_flagged_agent_by_bfs<'g>(
match &node.node_type {
NodeType::Script(s) => edges.extend(s.fallback.as_ref()),
NodeType::Llm(l) => edges.extend(l.fallback.as_ref()),
NodeType::Agent(a) => edges.extend(a.fallback.as_ref()),
_ => {}
}
for next in edges {
@@ -2484,6 +2485,33 @@ nodes:
}
}
#[test]
fn provision_map_peers_finds_flagged_agent_behind_agent_fallback_edge() {
let h = Harness::new(
r#"
name: t
start: gate
nodes:
gate:
type: agent
agent: gatekeeper
prompt: "p"
fallback: rescue
rescue:
type: agent
agent: rescue-agent
prompt: "p"
teammates: true
"#,
);
let (_, assignments) = h.provision("gate", 2);
for (id, _) in &assignments {
assert!(id.starts_with("graph_agent_rescue-agent_"), "{id}");
}
}
#[test]
fn provision_map_peers_ignores_flagged_agent_outside_subgraph() {
let h = Harness::new(GATE_WORKER_FINISH_GRAPH);