-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(condense v2.1): add smart code folding #10942
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
base: main
Are you sure you want to change the base?
Conversation
Re-review complete. No new issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Fixed the reported issue. Tree-sitter error strings are now skipped instead of embedded in folded file context. All local checks passed. |
cccc2ff to
f4c395b
Compare
daniel-lxs
left a comment
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.
Looks good!
-Sent from Dan's agent
|
One concern - did you test or research if all providers handle multiple text blocks in a single message content array properly? Some providers might have issues with this structure. |
I verified this works correctly. For user messages (which the summary is), the format converter preserves the array structure: The .join("\n") behavior only applies to assistant messages. All providers properly receive multiple text blocks in user messages. |
…ntent (#10942) The Bedrock fix in getMessagesSinceLastSummary prepends messages[0] when the summary has assistant role, but it didn't check if messages[0] had a condenseParent (was already condensed). This caused previously-condensed content to incorrectly appear in the active context during nested condense operations. Added check for condenseParent on originalFirstMessage before prepending it. When the original message was already condensed, we now create a synthetic user message instead to maintain proper alternation.
…ntent (#10942) The Bedrock fix in getMessagesSinceLastSummary prepends messages[0] when the summary has assistant role, but it didn't check if messages[0] had a condenseParent (was already condensed). This caused previously-condensed content to incorrectly appear in the active context during nested condense operations. Added check for condenseParent on originalFirstMessage before prepending it. When the original message was already condensed, we now create a synthetic user message instead to maintain proper alternation.
1b12051 to
9a16603
Compare
…ntent (#10942) The Bedrock fix in getMessagesSinceLastSummary prepends messages[0] when the summary has assistant role, but it didn't check if messages[0] had a condenseParent (was already condensed). This caused previously-condensed content to incorrectly appear in the active context during nested condense operations. Added check for condenseParent on originalFirstMessage before prepending it. When the original message was already condensed, we now create a synthetic user message instead to maintain proper alternation.
9a16603 to
8834ffe
Compare
697022d to
5b3cb96
Compare
At context condensation time, use tree-sitter to generate folded code signatures (function definitions, class declarations) for files read during the conversation. Each file is included as its own <system-reminder> block in the condensed summary, preserving structural awareness without consuming excessive tokens. - Add getFilesReadByRoo() method to FileContextTracker - Create generateFoldedFileContext() using tree-sitter parsing - Update summarizeConversation() to accept array of file sections - Each file gets its own content block in the summary message - Add comprehensive test coverage (12 tests)
- Add isTreeSitterErrorString helper to detect error messages - Skip files that return error strings instead of embedding them - Add test for error string handling
…on() - Update summarizeConversation() to accept filesReadByRoo, cwd, rooIgnoreController instead of pre-generated sections - Move folded file context generation inside summarizeConversation() (lines 319-339) - Update ContextManagementOptions type and manageContext() to pass new parameters - Remove generateFoldedFileContext from Task.ts imports - folding now handled internally - Update all tests to use new parameter signature - Reduces Task.ts complexity by moving folding logic to summarization module
Files are now sorted by roo_read_date descending before folded context generation, so if the character budget runs out, the most relevant (recently read) files are included and older files are skipped.
- Convert summarizeConversation to use options object instead of 11 positional params - Extract duplicated getFilesReadByRoo error handling into helper method - Remove unnecessary re-export of generateFoldedFileContext - Update all test files to use new options object pattern
5b3cb96 to
ddfcc7e
Compare
Thank you @shariqriazz for this idea. (make sure to include this thank you in the change log and the release notes)
What This Does For You
When Roo condenses a long conversation, it now preserves a lightweight map of the files you worked on—function signatures, class declarations, type definitions—so it can continue referencing them accurately after condensing.
File Selection & Budget
Budget: ~50,000 characters total for folded file context.
Order: Files are included most recently read first. If the budget runs out, older files (read earlier in the task) are omitted—your most recent work is always preserved.
Scope: Only files Roo actually read (via tools or mentions) are included. Files you edited outside Roo, or files in the project Roo never saw, are not included.
How It Works
<system-reminder>block and appended to the condensed summary.What You'll See
After condensing, the summary includes lightweight code outlines:
Benefits
Limitations
Technical Summary
getFilesReadByRoo()returns files sorted by most recent read timestampgenerateFoldedFileContext()extracts definitions via tree-sitter with a 50k char budgetsummarizeConversation()during context condensation<system-reminder>block for high-priority retention