Conversation
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.
Problem / pressure
Lody's session orchestration currently reaches through
SessionDocumentand Loro-specific history details while also coordinating queue promotion, steer delivery, ACP streaming, Edit & Resend, and session shutdown. Adding Roost for future new sessions without an explicit boundary would duplicate those rules in the adapter and would make retries, late provider output, and partial writes difficult to recover safely.The change must preserve the existing logical session contract while allowing old sessions to remain Loro-backed and leaving Roost disabled until its adapter is ready. It must also avoid changing the current user-visible queue, steer, streaming, edit, or message-order behavior.
Summary
SessionBackendcontract and per-session backend factory. Missing discriminators continue to meanloro, and the current new-session selector remainsloro.prepared,history_accepted,activation_published, andqueue_consumedrecovery states.Visual explanation
The queue promotion path now has a stable operation identity and durable recovery points. A retry resumes the first missing stage instead of appending another logical turn.
sequenceDiagram participant W as Dispatch watcher participant B as SessionBackend participant C as Loro control metadata participant H as Loro history participant Q as Message queue W->>B: promoteQueuedTurn(item, entry, operationId) B->>C: record prepared B->>H: accept user turn if absent B->>C: record history_accepted B->>C: publish activation B->>C: record activation_published B->>Q: consume exact queue row B->>C: record queue_consumed Note over W,C: A retry reuses operationId and completes only missing stagesBefore / after
SessionBackend; storage-specific readers, writers, and segments stay behind the backend.SessionDataimplementation.Test plan
git diff --checkpassed.errors: [].pnpm checkwas not run becausepnpmis unavailable in the environment.This change does not benchmark or optimize long-conversation performance. It keeps the existing Loro path and user-visible behavior unchanged; performance comparison is a later adapter validation step after Roost exists.