improvement(chat): stop reloading the full transcript on every turn and event
Merged
WA
1mo ago+465+465+012345678901234567890123456789-182-182-012345678901234567890123456789
Summary
- Each chat turn loaded the chat's full transcript through
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 order - Split the chat loaders:
getAccessibleCopilotChatDetail(row plus authorization, no transcript) backs bothresolveOrCreateChatandgetAccessibleCopilotChatWithMessages. Dropped theincludeTranscriptoption and theconversationHistoryfield, which nothing read - Client: a
completedevent 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 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
QueryClientand 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
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)