Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 3, 2025

Overview

image image image

This PR adds UI visibility for context management events (condensation and truncation) that were previously hidden from users.

Changes

User-Facing Impact

  1. In-Progress Indicator for Context Management

    • Before: Hidden - users were unaware condensation/truncation was occurring
    • After: In-progress spinner appears when context management begins
  2. Sliding Window Truncation Visibility

    • Before: No UI at all - system silently dropped messages
    • After: Truncation notification appears in chat with token counts (before → after)
  3. UI Consistency

    • Uses FoldVertical icon from lucide-react for visual consistency with condense button

Backend Coordination

Task.ts signals context management lifecycle:

  • condenseTaskContextStarted → Enables in-progress UI
  • manageContext() runs (condensation or truncation)
  • condenseTaskContextResponse → Clears in-progress state

New willManageContext() helper centralizes threshold logic to avoid duplication between Task.ts and manageContext().

Architecture

Context management events handled directly in ChatRow.tsx switch cases with focused child components:

  • InProgressRow - Shows spinner during context operations
  • CondensationResultRow - Shows condensation summary with token reduction and expandable summary
  • CondensationErrorRow - Shows error when condensation fails
  • TruncationResultRow - Shows truncation details with messages removed count

Type System

New packages/types/src/context-management.ts:

  • CONTEXT_MANAGEMENT_EVENTS array of event types
  • ContextManagementEvent union type
  • isContextManagementEvent() type guard for runtime checking

Extended ContextTruncation type with newContextTokens field.

Test Coverage

  • Type system tests in packages/types/src/__tests__/context-management.test.ts
  • Backend tests for willManageContext() in src/core/context-management/__tests__/
  • Frontend integration tests in ChatView.spec.tsx
  • Translations updated across all 18 language files

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. UI/UX UI/UX related or focused labels Dec 3, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 3, 2025

Oroocle Clock   See task on Roo Cloud

Re-review for commit 51aeabc is complete; context-management threshold handling is now centralized and covered by tests, with no net new issues identified in this update.

  • Re-review latest context management architecture and ChatView UI changes
  • Verify non-destructive truncation and rewind behavior across backend and webview
  • Confirm updated Cloud/Extension/Provider marketing pages and navigation structure
  • Monitor for any regressions in context management events after release
Previous reviews

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

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 3, 2025
@hannesrudolph hannesrudolph force-pushed the feature/unified-context-management branch from ce8f7e4 to 4384ed0 Compare December 4, 2025 21:44
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 5, 2025
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 6, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Dec 6, 2025
hannesrudolph and others added 6 commits December 7, 2025 11:58
- Consolidate all context-management UI into single module
- Add type-safe exhaustiveness checking with assertNever
- Make in-progress indicators visible for both automatic and forced context management
- Add UI for sliding window truncation (previously silent)
- Improve test coverage with comprehensive component tests
- Use consistent codicon-fold icon across all context management events
- Fix translation key references to use proper namespaced keys
- Remove unused code and improve error handling
- Consolidate contextCondense and contextManagement into unified structure
- Move shared 'tokens' key to top-level contextManagement
- Rename 'condensing' to 'inProgress' for consistency with truncation
- Update all component references to use new translation keys
- Update test mocks with new translation structure

Benefits:
- Clear hierarchical structure: contextManagement > {condensation, truncation}
- Consistent naming: both operations have 'inProgress' state
- Eliminates cross-section references (truncation using condense keys)
- Easier to extend with new context management strategies
- Update all 17 language files to use new unified structure
- Move from split contextCondense/contextManagement to single contextManagement
- Apply consistent naming: condensation.inProgress and truncation.inProgress
- All languages now follow same hierarchical structure
- Verified with find-missing-translations.js: all complete

Languages updated:
ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
This file is marked as deprecated and has been fully replaced by the new unified context-management module. Removing it resolves the knip check failure.
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@roomote
Copy link
Contributor

roomote bot commented Dec 7, 2025

Fixaroo Clock   See task on Roo Cloud

Updated PR description to match the actual code implementation. Key changes:

  • Removed outdated references to ContextManagementRow wrapper (was simplified away)
  • Updated architecture section to reflect direct handling in ChatRow.tsx with focused child components
  • Added willManageContext() helper to backend coordination section
  • Corrected icon reference to FoldVertical from lucide-react
  • Clarified test coverage locations

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 7, 2025
@mrubens mrubens merged commit 8aa1346 into main Dec 7, 2025
13 checks passed
@mrubens mrubens deleted the feature/unified-context-management branch December 7, 2025 22:43
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Dec 7, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 7, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Dec 8, 2025
* Show the prompt for image gen (RooCodeInc#9505)

* feat(chat): conditionally render UpdateTodoListToolBlock based on alwaysAllowUpdateTodoList flag

* fix(web-evals): update checkbox handler in new-run component

* Remove double todo list (RooCodeInc#9517)

* Track cloud synced messages (RooCodeInc#9518)

* 3.34.1 (RooCodeInc#9522)

* Changeset version bump (RooCodeInc#9523)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix: support reasoning_details format for Gemini 3 models (RooCodeInc#9506)

* feat: update Cerebras models (RooCodeInc#9527)

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

* fix: ensure XML parser state matches tool protocol on config update (RooCodeInc#9535)

* fix: flush LiteLLM cache when credentials change on refresh (RooCodeInc#9536)

* Add Roo Code Cloud as an imagegen provider (RooCodeInc#9528)

* fix: gracefully skip unsupported content blocks in Gemini transformer (RooCodeInc#9537)

Co-authored-by: Matt Rubens <[email protected]>

* feat: add claude-opus-4.5 to OpenRouter prompt caching and reasoning budget models (RooCodeInc#9540)

* feat: add claude-opus-4.5 to Anthropic and Vertex providers (RooCodeInc#9541)

* Release v3.34.2 (RooCodeInc#9545)

* Changeset version bump (RooCodeInc#9546)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Add support for Roo Code Cloud as an embeddings provider (RooCodeInc#9543)

* Switch from asdf to mise-en-place in bare-metal evals setup script (RooCodeInc#9548)

* feat: implement streaming for native tool calls (RooCodeInc#9542)

* Add Opus 4.5 to Claude Code provider (RooCodeInc#9560)

* Fix ask_followup_question streaming issue and add missing tool cases (RooCodeInc#9561)

* feat(auth): enhance login status logging and use dynamic plugin version

* refactor:  remove disable provider and add client id headers

* test(webview): remove disable  provider tests across multiple test files

* fix: enable caching for Opus 4.5 model (RooCodeInc#9568)

Added claude-opus-4-5-20251101 to the cache control switch statements
to enable prompt caching, matching the behavior of other Claude models.

Fixes RooCodeInc#9567

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

* feat: Add contact links to About Roo Code settings page (RooCodeInc#9570)

* feat: add contact links to About settings page

* Tweaks

* i18n

* Update webview-ui/src/components/settings/__tests__/About.spec.tsx

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

---------

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Bruno Bergher <[email protected]>
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* feat: add Claude Opus 4.5 model to Bedrock provider (RooCodeInc#9572)

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

* chore: add changeset for v3.34.3 (RooCodeInc#9578)

* Changeset version bump (RooCodeInc#9579)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix: preserve dynamic MCP tool names in native mode API history (RooCodeInc#9559)

* fix: preserve tool_use blocks in summary message during condensing with native tools (RooCodeInc#9582)

* Add support for images api (RooCodeInc#9587)

* Make it clear that BFL Flux 2 is free (RooCodeInc#9588)

* Add BFL models to openrouter (RooCodeInc#9589)

* chore: add changeset for v3.34.4 (RooCodeInc#9590)

* Changeset version bump (RooCodeInc#9591)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* feat: set native tools as default for minimax-m2 and claude-haiku-4.5 (RooCodeInc#9586)

* feat: enable multiple native tool calls per turn with failure guardrails (RooCodeInc#9273)

* feat: add Bedrock Opus 4.5 to global inference model list (RooCodeInc#9595)

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

* fix: update API handler when toolProtocol changes (RooCodeInc#9599)

* Make single file read only apply to xml tools (RooCodeInc#9600)

* Revert "Add support for Roo Code Cloud as an embeddings provider" (RooCodeInc#9602)

* feat(web-evals): enhance dashboard with dynamic tool columns and UX improvements (RooCodeInc#9592)

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

* fix(webview): pass taskId to finishSubTask when canceling or deleting tasks

* chore: add changeset for v3.34.5 (RooCodeInc#9603)

* Changeset version bump (RooCodeInc#9604)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Feature/bedrock embeddings support (RooCodeInc#9475)

* feat: add AWS Bedrock support for codebase indexing

- Add bedrock as a new EmbedderProvider type
- Add AWS Bedrock embedding model profiles (titan-embed-text models)
- Create BedrockEmbedder class with support for Titan and Cohere models
- Add Bedrock configuration support to config manager and interfaces
- Update service factory to create BedrockEmbedder instances
- Add comprehensive tests for BedrockEmbedder
- Add localization strings for Bedrock support

Closes RooCodeInc#8658

* fix: add missing bedrockOptions to loadConfiguration return type

* Fix various issues that the original PR missed.

* Remove debug logs

* Rename AWS Bedrock -> Amazon Bedrock

* Remove some 'as any's

* Revert README changes

* Add translations

* More translations

* Remove leftover code from a debugging session.

* fix: add bedrock to codebaseIndexModelsSchema and update brace-expansion override

- Add bedrock provider to codebaseIndexModelsSchema type definition to fix empty model dropdown in UI
- Update pnpm override for brace-expansion from '>=2.0.2' to '^2.0.2' to resolve ESM/CommonJS compatibility issues

* Improvements to AWS Bedrock embeddings support

- Enhanced bedrock.ts embedder implementation
- Added comprehensive test coverage in bedrock.spec.ts
- Updated config-manager.ts for better Bedrock configuration handling
- Improved service-factory.ts integration
- Updated embeddingModels.ts with Bedrock models
- Enhanced CodeIndexPopover.tsx UI for Bedrock options
- Added auto-populate test for CodeIndexPopover
- Updated pnpm-lock.yaml dependencies

* Restore openrouter config

* Remove debug log

* Fix config-manager.spec.ts unit test.

* Add translations for "optional"

* Revert unnecessary change related to open ia embedder

---------

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>
Co-authored-by: Smartsheet-JB-Brown <[email protected]>

* fix: restore content undefined check in WriteToFileTool.handlePartial() (RooCodeInc#9614)

* fix: exclude access_mcp_resource tool when MCP has no resources (RooCodeInc#9615)

* fix: prevent model cache from persisting empty API responses (RooCodeInc#9623)

* fix: update default settings for inline terminal and codebase indexing (RooCodeInc#9622)

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

* feat(mistral): add native tool calling support (RooCodeInc#9625)

* feat: wire MULTIPLE_NATIVE_TOOL_CALLS experiment to OpenAI parallel_tool_calls (RooCodeInc#9621)

* feat(bedrock): allow global inference selection when cross-region is enabled (RooCodeInc#9616)

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

* fix: defer new_task tool_result until subtask completes for native protocol (RooCodeInc#9628)

* fix: convert line_ranges strings to lineRanges objects in native tool calls (RooCodeInc#9627)

* fix: filter non-Anthropic content blocks before sending to Vertex API (RooCodeInc#9618)

* Add fine grained tool streaming for OpenRouter Anthropic (RooCodeInc#9629)

* Release v3.34.6 (RooCodeInc#9631)

* Changeset version bump (RooCodeInc#9632)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix: OpenRouter GPT-5 strict schema validation for read_file tool (RooCodeInc#9633)

* fix: create parent directories early in write_to_file to prevent ENOENT errors (RooCodeInc#9640)

* Fix openrouter tool calls (RooCodeInc#9642)

* fix(claude-code): disable native tools and temperature support (RooCodeInc#9643)

* Enable native tool calling for z.ai (RooCodeInc#9645)

* Moonshot native tool call support (RooCodeInc#9646)

* Support native tools in the anthropic provider (RooCodeInc#9644)

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

* Add 'taking you to cloud' screen after provider welcome (RooCodeInc#9652)

* chore: add changeset for v3.34.7 (RooCodeInc#9651)

* Changeset version bump (RooCodeInc#9654)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix: race condition in new_task tool for native protocol (RooCodeInc#9655)

The pendingNewTaskToolCallId was being set AFTER startSubtask() returned.
However, startSubtask() contains a 500ms delay during which the subtask
could complete. If the subtask completed during this window, completeSubtask()
would be called before pendingNewTaskToolCallId was set, causing it to
fall through to the XML protocol path and add a text message instead of
a proper tool_result block, breaking the API conversation structure.

This fix moves the pendingNewTaskToolCallId assignment to happen BEFORE
calling startSubtask(), ensuring the ID is set before the subtask starts.
If the subtask creation fails, the pending ID is cleared.

* chore: add changeset for v3.34.8 (RooCodeInc#9657)

* Changeset version bump (RooCodeInc#9658)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* feat: add model-specific tool customization via excludedTools and includedTools (RooCodeInc#9641)

* feat: add model-specific tool customization via excludedTools and includedTools

- Add excludedTools and includedTools to ModelInfo schema
- Implement applyModelToolCustomization helper to filter tools based on model config
- Integrate model tool filtering into filterNativeToolsForMode for native protocol
- Add comprehensive tests for tool customization functionality
- Wire up modelInfo through buildNativeToolsArray and Task.ts

This allows providers to override which native tools are available on a per-model basis via MODEL_DEFAULTS, enabling better control over tool selection for models with specific needs.

* feat: add customTools for opt-in only tools

- Add customTools array to ToolGroupConfig for defining opt-in only tools
- Update getToolsForMode() to exclude customTools from default tool set
- Modify applyModelToolCustomization() to include customTools only via includedTools
- Add tests for customTools functionality
- Add comprehensive documentation with usage examples

customTools allows defining tools that are NOT available by default,
even when a mode includes their group. These tools are only available
when explicitly included via a model's includedTools configuration.

This enables:
- Gradual rollout of experimental tools
- Model-specific specialized capabilities
- Safe experimentation without affecting default tool sets

* Add assertions for customTools tests per review feedback

* test: add tests for including customTools via includedTools

* Update src/core/prompts/tools/__tests__/filter-tools-for-mode.spec.ts

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* feat(web-evals): add task log viewing, export failed logs, and new run options (RooCodeInc#9637)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* Metadata‑driven subtasks (no UI changes): automatic parent resume and single‑open safety (RooCodeInc#9090)

* feat: add search_and_replace tool for batch text replacements (RooCodeInc#9549)

Co-authored-by: daniel-lxs <[email protected]>

* feat: enable native tool support for DeepSeek and Doubao models (RooCodeInc#9671)

Add supportsNativeTools: true to DeepSeek and Doubao model definitions,
enabling native OpenAI-compatible tool calling for these providers.

Both providers already extend OpenAiHandler which has built-in support
for native tools, so this change is all that's needed to enable the feature.

* feat: add native tool support to Requesty provider (RooCodeInc#9672)

- Import resolveToolProtocol and TOOL_PROTOCOL from @roo-code/types
- Add tools and tool_choice to completion params when native protocol is enabled
- Handle tool_call_partial chunks in streaming response
- Add comprehensive tests for native tool support

* Include tool format in environment details (RooCodeInc#9661)

* feat(groq): enable native tool support for models that support function calling (RooCodeInc#9673)

Co-authored-by: Matt Rubens <[email protected]>

* feat: add native tools support for OpenAI-compatible providers (RooCodeInc#9676)

Co-authored-by: Matt Rubens <[email protected]>

* feat: enable native tool calls for Vertex Gemini models (RooCodeInc#9678)

Add supportsNativeTools: true to all Gemini-based models in the Vertex
provider. The VertexHandler extends GeminiHandler which already has full
native tool handling logic implemented.

Models updated:
- gemini-3-pro-preview
- gemini-2.5-flash-preview-05-20:thinking
- gemini-2.5-flash-preview-05-20
- gemini-2.5-flash
- gemini-2.5-flash-preview-04-17:thinking
- gemini-2.5-flash-preview-04-17
- gemini-2.5-pro-preview-03-25
- gemini-2.5-pro-preview-05-06
- gemini-2.5-pro-preview-06-05
- gemini-2.5-pro
- gemini-2.5-pro-exp-03-25
- gemini-2.0-pro-exp-02-05
- gemini-2.0-flash-001
- gemini-2.0-flash-lite-001
- gemini-2.0-flash-thinking-exp-01-21
- gemini-1.5-flash-002
- gemini-1.5-pro-002
- gemini-2.5-flash-lite-preview-06-17

* fix: display install count in millions instead of thousands (RooCodeInc#9677)

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

* feat: add apply_patch native tool (RooCodeInc#9663)

Co-authored-by: daniel-lxs <[email protected]>

* feat: add debug buttons to view API and UI history (RooCodeInc#9684)

Co-authored-by: