-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix: Add skipContextCompression flag to prevent unwanted compression - Fixes #4430 #6896
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
Fix: Add skipContextCompression flag to prevent unwanted compression - Fixes #4430 #6896
Conversation
…Fixes RooCodeInc#4430 - Add skipContextCompression parameter to truncateConversationIfNeeded function - Skip context compression when flag is true, even if threshold is exceeded - Add comprehensive tests covering the skip functionality - Fixes issue where multi-file read operations triggered unwanted compression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I've reviewed the changes and found some issues that need attention. The implementation addresses the core problem but has some code quality concerns that should be resolved.
… feedback - Replace unsafe 'any' casting with proper TypeScript types - Add proper class methods for managing skip flag (setSkipNextContextCompression, getAndClearSkipContextCompression) - Clean up TruncateOptions interface by removing unused properties - Fix missing parameter extraction in truncateConversationIfNeeded function - Extend fix to handle multiple settings that could trigger unwanted compression: * maxReadFileLine - file reading settings * includeDiagnosticMessages - diagnostic settings * maxDiagnosticMessages - diagnostic settings - Add comprehensive test to verify flag is properly cleared after use - Ensure type safety and maintainability throughout the implementation Addresses all feedback from PR review for Issue RooCodeInc#4430
|
Hey @shirishgone, Thank you for your contribution. I think we should try and address the root cause of the bug rather than trying to mitigate the symptoms. The main concern is that this will prevent condensing when it's actually needed if the files read exceed the context window of the model. I'll close this PR for now, but feel free to continue the discussion. I would like to know what you think. |
…- Fixes #4430
This PR implements a
skipContextCompressionflag to prevent unwanted context compression during multi-file read operations and settings save operations. The fix addresses the issue where context compression was being triggered inappropriately, causing performance issues and unexpected behavior.Key implementation details:
skipContextCompressionparameter totruncateConversationIfNeededfunctiontrue, the function returns early without performing compression, even if the context usage exceeds the thresholdfalseReviewers should pay attention to:
Test Procedure
How I tested this implementation:
Created comprehensive unit tests covering:
truefalseAll existing tests continue to pass, ensuring no regression
How reviewers can verify:
pnpm testsrc/core/sliding-window/__tests__/context-compression-fix.test.tsskipContextCompressionparameter is properly handled in the main functionTesting environment:
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
This fix specifically addresses the performance issue mentioned in #4430 where context compression was being triggered during multi-file read operations when
maxConcurrentFileReads > 1. TheskipContextCompressionflag provides a clean way to temporarily disable compression during these operations while maintaining the existing compression logic for normal use cases.The implementation is designed to be:
Get in Touch
[email protected]
Important
Introduces
skipContextCompressionflag to control context compression, preventing unwanted compression during multi-file reads and settings operations.skipContextCompressionflag totruncateConversationIfNeededinindex.tsto prevent unwanted context compression.true, skips compression even if context usage exceeds threshold.falsevalue.Task.ts: PassesskipContextCompressionflag intruncateConversationIfNeededcalls.webviewMessageHandler.ts: Sets_skipNextContextCompressionCheckwhenmaxConcurrentFileReads > 1.context-compression-fix.test.tsfor scenarios with and without the flag.This description was created by
for eb95b87. You can customize this summary. It will automatically update as commits are pushed.