Fix #208: skip stale-snapshot resume on SessionVerId bump#209
Merged
Conversation
HydrateFromSnapshotAsync only compared snapshot.SessionId against the current session, never SessionVerId. After a cold-start EstablishReuse reject forces a fresh Negotiate (bumping SessionVerId), the outbound app seq counter and inbound/outstanding-order state were still resumed from the pre-bump snapshot, silently desyncing MsgSeqNum from what the venue expects for the new session. Now HydrateFromSnapshotAsync also checks snapshot.SessionVerId against the (possibly bumped) options.SessionVerId and skips resuming state when they differ, logging via new StaleSnapshotSessionVerIdIgnored. Adds a regression test verifying the outbound seq starts at 1 (not the stale snapshot's LastOutboundSeqNum + 1) after a rejected cold-start reattach, via new PeekNextOutboundSeqNumForTesting test hook. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The prior fix compared snapshot.SessionVerId against the current options.SessionVerId unconditionally, which also broke the legitimate warm-reconnect path (explicit ReconnectAsync/AlwaysNegotiate) where the in-process outbound counter is deliberately carried across a bumped SessionVerId (Spec_4_7_Retransmit/ReconnectRetransmitTests conformance regression). Narrow the fix to only suppress snapshot resume for the specific #208 scenario: TryColdResumeAsync's recoverable-EstablishReuse-reject fallback, via a one-shot _suppressNextSnapshotResume flag consumed by the very next HydrateFromSnapshotAsync call. This leaves the intentional live-reconnect sequence continuity behavior untouched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pedrosakuma
pushed a commit
to pedrosakuma/B3TradingPlatform
that referenced
this pull request
Jul 6, 2026
Picks up the fix from pedrosakuma/B3EntryPointClient#209 for #208: HydrateFromSnapshotAsync previously resumed the outbound sequence counter from a stale snapshot even when SessionVerId had bumped on a fresh Negotiate, causing silent NotApplied gaps on the venue side after a trading-host reconnect (root cause of a live incident where accepted orders never reached the book). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pedrosakuma
added a commit
to pedrosakuma/B3TradingPlatform
that referenced
this pull request
Jul 6, 2026
* fix: bump B3.EntryPoint.Client to 0.16.1 Picks up the fix from pedrosakuma/B3EntryPointClient#209 for #208: HydrateFromSnapshotAsync previously resumed the outbound sequence counter from a stale snapshot even when SessionVerId had bumped on a fresh Negotiate, causing silent NotApplied gaps on the venue side after a trading-host reconnect (root cause of a live incident where accepted orders never reached the book). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: align Microsoft.Extensions.* to 10.0.9 for B3.EntryPoint.Client 0.16.1 0.16.1 raised its own transitive floor on Microsoft.Extensions.Logging.Abstractions and Microsoft.Extensions.Options to >=10.0.9, which conflicted (NU1605 downgrade error) with the repo-wide 10.0.8 pin used by bench/B3.Trading.LoadTest and bench/B3.Trading.Benchmarks. Bumping the whole Microsoft.Extensions.* family together to 10.0.9 keeps all packages in that family on a consistent version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 #208.
HydrateFromSnapshotAsynconly comparedsnapshot.SessionIdagainst the current session, neverSessionVerId. After a cold-startEstablishReusereject forces a freshNegotiate(bumpingSessionVerId), the outbound app seq counter and inbound/outstanding-order state were still resumed from the pre-bump snapshot, silently desyncingMsgSeqNumfrom what the venue expects for the new session.Fix
HydrateFromSnapshotAsyncnow also checkssnapshot.SessionVerIdagainst the (possibly bumped)options.SessionVerIdand skips resuming state when they differ, logging via newStaleSnapshotSessionVerIdIgnored.Tests
ColdResume_EstablishRejectedUnnegotiated_DoesNotResumeOutboundSeqFromStaleSnapshotverifying outbound seq starts at 1 (not the stale snapshot's value) after a rejected cold-start reattach.PeekNextOutboundSeqNumForTestinginternal test hook.dotnet format --verify-no-changesclean.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com