Skip to content

fix(tests): resolve passivation test race condition and missing DI registrations#945

Merged
Aaronontheweb merged 2 commits into
netclaw-dev:devfrom
Aaronontheweb:fix/passivation-test-race-condition
May 9, 2026
Merged

fix(tests): resolve passivation test race condition and missing DI registrations#945
Aaronontheweb merged 2 commits into
netclaw-dev:devfrom
Aaronontheweb:fix/passivation-test-race-condition

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Collaborator

Summary

  • Race condition fix: New_user_message_during_passivation_aborts_shutdown_and_processes_message was gating only on _fakeChatClient.CallCount == 1 before 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 via AwaitAssertAsync until both CallCount == 1 and TurnCount == 1 are simultaneously true, then performs the final subscriber re-join.
  • Missing DI registrations: LlmSessionTestBase.ConfigureServices was not registering EffectivePolicyDefaults (needed by ReminderManagerActor) or BackgroundJobDefinitionStore (needed by BackgroundJobManagerActor). Both actors logged initialization errors on every session integration test run. Added both registrations so the actors start cleanly across all LlmSessionTestBase subclasses.

Test plan

  • New_user_message_during_passivation_aborts_shutdown_and_processes_message passes locally (630 ms)
  • Full Netclaw.Actors.Tests suite passes: 1483/1483 (18 s)
  • No new actor initialization errors in test output for ReminderManagerActor / BackgroundJobManagerActor

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 9, 2026 13:45
…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.
@Aaronontheweb Aaronontheweb force-pushed the fix/passivation-test-race-condition branch from 22d7ee7 to 981f849 Compare May 9, 2026 13:47
@Aaronontheweb Aaronontheweb merged commit 6df73a1 into netclaw-dev:dev May 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant