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
Each chat turn loaded the chat's full transcript through resolveOrCreateChat just to read the MCP server ids earlier user messages were tagged with. resolveOrCreateChat now never loads the transcript, and a new loadChatMcpServerIds reads only the MCP context ids with one jsonb query, in the same first-tagged order
Split the chat loaders: getAccessibleCopilotChatDetail (row plus authorization, no transcript) backs both resolveOrCreateChat and getAccessibleCopilotChatWithMessages. Dropped the includeTranscript option and the conversationHistory field, which nothing read
Client: a completed event for the viewer's own live stream no longer refetches the chat detail, because the client's own stream finalization already refetches it. renamed marks the detail stale without refetching; the lists that show titles still refetch
Type of Change
Improvement
Testing
New chat-mcp-servers.integration.ts (real Postgres), 5 tests:
servers from earlier turns match the old transcript-based collection
ordering follows seq
malformed contexts are ignored
a deleted message's server is not inherited
no cross-chat reads
Mutating each query guard turns the matching test red
Chat-events hook tests use a real QueryClient and count actual detail fetches. The own-stream-completion and rename tests fail on the old code; another viewer's completion still refetches
Type-check, lint, check:audits, and the mothership chat, v2 chat, and inbox unit suites pass
[Medium risk] Refactors chat transcript loading to avoid full reloads.
The PR appears safe to merge; no new actionable issue or outstanding previous finding was identified.
Summary
The PR avoids loading the full transcript when resolving a chat, reads only previously tagged MCP server IDs, and reduces redundant chat-detail refetches on completion and rename.
Adds PostgreSQL coverage for MCP server inheritance and ordering.
Adds client tests for status-event cache behavior and stream finalization.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Resolve authorized chat detail] --> B[Load prior MCP server IDs]
B --> C[Build current turn payload]
D[Completed status event] --> E[Mark local optimistic detail stale]
E --> F[Stream finalization refetches saved detail]
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
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
resolveOrCreateChatjust to read the MCP server ids earlier user messages were tagged with.resolveOrCreateChatnow never loads the transcript, and a newloadChatMcpServerIdsreads only the MCP context ids with one jsonb query, in the same first-tagged ordergetAccessibleCopilotChatDetail(row plus authorization, no transcript) backs bothresolveOrCreateChatandgetAccessibleCopilotChatWithMessages. Dropped theincludeTranscriptoption and theconversationHistoryfield, which nothing readcompletedevent for the viewer's own live stream no longer refetches the chat detail, because the client's own stream finalization already refetches it.renamedmarks the detail stale without refetching; the lists that show titles still refetchType of Change
Testing
chat-mcp-servers.integration.ts(real Postgres), 5 tests:seqQueryClientand count actual detail fetches. The own-stream-completion and rename tests fail on the old code; another viewer's completion still refetchescheck:audits, and the mothership chat, v2 chat, and inbox unit suites passChecklist