Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Nov 12, 2025

Problem
“Sliding window” was used to describe both a truncation algorithm and the broader feature that first tries to condense context, only truncating when necessary. This blurred terminology made the feature harder to understand for users and contributors, and hid how it actually works.

What changed (user-facing)

  • Clear behavior: The system now explicitly “condenses first, truncates only if needed.”
  • One simple entry point: Use manageContext() for all context handling.
  • No behavior changes: Existing workflows behave the same; this is a naming/clarity cleanup only.

Benefits

  • Easier to reason about: The API and comments match what the feature actually does.
  • Simpler to use: One function to call for context handling.
  • Future friendly: Removed legacy names and paths that caused confusion.

Details (for maintainers)

Telemetry and compatibility

Release note
Context handling is clearer: the system condenses first and truncates only if needed, via a single API manageContext(). No changes required on your side; reliability and telemetry remain the same.

Maintainers
Repo requested a changeset:
pnpm changeset

…and sliding-window shim

- Canonical module: [src/core/context-management/index.ts](src/core/context-management/index.ts:1)
- Canonical API: [manageContext()](src/core/context-management/index.ts:99)
- Types: [ContextManagementOptions](src/core/context-management/index.ts:75), [ContextManagementResult](src/core/context-management/index.ts:91)
- Removed shim: src/core/sliding-window
- Telemetry unchanged: [SLIDING_WINDOW_TRUNCATION](packages/types/src/telemetry.ts:40) and [truncateConversation()](src/core/context-management/index.ts:54) emits event
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 12, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. No issues found.

This PR successfully renames the sliding-window module to context-management with updated API names while preserving all functionality. The refactoring is clean with proper import updates, consistent type definitions, and maintained test coverage.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph changed the title Context Management: canonicalize API, purge legacy names Context Management: canonicalize API and terminology; remove legacy sliding-window naming and shim Nov 12, 2025
@hannesrudolph hannesrudolph changed the title Context Management: canonicalize API and terminology; remove legacy sliding-window naming and shim Simpler context handling: condense first, truncate only if needed — clear API, no behavior changes Nov 12, 2025
@hannesrudolph hannesrudolph changed the title Simpler context handling: condense first, truncate only if needed — clear API, no behavior changes Rename sliding-window -> context-management; replace truncateConversationIfNeeded with manageContext (no behavior changes) Nov 12, 2025
@hannesrudolph hannesrudolph changed the title Rename sliding-window -> context-management; replace truncateConversationIfNeeded with manageContext (no behavior changes) Rename sliding-window to context-management; replace truncateConversationIfNeeded with manageContext (no behavior changes) Nov 12, 2025
@hannesrudolph hannesrudolph changed the title Rename sliding-window to context-management; replace truncateConversationIfNeeded with manageContext (no behavior changes) rename: sliding-window -> context-management; truncateConversationIfNeeded -> manageContext Nov 12, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Nov 12, 2025
Copy link
Collaborator Author

@hannesrudolph hannesrudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention:

P2: Update the misleading comment in Task.ts to match manageContext behavior (condense-first, truncate as fallback).
P2: Clamp allowedTokens to >= 0 in context-management/index.ts to avoid over-truncation when reservedTokens is large relative to a small contextWindow.

Context-management unit tests pass locally after the clamp.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 13, 2025
@mrubens mrubens merged commit bb6cac4 into main Nov 13, 2025
21 checks passed
@mrubens mrubens deleted the feat/context-management-canonicalization branch November 13, 2025 03:16
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 13, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Nov 13, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 13, 2025
* Add Intercom as a subprocessor (RooCodeInc#8718)

* web: Leftover white bg (RooCodeInc#8719)

Leftover white bg

* feat(zgsm): add supportsMaxTokens flag and adjust max token handling

* docs: update Configuring Profiles video link (RooCodeInc#8189)

Co-authored-by: Roo Code <[email protected]>

* Fix link text for Roomote Control in README (RooCodeInc#8742)

* Try a 5s status mutation timeout (RooCodeInc#8734)

* web: Landing page for the reviewerFirst pass (RooCodeInc#8740)

* First pass

* SEO

* Update a