Files
windmill/backend/windmill-queue
Ruben FiszelandClaude Opus 5.5 e3ff8bee3d fix: never break running flows when their flow is deleted (#12306)
* fix: report the real error when a flow's stored version cannot be loaded

A flow step that completes on a worker without the flow version cached
looked it up, failed (e.g. the flow was deleted, cascading its versions),
then fell back to the preview path, whose 'Job isn't a flow job' error
replaced the real one. Keep the stored lookup's error when the job has no
inline flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep a flow's nodes when it is renamed

Renaming a flow moved its versions to the new path but left its flow nodes
on the old one, so deleting the old flow row cascaded them away. Runs in
flight inside a loop or branch then failed loading their body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep a deleted flow's versions until its runs are done

Deleting a flow cascaded its flow_version and flow_node rows away, so runs
in flight failed at their next step. The cascade is dropped; the rows are
purged when the flow leaves the trash, unless a run of it is still queued,
in which case they are kept. Workspace deletion deletes them explicitly,
and the version history only lists the current flow's versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: scope moves, reads and the purge to a flow's own versions

A deleted flow's versions now survive at its path, so rename, user rename,
offboarding, fork cloning, version reads, history and the trash purge only
act on the ids the live flow lists. Renames skip nodes already present at the
destination with the same content, nodes are no longer purged (they are
shared by content and referenced by id), and dependency relocks skip flows
that no longer exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: resolve a flow's latest version among the live flow's own

The relock checks and the dependents trigger picked the newest version at the
path, which can now be a deleted flow's. Restore the shared query's cache entry
under its new text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: set a deleted flow's versions aside instead of scoping every lookup

Deleting a flow moves its versions to __deleted/<trash id>; restoring moves
them back. Jobs load versions by id so runs in flight keep working, while
every lookup by path (history, relocks, versioned runs, renames) stops
seeing a deleted flow without special-casing. The purge keeps a set-aside
version any queued job references by id, whatever path or kind it was
queued under. The per-lookup scoping is reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: rustfmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: set versions aside only after an authorized delete, find flow_env by id

Row-level security can let a caller read a flow it may not delete; the
delete then removes nothing and must not trash it or move its versions.
fetch_root_flow_env matched a run's version by path too, so runs of a
deleted (or renamed) flow lost their inherited flow_env: match by id for
the kinds whose runnable_id is a flow version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state the authorization contract of the version set-aside helpers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf: read the queue once when purging a deleted flow's versions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: serialize flow version writes with a concurrent flow delete

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: make the relock copy wait for a concurrent flow rename

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:23:10 +01:00
..