fix: preserve BreakpointException and PipelineRuntimeError in _run_component_async - #12174
Closed
rautaditya2606 wants to merge 3 commits into
Closed
fix: preserve BreakpointException and PipelineRuntimeError in _run_component_async#12174rautaditya2606 wants to merge 3 commits into
rautaditya2606 wants to merge 3 commits into
Conversation
…mponent_async The async path had a bare 'except Exception' that wrapped both BreakpointException and PipelineRuntimeError into a new PipelineRuntimeError. This silently broke breakpoints in run_async / run_async_generator / stream and caused nested pipeline errors (e.g. from Agent) to lose their original context. Mirror the sync _run_component behaviour: re-raise both exception types as-is and only wrap unknown exceptions. Includes two regression tests and a release note.
rautaditya2606
requested review from
davidsbatista
and removed request for
a team
July 28, 2026 09:22
|
@rautaditya2606 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Pull request overview
- Fixes async pipeline error handling to match sync behavior by re-raising
BreakpointExceptionandPipelineRuntimeErrorfromPipeline._run_component_asyncinstead of wrapping them.
Changes:
- Added explicit
except BreakpointException: raiseandexcept PipelineRuntimeError: raiseinhaystack/core/pipeline/pipeline.pybefore the genericexcept Exception. - Added regression tests covering async propagation behavior for
BreakpointExceptionandPipelineRuntimeError. - Added a release note documenting the fix and its impact on async breakpoints / nested pipeline errors.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
haystack/core/pipeline/pipeline.py |
Re-raises BreakpointException/PipelineRuntimeError in _run_component_async to avoid accidental wrapping. |
test/core/pipeline/test_async_pipeline.py |
Adds async regression tests for breakpoint propagation and avoiding double-wrapping PipelineRuntimeError. |
releasenotes/notes/fix-async-breakpoint-exception-980c389b99a94039.yaml |
Release note describing the async exception propagation fix. |
Comments suppressed due to low confidence (1)
test/core/pipeline/test_async_pipeline.py:580
test_run_component_async_propagates_breakpoint_exceptioncurrently triggers the breakpoint via thebreak_pointargument, which raisesBreakpointExceptionbefore_execute_component_asyncruns; this means the test does not exercise the newexcept BreakpointException:branch inside thetryand would likely have passed even before this PR.
break_point = Breakpoint(component_name="comp", visit_count=0)
component_visits = {"comp": 0}
comp = pipeline._get_component_with_graph_metadata_and_visits("comp", 0)
# _run_component_async must raise BreakpointException, not wrap it in PipelineRuntimeError.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+561
to
+565
| Before the fix, a bare ``except Exception`` in _run_component_async would catch the | ||
| BreakpointException raised at the start of that method (before _execute_component_async | ||
| is even called) and wrap it in a PipelineRuntimeError, silently breaking the breakpoint | ||
| feature for the async path. | ||
| """ |
Contributor
|
@davidsbatista I can take the review of this one |
Contributor
|
Closing. See motivation here #12173 (comment) |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes
except BreakpointException: raiseandexcept PipelineRuntimeError: raiseclauses to_run_component_asyncinpipeline.py, before the generalexcept Exceptionhandler, mirroring the existing logic in the synchronous_run_component.test_run_component_async_propagates_breakpoint_exception, which calls_run_component_asyncdirectly with abreak_pointand asserts thatBreakpointExceptionis propagated instead of being wrapped.test_run_component_async_does_not_rewrap_pipeline_runtime_error, using a component that raisesPipelineRuntimeErrordirectly and asserting that the same exception instance propagates throughrun_async.How did you test it?
All 21 async pipeline tests and 32 breakpoint tests pass.
mypyreports no issues.Notes for the reviewer
exceptclauses are inserted before the existing generic exception handler. The normal execution path is unchanged.BreakpointExceptionis raised before_execute_component_asyncis called, so the previousexcept Exceptionblock always intercepted it and wrapped it in a newPipelineRuntimeError, preventing callers from handling breakpoints correctly.PipelineRuntimeErroralso maintains parity with the synchronous implementation and avoids unnecessary double-wrapping for nested pipelines (for example,Agentcomponents), preserving the original exception context.Checklist