Skip to content

fix: enforce max_runs_per_component limit correctly#11334

Open
rautaditya2606 wants to merge 1 commit into
deepset-ai:mainfrom
rautaditya2606:fix/pipeline-max-runs-per-component
Open

fix: enforce max_runs_per_component limit correctly#11334
rautaditya2606 wants to merge 1 commit into
deepset-ai:mainfrom
rautaditya2606:fix/pipeline-max-runs-per-component

Conversation

@rautaditya2606
Copy link
Copy Markdown

Proposed Changes

max_runs_per_component checked visits > max before each run while visits increments after the run, allowing one extra execution (e.g. 101 runs when the limit is 100). Use visits >= max so behavior matches the documented limit.

How did you test it?

  • Updated test__get_next_runnable_component_max_visits in test/core/pipeline/test_pipeline_base.py
  • hatch run test:unit test/core/pipeline/test_pipeline_base.py::TestPipelineBase::test__get_next_runnable_component_max_visits

Checklist

  • Release note added
  • Unit test updated

Use visits >= max_runs_per_component so components cannot run more times
than the configured limit within a single Pipeline.run() call.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings May 18, 2026 07:21
@rautaditya2606 rautaditya2606 requested a review from a team as a code owner May 18, 2026 07:21
@rautaditya2606 rautaditya2606 requested review from sjrl and removed request for a team May 18, 2026 07:21
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

@rautaditya2606 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes an off-by-one bug in pipeline component run limiting so components cannot execute more than max_runs_per_component times within a single Pipeline.run().

Changes:

  • Tighten the run-limit check from > to >= for max_runs_per_component.
  • Update the regression test to assert the limit triggers exactly at the configured max.
  • Add a release note documenting the bugfix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
haystack/core/pipeline/base.py Fixes the boundary condition in the max-runs enforcement logic (>= instead of >).
test/core/pipeline/test_pipeline_base.py Updates the failing boundary test to match the corrected enforcement behavior.
releasenotes/notes/fix-pipeline-max-runs-off-by-one-4a8e2f1c9b3d7051.yaml Documents the off-by-one fix for users.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/core/pipeline/test_pipeline_base.py
@sjrl sjrl assigned sjrl and unassigned sjrl May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants