Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 24, 2025

This PR implements automatic temperature reduction and retry functionality when tool failures are detected due to high temperature settings.

Summary

When users have customized their temperature setting above 0.2, the AI may generate incomplete or malformed outputs that cause tool failures. This PR detects these temperature-related errors and offers users the option to automatically reduce the temperature to 0.2 and retry the operation.

Changes

  • Temperature Error Detection: Added utility to identify temperature-related failures based on error patterns
  • New ClineAsk Type: Added temperature_tool_error ask type for UI interaction
  • Tool Error Handling: Modified writeToFileTool and applyDiffTool to detect temperature errors
  • UI Handler: Added UI component in ChatView to show temperature reduction option with tooltip
  • Retry Mechanism: Implemented logic to reduce temperature to 0.2 and retry the last user request
  • Tests: Added comprehensive unit and integration tests

How it works

  1. When a tool fails with patterns indicating temperature issues (e.g., "rest of code unchanged", truncated content)
  2. AND the user has a custom temperature setting > 0.2
  3. The system shows a dialog asking if the user wants to reduce temperature to 0.2 and retry
  4. If accepted, the temperature is reduced, the failed messages are removed, and the operation is retried

Testing

  • Unit tests for temperature error detection logic
  • Integration tests for the full retry flow
  • All tests passing

Fixes #6156


Important

This PR adds functionality to detect and handle tool failures due to high temperature settings by prompting users to reduce the temperature and retry the operation.

  • Behavior:
    • Detects temperature-related tool failures in writeToFileTool and applyDiffTool.
    • Prompts user to reduce temperature to 0.2 and retry on detection.
    • Implements retry logic in webviewMessageHandler.
  • UI:
    • Adds temperature_tool_error ask type in ChatView.tsx.
    • Updates UI to show retry option with tooltip in chat.json.
  • Utilities:
    • Adds isTemperatureRelatedError() and getTemperatureErrorMessage() in temperatureErrorDetection.ts.
  • Tests:
    • Adds unit tests in temperatureErrorDetection.test.ts.
    • Adds integration tests in temperatureErrorRetry.test.ts.

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

- Add temperature error detection utility to identify temperature-related failures
- Add new "temperature_tool_error" ClineAsk type for UI interaction
- Modify writeToFileTool and applyDiffTool to detect temperature errors
- Add UI handler in ChatView to show temperature reduction option
- Implement retry mechanism that reduces temperature to 0.2 and retries
- Add comprehensive unit and integration tests

Fixes #6156
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 24, 2025 09:12
@dosubot dosubot bot added size:XL This PR changes 500-999 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 daniel-lxs moved this from PR [Needs Prelim Review] to PR [Draft / In Progress] in Roo Code Roadmap Jul 28, 2025
@daniel-lxs daniel-lxs marked this pull request as draft July 28, 2025 17:54
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 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 - Draft / In Progress size:XL This PR changes 500-999 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

3 participants