fix(tests): resolve passivation test race condition and missing DI registrations#945
Merged
Aaronontheweb merged 2 commits intoMay 9, 2026
Conversation
…gistrations Two issues prevented reliable CI on the passivation-abort integration tests: 1. Race condition in New_user_message_during_passivation_aborts_shutdown: AwaitAssertAsync was gating only on _fakeChatClient.CallCount == 1 (LLM called), then immediately checking TurnCount. Because the in-memory journal persists asynchronously, TurnCount could still be 0 at the moment CallCount first reaches 1. The fix polls with a witness probe until both CallCount == 1 and TurnCount == 1 are true before the final subscriber re-join. 2. Missing DI registrations in LlmSessionTestBase: EffectivePolicyDefaults (required by ReminderManagerActor) and BackgroundJobDefinitionStore (required by BackgroundJobManagerActor) were not registered, causing actor initialization failures on every test in every LlmSessionTestBase subclass. Added both to ConfigureServices so the actors start cleanly across all session integration tests.
22d7ee7 to
981f849
Compare
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.
Summary
New_user_message_during_passivation_aborts_shutdown_and_processes_messagewas gating only on_fakeChatClient.CallCount == 1before checkingTurnCount. Because the in-memory journal persists asynchronously,TurnCountcould still be 0 at the momentCallCountfirst reaches 1. The fix polls with a witness probe viaAwaitAssertAsyncuntil bothCallCount == 1andTurnCount == 1are simultaneously true, then performs the final subscriber re-join.LlmSessionTestBase.ConfigureServiceswas not registeringEffectivePolicyDefaults(needed byReminderManagerActor) orBackgroundJobDefinitionStore(needed byBackgroundJobManagerActor). Both actors logged initialization errors on every session integration test run. Added both registrations so the actors start cleanly across allLlmSessionTestBasesubclasses.Test plan
New_user_message_during_passivation_aborts_shutdown_and_processes_messagepasses locally (630 ms)Netclaw.Actors.Testssuite passes: 1483/1483 (18 s)ReminderManagerActor/BackgroundJobManagerActor