Skip to content

Conversation

@roomote
Copy link
Collaborator

@roomote roomote commented Jun 30, 2025

Summary

This PR fixes GitHub issue #5229 where profile-specific condensation thresholds were not working correctly.

Problem

When users set a condensation trigger threshold (e.g., 25%) for a specific profile in Settings->Context->Condensing Trigger Threshold, the automatic context condensation would not trigger at the specified threshold. Instead, it would fall back to the global threshold setting.

Root Cause

The bug was in src/core/task/Task.ts at line 1724. The code was using currentApiConfigName (which contains the profile name) as the key to lookup profile thresholds, but the profileThresholds object is actually keyed by profile ID. This mismatch meant the profile-specific threshold was never found.

Solution

  • Fixed the profile ID lookup by properly resolving the profile ID from the profile name
  • The fix searches through listApiConfigMeta to find the matching profile configuration and extract its ID
  • Added a comprehensive test case that reproduces the original issue and verifies the fix works correctly

Changes

Testing

  • All existing tests continue to pass
  • New test specifically reproduces the issue scenario and confirms the fix works
  • Verified that profile-specific thresholds are now properly applied instead of falling back to global defaults

Closes #5229


Important

Fixes profile-specific condensation threshold lookup in Task.ts by resolving profile ID correctly, with tests added to verify the fix.

  • Behavior:
    • Fixes profile-specific condensation threshold lookup in truncateConversationIfNeeded in Task.ts by resolving profile ID from profile name.
    • Ensures profile-specific thresholds are applied instead of falling back to global defaults.
  • Testing:
    • Adds test case in sliding-window.spec.ts to verify profile ID resolution and correct threshold application.
    • Confirms that profile-specific thresholds trigger condensation as expected.
  • Misc:

This description was created by Ellipsis for dc2b7d6. You can customize this summary. It will automatically update as commits are pushed.

- Fixed profile ID lookup bug where currentApiConfigName (profile name) was used instead of profile ID for threshold lookup
- Added comprehensive test case that reproduces the issue and verifies the fix
- The fix ensures profile-specific condensation thresholds are properly applied instead of falling back to global defaults
@roomote roomote requested review from cte, jr and mrubens as code owners June 30, 2025 10:21
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jun 30, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 30, 2025

No security or compliance issues detected. Reviewed everything up to dc2b7d6.

Security Overview
  • 🔎 Scanned files: 2 changed file(s)
Detected Code Changes

The diff is too large to display a summary of code changes.

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 30, 2025
@daniel-lxs
Copy link
Member

I think the solution on #5230 is a bit cleaner, however feel free to reopen if necessary.

@daniel-lxs daniel-lxs closed this Jun 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 30, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Profile Context Condense Threshold not working

4 participants