Skip to content

Conversation

@roomote
Copy link
Contributor

@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 cte, jr and mrubens 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
@daniel-lxs
Copy link
Member

Closing in favor of #6160

@daniel-lxs daniel-lxs closed this Jul 28, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jul 28, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 28, 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

Archived in project

Development

Successfully merging this pull request may close these issues.

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

4 participants