Skip to content

feat: implement automatic temperature reduction on tool failure #6158

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Jul 24, 2025

Summary

This PR implements automatic temperature reduction when tool use fails, as requested in issue #6156.

Changes

  • Added temperature tracking properties to the Task class:

    • currentTemperature: Tracks the current temperature value
    • originalTemperature: Stores the initial temperature for restoration
    • temperatureReductionAttempts: Counts reduction attempts (max 3)
    • shouldRetryWithReducedTemperature: Flag to trigger temperature reduction
  • Implemented temperature reduction logic:

    • When a tool fails, the temperature is reduced by a factor of 0.5
    • The system retries up to 3 times with progressively lower temperatures
    • Temperature information is included in error messages for transparency
  • Added comprehensive test coverage:

    • Tests for temperature tracking and initialization
    • Tests for reduction logic and retry mechanism
    • Tests for maximum attempt limits
    • Tests for edge cases (zero temperature, restoration)

Testing

All tests pass successfully. The new test file Task.temperature.spec.ts provides comprehensive coverage of the temperature reduction functionality.

Related Issue

Fixes #6156


Important

Implements automatic temperature reduction on tool failure in Task class, with retries and comprehensive test coverage.

  • Behavior:
    • Implements automatic temperature reduction in Task class when tool use fails, reducing by 0.5 factor, retrying up to 3 times.
    • Includes temperature in error messages in presentAssistantMessage().
  • Properties:
    • Adds currentTemperature, originalTemperature, temperatureReductionAttempts, shouldRetryWithReducedTemperature to Task.
  • Functions:
    • Modifies attemptApiRequest() to accept temperature override.
    • Adds retryWithReducedTemperature() to handle retry logic.
    • Updates recordToolError() to set retry flag.
  • Testing:
    • Adds Task.temperature.spec.ts for testing temperature reduction logic, covering initialization, reduction, retry limits, and edge cases.

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

- Add temperature tracking properties to Task class
- Implement temperature reduction logic with configurable factor (0.5)
- Add retry mechanism when tools fail, reducing temperature up to 3 times
- Include temperature information in error messages
- Add comprehensive test coverage for temperature reduction functionality

Fixes #6156
@roomote roomote bot requested review from mrubens, cte and jr as code owners July 24, 2025 08:36
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Jul 24, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 24, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 25, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR - Needs Preliminary Review size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: PR [Needs Prelim Review]
Development

Successfully merging this pull request may close these issues.

Add automatic temperature reduction and retry for tool failures caused by high temperature settings
2 participants