Summary
Channel conversation persistence can write in-flight channel events into the wrong workspace when the active workspace changes while events are still being processed.
Problem
The channel conversation persistence subscriber persists DomainEvent::ChannelMessageReceived and DomainEvent::ChannelMessageProcessed into a workspace-backed JSONL store, but those event payloads do not carry workspace identity. The subscriber therefore relies on process-level workspace state or the workspace captured during subscriber registration, which creates ambiguity across login/workspace switches.
Minimal repro shape:
- Start processing a channel message in workspace A.
- Switch login/workspace before the received/processed event is handled by the conversation persistence subscriber.
- The event can be persisted under the wrong workspace, or under a stale workspace binding, instead of the workspace that produced the event.
Environment: desktop/core event-bus flow; identified during review of #2445.
Solution (optional)
Thread explicit workspace identity through the affected DomainEvent variants and publishers, then have workspace-scoped subscribers reject or route events whose workspace identity does not match their target store. This likely needs updates around src/core/event_bus/events.rs, src/openhuman/channels/runtime/dispatch.rs, and src/openhuman/memory_conversations/bus.rs plus regression coverage for workspace switches.
Acceptance criteria
Related
Summary
Channel conversation persistence can write in-flight channel events into the wrong workspace when the active workspace changes while events are still being processed.
Problem
The channel conversation persistence subscriber persists
DomainEvent::ChannelMessageReceivedandDomainEvent::ChannelMessageProcessedinto a workspace-backed JSONL store, but those event payloads do not carry workspace identity. The subscriber therefore relies on process-level workspace state or the workspace captured during subscriber registration, which creates ambiguity across login/workspace switches.Minimal repro shape:
Environment: desktop/core event-bus flow; identified during review of #2445.
Solution (optional)
Thread explicit workspace identity through the affected
DomainEventvariants and publishers, then have workspace-scoped subscribers reject or route events whose workspace identity does not match their target store. This likely needs updates aroundsrc/core/event_bus/events.rs,src/openhuman/channels/runtime/dispatch.rs, andsrc/openhuman/memory_conversations/bus.rsplus regression coverage for workspace switches.Acceptance criteria
.github/workflows/coverage.yml).Related