Skip to content

Conversation

@hassoncs
Copy link
Contributor

@hassoncs hassoncs commented Jul 25, 2025

So users to don't have to race against the clock to type their message

Fixes: #1262
Roo PR: RooCodeInc/Roo-Code#6226

2025-07-25 15 14 15

Summary by CodeRabbit

  • New Features
    • Auto-approval timer for follow-up suggestions is now canceled if a suggestion is edited, ensuring changes are not auto-approved unintentionally.

@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2025

🦋 Changeset detected

Latest commit: a5f8014

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Walkthrough

A patch was introduced to cancel the auto-approve timer when a user clicks the edit button on a follow-up suggestion. The logic updates the internal state to reflect the selection and invokes a callback to stop the timer, ensuring auto-approval does not proceed while editing.

Changes

File(s) Change Summary
.changeset/kind-horses-sniff.md Added a changeset describing the new patch for canceling auto-approve on editing suggestions.
webview-ui/src/components/chat/FollowUpSuggest.tsx Enhanced edit button logic to update state and invoke a callback to cancel auto-approval timer.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FollowUpSuggest
    participant AutoApproveTimer

    User->>FollowUpSuggest: Clicks "Edit" on suggestion
    FollowUpSuggest->>AutoApproveTimer: onCancelAutoApproval()
    AutoApproveTimer-->>FollowUpSuggest: Timer canceled
    FollowUpSuggest->>FollowUpSuggest: Set suggestionSelected = true
    FollowUpSuggest->>FollowUpSuggest: Simulate shift-click to onSuggestionClick
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

In the meadow of code where suggestions bloom bright,
A timer once ticked, causing some fright.
But now with a click, the countdown is gone—
Edit in peace, the pressure withdrawn!
🐇✨
Hopping along, we fix with delight,
Making user experience just right.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

webview-ui/src/components/chat/FollowUpSuggest.tsx

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-edit-question-doesnt-cancel-timer

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hassoncs hassoncs force-pushed the fix-edit-question-doesnt-cancel-timer branch from e141c14 to 614d78c Compare July 25, 2025 22:21
@hassoncs hassoncs force-pushed the fix-edit-question-doesnt-cancel-timer branch from 614d78c to a5f8014 Compare July 25, 2025 22:21
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
webview-ui/src/components/chat/FollowUpSuggest.tsx (1)

137-139: Logic correctly addresses the timer racing issue, but missing coding guideline compliance.

The implementation properly cancels the auto-approve timer when editing by setting suggestionSelected to true and calling the onCancelAutoApproval callback. This mirrors the existing logic in handleSuggestionClick and effectively prevents the race condition described in issue #1262.

However, the coding guidelines require adding kilocode_change comments for TSX files.

Apply this diff to comply with coding guidelines:

-					// Cancel the auto-approve timer when edit button is clicked
-					setSuggestionSelected(true)
-					onCancelAutoApproval?.()
+					// Cancel the auto-approve timer when edit button is clicked {/* kilocode_change start */}
+					setSuggestionSelected(true)
+					onCancelAutoApproval?.() {/* kilocode_change end */}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57717ec and a5f8014.

📒 Files selected for processing (2)
  • .changeset/kind-horses-sniff.md (1 hunks)
  • webview-ui/src/components/chat/FollowUpSuggest.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/!(*kilocode*)/**/*.{ts,tsx,js,jsx,html,css,scss}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

**/!(*kilocode*)/**/*.{ts,tsx,js,jsx,html,css,scss}: For single line changes, add the comment '// kilocode_change' at the end of the line.
For multiple consecutive lines changed, wrap them with '// kilocode_change start' and '// kilocode_change end' comments.

Files:

  • webview-ui/src/components/chat/FollowUpSuggest.tsx
**/!(*kilocode*)/**/*.{html,jsx,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

In HTML/JSX/TSX files, use '{/* kilocode_change start /}' and '{/ kilocode_change end */}' to wrap multi-line changes.

Files:

  • webview-ui/src/components/chat/FollowUpSuggest.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: storybook-playwright-snapshot
  • GitHub Check: test-extension (windows-latest)
  • GitHub Check: test-webview (windows-latest)
  • GitHub Check: compile
🔇 Additional comments (1)
.changeset/kind-horses-sniff.md (1)

1-6: Well-structured changeset documentation.

The changeset properly documents this patch-level fix with a clear, descriptive title that matches the PR objectives. The format follows changeset conventions correctly.

@hassoncs
Copy link
Contributor Author

Closing this since it merged on the Roo side! 🎉

@hassoncs hassoncs closed this Jul 25, 2025
@hassoncs hassoncs deleted the fix-edit-question-doesnt-cancel-timer branch August 5, 2025 16:21
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.

Minor issue with auto-selecting answer

2 participants