fix: address review nits on MCP get_run and delete-after-use waits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-11-04 22:56:37 +01:00
co-authored by Claude Opus 5.5
parent 77164c296c
commit 6e63145a47
3 changed files with 19 additions and 11 deletions
+2 -2
View File
@@ -8409,8 +8409,8 @@ impl QueuedRun {
result
}
/// Whether its script deletes the run's data once its result is read, which only a
/// caller waiting on that result does.
/// Whether its script deletes the run's data after use, at once or after a delay: only a
/// caller that waits for the result applies that setting.
pub fn deletes_after_use(&self) -> bool {
resolve_delete_after_secs(self.delete_after_use, self.delete_after_secs).is_some()
}
+2 -2
View File
@@ -112,8 +112,8 @@ impl WindmillBackend {
queued: QueuedRun,
request: &McpRequest<'_>,
) -> BackendResult<Value> {
// No later read can follow these: a hub script's run is outside what `get_run`
// reads, and a run deleted once its result is read is gone by then.
// A hub script's run is outside what `get_run` reads, and a script's delete-after-use
// setting is applied only by a caller that waits for its result.
if path.starts_with("hub/") || queued.deletes_after_use() {
let response = queued
.wait(&self.db, workspace_id, &auth.username)
+15 -7
View File
@@ -884,12 +884,17 @@ impl<B: McpBackend> Runner<B> {
));
}
tools.extend(
self.backend
.session_tools(SessionAccess::ReadOnly)
.into_iter()
.find(|tool| tool.name == GET_RUN),
);
if scope_config.favorites
|| scope_config.has_any("script")
|| scope_config.has_any("flow")
{
tools.extend(
self.backend
.session_tools(SessionAccess::ReadOnly)
.into_iter()
.find(|tool| tool.name == GET_RUN),
);
}
}
// Add endpoint tools from the generated MCP tools, filtered by scope.
@@ -1142,7 +1147,10 @@ impl<B: McpBackend> Runner<B> {
let id = args.get("id").and_then(Value::as_str).unwrap_or_default();
let refused = || {
ErrorData::invalid_params(
format!("No run {id} of a script or flow this token runs"),
format!(
"No run {id} of a script or flow this token runs. For a step of a flow, \
pass the flow's run id and the step's id as `step`."
),
None,
)
};