Repository navigation
Don't override pipeline Error status in InlineReceiver (GH-3288) - #3292
Merged
Merged
Conversation
GH-3288) When a handler fails but the failure is contained by an error-handling continuation (dead-letter, discard, retries exhausted), Executor.ExecuteAsync flags the receive Activity as Error without rethrowing, so no exception propagates out of HandlerPipeline.InvokeAsync. InlineReceiver's success path then unconditionally called SetStatus(Ok), clobbering that Error status. Only mark the activity Ok when it isn't already flagged as an Error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…activity-status-3288
This was referenced Jul 9, 2026
Merged
This was referenced Jul 28, 2026
Closed
This was referenced Aug 4, 2026
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.
Fixes #3288
Problem
InlineReceiverstarts a"receive"activity and threads it intoHandlerPipeline.InvokeAsync(envelope, listener, activity). When a handler throws,Executor.ExecuteAsyncsetsActivity.Current(which is that receive activity) toError— but rather than rethrow, it returns an error-handling continuation (dead-letter / discard / retries exhausted). The failure is contained, so no exception propagates out ofInvokeAsync.Back in
InlineReceiver, the success path then ranactivity?.SetStatus(ActivityStatusCode.Ok)unconditionally, clobbering theErrorstatus the pipeline had already set. With a batch export processor this also races the export and the span can ship asOk.Fix
Only mark the activity
Okwhen it isn't already flagged as anError:Reproduction / tests
Added
inline_receiver_activity_status.cs(broker-free unit tests):does_not_override_error_status_set_by_the_pipeline— a substituteIHandlerPipelineflags the passed-in activityErrorwithout throwing (simulating a contained failure); anActivityListenercaptures the stopped"receive"activity. Fails onmain(span endsOk), passes with the fix.marks_ok_on_the_happy_path— guards the normal success path.All 14
inline_receivertests green.🤖 Generated with Claude Code