Fix replayed DLQ messages stuck in ancillary store as Incoming#2335
Merged
jeremydmiller merged 2 commits intomainfrom Mar 22, 2026
Merged
Fix replayed DLQ messages stuck in ancillary store as Incoming#2335jeremydmiller merged 2 commits intomainfrom
jeremydmiller merged 2 commits intomainfrom
Conversation
When envelopes are recovered from an ancillary message store's inbox (e.g., after DLQ replay), set envelope.Store to the store they were loaded from. Without this, the Store property is null and DelegatingMessageInbox falls back to the main store when marking the envelope as handled — leaving it permanently stuck as "Incoming" in the ancillary store. Closes #2318 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 22, 2026
This was referenced Mar 29, 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.
Closes #2318
Summary
When a message routed to an ancillary store fails and goes to the dead letter queue, replaying it from the DLQ would mark it as processed in the main store instead of the ancillary store. This left the envelope permanently stuck with
Incomingstatus in the ancillary database tables.Root Cause
In
RecoverIncomingMessagesCommand.ExecuteAsync(), envelopes loaded from an ancillary store's inbox viaLoadPageOfGloballyOwnedIncomingAsync()had theirStoreproperty set tonull. WhenDelegatingMessageInbox.MarkIncomingEnvelopeAsHandledAsync()checkedenvelope.Store?.Inbox, it fell back to_inner(the main store's inbox) becauseStorewas null.Fix
Set
envelope.Storeto the store the envelope was loaded from during recovery:This ensures the envelope maintains its affinity to the correct store throughout its lifecycle, so
DelegatingMessageInboxroutes the "mark as handled" operation to the ancillary store.Test plan
Bug_2318_ancillary_dlq_replay.replayed_dlq_message_should_not_be_stuck_in_incomingreproduces the issue🤖 Generated with Claude Code