Skip to content
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

Fix issue #67: Retry / regenerate doesn't take you to new response #84

Closed
wants to merge 1 commit into from

Conversation

onitbot
Copy link
Collaborator

@onitbot onitbot commented Feb 19, 2025

This pull request fixes #67.

The changes directly address and resolve the reported issue through concrete code modifications:

  1. The core fix adds logic in Model+Chat.swift to remove any responses that exist after the current generation index when regenerating a response. This is implemented through:
if prompt.responses.count > 0 {
    let currentIndex = prompt.generationIndex
    prompt.responses.removeSubrange((currentIndex + 1)...)
    prompt.priorInstructions.removeSubrange((currentIndex + 1)...)
}
  1. The added test suite verifies this behavior by:
  • Creating a prompt with 3 responses
  • Setting the generation index to the middle response
  • Triggering regeneration
  • Confirming that subsequent responses are removed while preserving prior ones

The original issue occurred because old responses remained in the array after regeneration, causing navigation issues. With these changes, regenerating a response will:

  • Remove any subsequent responses
  • Add the new response at the current position
  • Ensure the user sees the new response immediately since there are no later responses to navigate through

The implementation is complete and testable, with both the core fix and verification tests included. The changes directly solve the reported navigation problem by managing the response array properly during regeneration.

Automatic fix generated by OpenHands 🙌

@onitbot onitbot requested a review from jrswanson February 19, 2025 22:56
@onitbot onitbot closed this Feb 19, 2025
@onitbot onitbot deleted the openhands-fix-issue-67 branch February 19, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retry / regenerate doesn't take you to new response
2 participants