fix: hand flow previews on an agent's tag to a flow worker

Merged
RU
1d ago
+87-6

Summary

An agent worker cannot drive a flow. When pull finds a flow job through a caller's own query (the agent endpoint's), it moves the job onto the generic flow tag, and the job keeps its own tag in v2_job so its steps still run on the agent. Flow previews were exempt from this when the preview_tags_override instance setting was on (#8649), so with that setting on, testing a flow on an agent's tag handed the flow preview to the agent, which failed it with Could not handle flow job with agent worker.

Regular workers pull with no custom query and never reach this block, so the exemption only ever affected agents (the worker shell pulls on a worker-name tag no preview carries; AI tool claims pull tool jobs, never flow previews).

Changes

  • pull (windmill-queue/src/jobs.rs): requeue flow previews like any other flow job, override or not.
  • handle_queued_job (windmill-worker/src/worker.rs): the agent-side error, kept as a guard, now says why agents never run flow jobs.
  • EE companion (windmill-labs/windmill-ee-private, branch fix-agent-flow-preview-requeue): drops the agent pull_job todo to requeue flow jobs, which pull covers; ee-repo-ref.txt points to it.
  • windmill-queue/tests/custom_query_flow_requeue_test.rs: with the override on, a flow preview on an agent tag pulled through a custom query lands on flow, not running, with v2_job.tag kept. Fails without the fix.

Test plan

  • E2E against a real agent (tag agentx, MODE=agent) on an EE build with agent_worker_server, override on, flow preview tagged agentx:
    • before: the flow preview ran on ag-agentgrp-* and failed with Could not handle flow job with agent worker
    • after: the flow preview ran on wk-default-*, its step on ag-agentgrp-* with tag agentx, both succeeded
  • New test passes, and fails with the exemption restored
  • cargo check -p windmill-queue -p windmill-worker (CE) clean; EE build in the dev pane clean

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes flow previews failing when tested on an agent's tag: they were handed to the agent worker, which cannot drive flows, and failed with Could not handle flow job with agent worker.

Now flow previews are requeued to the generic flow tag like any other flow job, so a regular worker picks them up while the preview's steps still run on the agent's tag. The agent-side error message now explains why agents never run flow jobs, and the EE companion drops its now-redundant agent pull_job requeue.

  • Adds a regression test that fails without the fix.