Fix 6.4.0 NRE on empty system envelope (BufferedReceiver + MoveToErrorQueue null guards); bump 6.4.1#3014
Merged
Merged
Conversation
…s; bump to 6.4.1 (GH-3013) The empty all-zero system/agent-handshake envelope emitted on the 6.4.0 startup path tripped two unguarded null-forgiving derefs, producing cascading NREs that aggregated into every consumer integration test going through a TrackedSession: - BufferedReceiver's _deferBlock/_completeBlock retry lambdas dereferenced env.Listener! with no null check. Now no-op (Task.CompletedTask) when Listener is null. - MoveToErrorQueue.ExecuteAsync read lifecycle.Envelope!.Destination!.Scheme *before* the EnableAutomaticFailureAcks guard, so even consumers disabling failure acks still NRE'd. Destination is now read safely (scheme null => no failure ack); the envelope itself is always present, so only Destination is guarded. Steady-state behaviour is unchanged — both guards only no-op the malformed pre-init envelope. Regression tests (both fail without the fix, pass with it): - MoveToErrorQueueTester.does_not_NRE_when_envelope_has_no_destination - buffered_receiver_null_listener_guard_3013 (real host + capturing logger; asserts no NRE is logged when a listener-less envelope is posted to both retry blocks, since RetryBlock swallows + logs the exception rather than rethrowing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 3, 2026
Merged
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 #3013.
The empty all-zero (
#00000000-0000-0000-0000-000000000000) system / agent-handshake envelope that the 6.4.0 startup path emits tripped two unguarded null-forgiving derefs (introduced in e0b67fb "Fix compiler warnings"), producing cascadingNullReferenceExceptions that aggregated into every consumer integration test going through aTrackedSession— even when the test's own assertions would have passed.Fixes
BufferedReceiver.cs—_deferBlock/_completeBlockretry lambdas dereferencedenv.Listener!. Nowenv.Listener is { } l ? l.DeferAsync(...) : Task.CompletedTask— a listener-less envelope no-ops instead of NRE-ing into the retry loop.MoveToErrorQueue.cs—var scheme = lifecycle.Envelope!.Destination!.Scheme;was evaluated before theEnableAutomaticFailureAcksguard, so consumers who explicitly disable failure acks still NRE'd. Nowlifecycle.Envelope!.Destination?.Scheme+ ascheme is not nullguard. (OnlyDestinationis guarded — the envelope itself is always present, as the block just below already relies on; guardingEnvelopetoo would trip CS8602 on those derefs.)Steady-state behaviour is unchanged — both guards only no-op the malformed pre-init envelope.
Regression tests
Both fail without the fix and pass with it (verified by reverting the two source files):
MoveToErrorQueueTester.does_not_NRE_when_envelope_has_no_destination— destination-less envelope with failure acks enabled completes without NRE, sends no failure ack, still moves to DLQ.buffered_receiver_null_listener_guard_3013— real host + a capturingILoggerProvider; posts a listener-less envelope to both retry blocks and asserts noNullReferenceExceptionis logged (RetryBlock swallows + logs + retries the exception rather than rethrowing, so a "does not throw" assertion wouldn't catch it).Release
Bumps
Directory.Build.propsto 6.4.1. Fullwolverine.slnxRelease build clean (0/0); CoreTests serialization/error-handling suites green.🤖 Generated with Claude Code