From 4873dd6bc71187fda686449d27291b3857ae910f Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 13 Nov 2026 18:42:13 +0100 Subject: [PATCH] fix: query only the kinds a set holds at an explicit path Co-Authored-By: Claude Opus 5.5 --- backend/windmill-api/src/ai_session_tools/runs.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/windmill-api/src/ai_session_tools/runs.rs b/backend/windmill-api/src/ai_session_tools/runs.rs index 9c4ad69b21..a0f34f5fd3 100644 --- a/backend/windmill-api/src/ai_session_tools/runs.rs +++ b/backend/windmill-api/src/ai_session_tools/runs.rs @@ -1862,7 +1862,14 @@ async fn list_runs(ctx: &Ctx<'_>, args: &Value) -> ToolResult { } // A flow's inline steps run at paths under the flow's, so a set's queries name the kind too. let queries: Vec = match (&set, path) { - (Some(_), Some(_)) => vec![format!("{query}&job_kinds=script,flow")], + (Some(set), Some(path)) => { + // Only the kinds the set holds at this path: a script and a flow can share one. + let kinds: Vec<&str> = ["script", "flow"] + .into_iter() + .filter(|kind| set.allows(kind, path)) + .collect(); + vec![format!("{query}&job_kinds={}", kinds.join(","))] + } (Some(set), None) => set .run_queries() .into_iter()