You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prevent channel conversation events from persisting to the wrong workspace #18
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 tinyhumansai#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
Repro gone — Channel conversation events are persisted only to the workspace that produced the event, even if login/workspace changes before subscriber handling.
Regression safety — Unit or integration coverage exercises received and processed channel events across a workspace switch/stale subscriber scenario.
Diff coverage ≥ 80% — the fix PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by .github/workflows/coverage.yml).
Event contract documented — Workspace-bearing domain events document how publishers and subscribers should route or reject stale workspace events.
Activity