Add shell snapshot queries for orchestration state - #1973
Merged
Conversation
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.
Summary
Testing
bun fmtbun lintbun typecheckbun run testNote
High Risk
High risk because it changes the orchestration WebSocket contract (replacing snapshot/replay/domain-event flows with
subscribeShell/subscribeThread) and adds new projection-derived persisted summary columns that affect read-model correctness and client state sync.Overview
Introduces lightweight orchestration “shell” reads and streaming updates. The server adds
ProjectionSnapshotQuery.getShellSnapshot,getProjectShellById,getThreadShellById, andgetThreadDetailById, plus WS RPCsorchestration.subscribeShell(snapshot + incremental shell events) andorchestration.subscribeThread(per-thread detail snapshot + live thread events), removing the priorgetSnapshot/replay/domain-event subscription usage in the WS layer.Persists and maintains per-thread shell summary fields. The projection pipeline now derives and stores
latestUserMessageAt, pending approval/user-input counts, and actionable proposed-plan state into newprojection_threadscolumns (migration023_ProjectionThreadShellSummary), and refreshes these on relevant thread events.Updates the web client to consume shell snapshots and opt-in thread detail. Client runtime replaces snapshot/replay recovery with shell subscription bootstrapping, applies shell events into the store via new
syncServerShellSnapshot/applyShellEvent, adds targeted thread detail syncing viasyncServerThreadDetail, and keeps active thread detail subscriptions warm withretainThreadDetailSubscription(idle eviction + capped cache). Authentication gate handling is adjusted to rely on router context, and tests are updated/added accordingly.Reviewed by Cursor Bugbot for commit fa28310. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace orchestration snapshot/replay RPC with shell snapshot stream subscriptions
getSnapshot,replayEvents, andonDomainEventfrom the orchestration WebSocket surface and replaces them withsubscribeShellandsubscribeThreadstreaming endpoints defined in contracts/src/orchestration.ts and rpc.ts.getShellSnapshot,getProjectShellById,getThreadShellById, andgetThreadDetailByIdtoProjectionSnapshotQuery, backed by new SQL queries in ProjectionSnapshotQuery.ts.latestUserMessageAt,pendingApprovalCount,pendingUserInputCount,hasActionableProposedPlan) on relevant events; migration 023_ProjectionThreadShellSummary.ts adds these columns toprojection_threads.ChatViewretains a subscription while a server thread is viewed.getSnapshot,replayEvents, andonDomainEventare fully removed; any client that has not migrated tosubscribeShell/subscribeThreadwill break.Macroscope summarized fa28310.