-
Notifications
You must be signed in to change notification settings - Fork 617
perf: optimize message cache and cloning operations #1285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zhangmo8
merged 10 commits into
refactor/message-list
from
copilot/optimize-performance-points
Jan 21, 2026
Merged
perf: optimize message cache and cloning operations #1285
zhangmo8
merged 10 commits into
refactor/message-list
from
copilot/optimize-performance-points
Jan 21, 2026
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
* docs: add spec for app-settings * feat: implement chat-driven settings control with skill gating Add a safe, validated API for modifying DeepChat application settings via natural language. Settings changes are controlled by a dedicated 'deepchat-settings' skill to ensure tools are only available when contextually relevant. Key features: - Skill-gated tool injection: settings tools only appear when deepchat-settings skill is active - Safe settings apply API with Zod validation and strict allowlist - Support for toggles (sound, copy COT, chat mode) and enums (language, theme, font size) - Defense-in-depth: runtime skill verification before applying changes - Deep-linked settings navigation for unsupported/complex settings - Comprehensive test coverage for validation, mapping, and skill gating Changes: - Add ChatSettingsToolHandler with validated apply/open methods - Integrate with AgentToolManager for tool definition gating - Create deepchat-settings built-in skill with clear activation rules - Add shared types for requests/responses (chatSettings.ts) - Implement settings window navigation with SECTION_ALIASES - Add unit tests for handler and integration tests for tool gating - Translate spec documents (plan.md, spec.md, tasks.md) to Chinese - Fix type errors in getCurrentValue and OPEN_SECTION_VALUES * refactor: remove chatMode from settings control and add permission service Remove chatMode setting from the allowlist as it requires conversation-scoped updates that are better handled separately. Add permission checking for settings window opening to provide user control over settings navigation. Key changes: - Remove setChatMode tool and related schemas from ChatSettingsToolHandler - Add SettingsPermissionService for managing tool approvals (one-time and session) - Add permission check for deepchat_settings_open tool - Update PermissionHandler to handle settings permission grants - Add rememberable flag to permission request structure - Update AgentToolManager to consume approvals before opening settings - Add settingsPermissionService to main presenter index - Clear settings approvals when conversation ends - Update spec documents to reflect removed chatMode feature - Remove chatMode-related tests and types This ensures settings window opening requires explicit user approval and provides a cleaner separation of concerns for chat mode management. * docs: translate to en
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
- Add reverse index for O(1) thread lookup in messageRuntimeCache - Extract duplicate cloneMessageWithContent to shared utility - Replace JSON.parse/stringify with structuredClone - Filter before cloning in messageTruncator to avoid wasted work Co-authored-by: zhangmo8 <43628500+zhangmo8@users.noreply.github.com>
Add detailed optimization analysis document covering: - Implemented optimizations (cache, cloning, filtering) - High priority opportunities (provider consolidation, IPC batching) - Medium/low priority improvements (DB indices, token caching) - Performance metrics and recommendations Co-authored-by: zhangmo8 <43628500+zhangmo8@users.noreply.github.com>
Add user-friendly Chinese summary of optimization work Co-authored-by: zhangmo8 <43628500+zhangmo8@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review and optimize code for performance improvements
perf: optimize message cache and cloning operations
Jan 20, 2026
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.
Performance analysis identified bottlenecks in message cache lookups and object cloning during context window management.
Changes
Message Cache O(1) Lookup
Added reverse index
threadToMessagesMapto eliminate O(n) iteration inclearCachedMessagesForThread():Impact: Significant improvement for repositories with large conversation histories.
Efficient Object Cloning
JSON.parse(JSON.stringify())withstructuredClone()for 2-3x faster deep cloningcloneMessageWithContent()logic frommessageCompressorandmessageTruncatorinto shared utilityFilter-Before-Clone Optimization
Reordered operations in
messageTruncatorto avoid cloning objects that will be filtered:Documentation
docs/OPTIMIZATION_ANALYSIS.md: Technical analysis with 7+ additional optimization opportunities identified (IPC batching, provider consolidation, token caching)docs/OPTIMIZATION_SUMMARY.zh.md: Chinese summaryFiles Changed
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.sheetjs.com/usr/local/bin/node node /home/REDACTED/.local/share/pnpm/.tools/pnpm/10.13.1/bin/pnpm install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.