Skip to content

fix(memory): formalize SessionMemoryObserverActor passivation protocol (#423)#428

Merged
Aaronontheweb merged 3 commits into
devfrom
feature/formalize-memory-observer-passivation
Mar 25, 2026
Merged

fix(memory): formalize SessionMemoryObserverActor passivation protocol (#423)#428
Aaronontheweb merged 3 commits into
devfrom
feature/formalize-memory-observer-passivation

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • Fix dead-lettered SessionPhaseChanged messages — observer now handles phase notifications from the parent's TransitionTo(), entering draining mode on Passivating and resuming on abort
  • Fix mid-distillation DistillMemories dropping reply — when passivation requests distillation while an idle-triggered distillation is already in-flight, the sender is stashed and receives SessionDistillationCompleted.Empty when the in-flight work finishes (previously the parent would stall until the 5s grace period expired)
  • Prevent idle timer racing with passivationSessionPhaseChanged(Passivating) disables ReceiveTimeout, SessionPhaseChanged(Ready) re-enables it on abort
  • Replace DateTimeOffset.UtcNow with TimeProvider — inject TimeProvider into observer constructor for testable timestamps

Test plan

  • 7 observer tests pass (expanded from 2): passivation disable/re-enable, mid-distillation stash, proposal parsing, abort recovery
  • Full actor test suite (685 tests) passes
  • dotnet slopwatch analyze — no new violations
  • Build succeeds with 0 warnings, 0 errors

Closes #423

#423)

Fix four bugs in the observer's interaction with the session state machine:

- Add SessionPhaseChanged handler so phase notifications are no longer
  dead-lettered on every transition
- Fix mid-distillation DistillMemories dropping the reply (parent would
  stall until the 5s grace period expired)
- Disable observer idle timer during passivation to prevent racing with
  the explicit DistillMemories request
- Replace DateTimeOffset.UtcNow with injected TimeProvider

Expand test coverage from 2 to 7 tests covering passivation disable/re-enable,
mid-distillation stash, proposal parsing, and abort recovery.
@Aaronontheweb Aaronontheweb merged commit 6a6c927 into dev Mar 25, 2026
3 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/formalize-memory-observer-passivation branch March 25, 2026 20:37
@Aaronontheweb Aaronontheweb mentioned this pull request Mar 25, 2026
3 tasks
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.

Formalize SessionMemoryObserverActor with passivation-triggered distillation

1 participant