Skip to content

feat: Suggest review after codding#6007

Merged
alex-alecu merged 13 commits intomainfrom
feat/suggest-review-after-code
Feb 20, 2026
Merged

feat: Suggest review after codding#6007
alex-alecu merged 13 commits intomainfrom
feat/suggest-review-after-code

Conversation

@alex-alecu
Copy link
Contributor

@alex-alecu alex-alecu commented Feb 19, 2026

Context

Suggest code review mode after implementation.

This feature will be ported to the new CLI & VS Code too. It provides great opportunity for the next few weeks to increase week-over-week users for code review NOW.

Initially I had implemented "Clear context and start review" , but the review mode always starts in a new session. No point in developing more for this version since it will be sunset soon.

Implementation

Flow

  1. After a coding task completes (AttemptCompletionTool.ts:32-41), getCompletionSuggestions() checks the task mode. If code or orchestrator, it returns a single suggestion: { answer: "Start code review", mode: "review" }.

  2. The suggestion is serialized (AttemptCompletionTool.ts:186-188) as JSON.stringify({ suggest: [...] }) and passed as the text payload of the completion_result ask.

  3. ChatRow parses and renders it (ChatRow.tsx:462-468). The completionSuggestions memo extracts the suggest array from the JSON text. If suggestions exist, a FollowUpSuggest component renders clickable buttons (ChatRow.tsx:1819-1830). A guard at line 1832 prevents raw JSON from being rendered as markdown.

  4. When the user clicks "Start code review" (ChatView.tsx:1383-1397):

    • Sends askResponse: "yesButtonClicked" to close the pending completion_result ask (which causes the AttemptCompletionTool to return cleanly)
    • Calls setMode("review") to update local UI state
    • Sends { type: "mode", text: "review", reviewScope: "uncommitted" } to the backend
  5. Backend handles the mode switch (webviewMessageHandler.ts:1847-1852ClineProvider.handleModeSwitch:1420-1509):

    • Updates the mode on the existing task and global state
    • Because reviewScope: "uncommitted" is provided, it calls handleReviewScopeSelected("uncommitted") directly, skipping the scope selection dialog
    • handleReviewScopeSelected calls createTask() with a review prompt, which implicitly destroys the old task via removeClineFromStack()

Edge cases handled

  • Shift+click: Returns early (no-op) — review suggestions can't be appended to the text area
  • Auto-trigger without alwaysAllowModeSwitch: Silently ignored, the completion_result ask remains open for manual interaction
  • Non-code/orchestrator modes (review, architect, debug, etc.): No suggestions are generated

Screenshots

Screenshot 2026-02-19 at 13 50 56

How to Test

Implement something in code mode and look for the suggestions at the end.

Get in Touch

We'd love to have a way to chat with you about your changes if necessary. If you're in the Kilo Code Discord, please share your handle here.

@alex-alecu alex-alecu self-assigned this Feb 19, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: ce64079

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

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 19, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
webview-ui/src/components/chat/ChatView.tsx 1400 Race condition: hardcoded setTimeout(100) between clearTask and mode switch. If clearTask takes longer than 100ms, the mode switch fires before the task is fully cleared, potentially causing stale task updates or conflicting createTask calls.
Other Observations (not in diff)

No additional issues found outside the diff.

Files Reviewed (11 files)
  • .changeset/code-orchestrator-review-suggestions.md - 0 issues
  • packages/types/src/followup.ts - 0 issues
  • src/core/tools/AttemptCompletionTool.ts - 0 issues
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts - 0 issues
  • src/core/webview/ClineProvider.ts - 0 issues
  • src/core/webview/__tests__/ClineProvider.spec.ts - 0 issues
  • src/core/webview/webviewMessageHandler.ts - 0 issues
  • webview-ui/src/components/chat/ChatRow.tsx - 0 issues
  • webview-ui/src/components/chat/ChatView.tsx - 1 issue
  • webview-ui/src/components/chat/__tests__/ChatRow.completion-suggestions.spec.tsx - 0 issues
  • webview-ui/src/components/chat/__tests__/ChatView.completion-suggestions.spec.tsx - 0 issues

Fix these issues in Kilo Cloud

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 19, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

This PR adds post-completion suggestions to start a code review after code and orchestrator mode tasks. The implementation is clean and well-structured:

  • Backend: getCompletionSuggestions() generates mode-specific suggestions, serialized as JSON in the completion_result ask text. The handleModeSwitch method now accepts an optional reviewScope parameter to skip the scope dialog.
  • Frontend: ChatRow parses suggestions via safeJsonParse and renders them using FollowUpSuggest. ChatView handles the review suggestion click by closing the pending ask, updating local mode state, and sending a mode message with reviewScope: "uncommitted".
  • Message handler: Passes reviewScope through to handleModeSwitch.
  • i18n: New suggestions.start_code_review key added across all 22 locales.
  • Tests: Comprehensive test coverage for getCompletionSuggestions, ClineProvider.handleModeSwitch with/without reviewScope, ChatRow suggestion rendering, and ChatView suggestion click handling.

Previously flagged issues from earlier review rounds have been addressed:

  • The review-mode intercept is now properly scoped with clineAsk === "completion_result" guard
  • The JSON guard uses safeJsonParse(message.text) !== undefined (correct check)
  • Suggestion text is localized via t()
  • Arabic locale duplicate openAiCodex block has been cleaned up
Files Reviewed (33 files)
  • .changeset/code-orchestrator-review-suggestions.md
  • src/core/tools/AttemptCompletionTool.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
  • src/core/webview/ClineProvider.ts
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/webviewMessageHandler.ts
  • src/i18n/locales/ar/common.json
  • src/i18n/locales/ca/common.json
  • src/i18n/locales/cs/common.json
  • src/i18n/locales/de/common.json
  • src/i18n/locales/en/common.json
  • src/i18n/locales/es/common.json
  • src/i18n/locales/fr/common.json
  • src/i18n/locales/hi/common.json
  • src/i18n/locales/id/common.json
  • src/i18n/locales/it/common.json
  • src/i18n/locales/ja/common.json
  • src/i18n/locales/ko/common.json
  • src/i18n/locales/nl/common.json
  • src/i18n/locales/pl/common.json
  • src/i18n/locales/pt-BR/common.json
  • src/i18n/locales/ru/common.json
  • src/i18n/locales/sk/common.json
  • src/i18n/locales/th/common.json
  • src/i18n/locales/tr/common.json
  • src/i18n/locales/uk/common.json
  • src/i18n/locales/vi/common.json
  • src/i18n/locales/zh-CN/common.json
  • src/i18n/locales/zh-TW/common.json
  • webview-ui/src/components/chat/ChatRow.tsx
  • webview-ui/src/components/chat/ChatView.tsx
  • webview-ui/src/components/chat/__tests__/ChatRow.completion-suggestions.spec.tsx
  • webview-ui/src/components/chat/__tests__/ChatView.completion-suggestions.spec.tsx

@alex-alecu alex-alecu enabled auto-merge February 19, 2026 14:00
@alex-alecu alex-alecu force-pushed the feat/suggest-review-after-code branch from ea76066 to ce64079 Compare February 20, 2026 12:16
@alex-alecu alex-alecu merged commit b21e4f2 into main Feb 20, 2026
9 checks passed
@alex-alecu alex-alecu deleted the feat/suggest-review-after-code branch February 20, 2026 12:25
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.

2 participants