Skip to content

feat: Suggest code review after implementation#6404

Open
alex-alecu wants to merge 7 commits intomainfrom
feat/suggest-code-review
Open

feat: Suggest code review after implementation#6404
alex-alecu wants to merge 7 commits intomainfrom
feat/suggest-code-review

Conversation

@alex-alecu
Copy link
Contributor

Context

Port old VS Code feature #6007 to new CLI & VS Code

Add a backend review follow-up after completed implementation turns, preserving the legacy “review next” intent in the rebuilt question-driven architecture.

Implementation

  • Added ReviewFollowup in packages/opencode/src/kilocode/review-followup.ts to ask a single action (Start code review) via Question.ask.
  • Wired it into SessionPrompt.loop in packages/opencode/src/session/prompt.ts with shouldAskReviewFollowup(...), scoped to completed code/orchestrator turns.
  • Added guardrails to skip non-implementation turns and avoid conflicting with existing plan_exit follow-up logic.
  • On accept, injects a synthetic review kickoff prompt from Review.buildReviewPromptUncommitted() and continues the same session loop immediately.
  • Added tests for trigger detection and accepted/dismissed behavior in packages/opencode/test/kilocode/review-followup*.test.ts.

Screenshots

before after
N/A N/A

How to Test

  • bun test test/kilocode/review-followup*.test.ts (from packages/opencode/)
  • bun test test/kilocode/plan-exit-detection.test.ts (from packages/opencode/)

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 26, 2026
…g/kilocode into feat/suggest-code-review

# Conflicts:
#	packages/kilo-vscode/src/services/cli-backend/types.ts
#	packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx
…ng context

- Make review prompt blocking in CLI (Flag.KILO_CLIENT !== 'vscode'), non-blocking in VS Code
- Add 'Continue without review' skip option to dismiss the review suggestion
- Add hasPlanningContext() gate: only prompt after plan_exit or cross-session handover
- Extract PLAN_PREFIX constant in plan-followup.ts for reuse in detection
- Forward blocking field in VS Code SSE→webview mapper (kilo-provider-utils.ts)
- Add tests for plan context detection (same-session and cross-session)
- Remove stale duplicate kilocode_change end marker in prompt.ts
@alex-alecu alex-alecu marked this pull request as ready for review March 9, 2026 08:58
const sessionPermissions = () => session.permissions().filter((p) => p.sessionID === id())

const questionRequest = () => sessionQuestions().find((q) => !q.tool)
const questionRequest = () => blockingQuestions()[0] ?? nonBlockingQuestions()[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: Tool-attached questions will now render twice

AssistantMessage already renders questions with a tool context inline next to the originating tool call. Because this selector no longer keeps the !q.tool guard, those same questions can also appear in the bottom dock, which duplicates the UI and can surface the wrong prompt when both tool and session questions are pending.

const answer = answers?.[0]?.[0]?.trim()
if (answer !== ANSWER_START) return "break"

const text = await Review.buildReviewPromptUncommitted()
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: New-file-only changes are missed by the auto-review

Review.buildReviewPromptUncommitted() is backed by git diff HEAD, which ignores untracked files. If the implementation creates a brand-new file and nothing else, accepting this follow-up produces a "No changes detected" review even though the worktree still has uncommitted changes.


const list = await Question.list()
expect(list).toHaveLength(1)
expect(list[0]?.blocking).toBe(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: This test depends on an env var it never sets

ReviewFollowup.ask() only sets blocking: false when Flag.KILO_CLIENT === "vscode", but Flag.KILO_CLIENT defaults to "cli" and this package's test script does not override it. In a normal bun test run this assertion fails unless another test has already mutated process.env.KILO_CLIENT.

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 9, 2026

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx 33 Tool-linked questions are no longer filtered out of the bottom dock, so they can render twice alongside the inline assistant-message prompt.
packages/opencode/src/kilocode/review-followup.ts 91 The automatic "uncommitted changes" review relies on git diff HEAD, which skips untracked files and can report "No changes detected" for new-file-only work.
packages/opencode/test/kilocode/review-followup.test.ts 117 The test assumes KILO_CLIENT is vscode, but the default is cli and the package test script does not set that env var.
Other Observations (not in diff)

No additional issues found outside the diff.

Files Reviewed (14 files)
  • packages/kilo-vscode/src/kilo-provider-utils.ts - 0 issues
  • packages/kilo-vscode/src/services/cli-backend/types.ts - 0 issues
  • packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/types/messages.ts - 0 issues
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx - 0 issues
  • packages/opencode/src/cli/cmd/tui/routes/session/question.tsx - 0 issues
  • packages/opencode/src/kilocode/plan-followup.ts - 0 issues
  • packages/opencode/src/kilocode/review-followup.ts - 1 issue
  • packages/opencode/src/question/index.ts - 0 issues
  • packages/opencode/src/session/prompt.ts - 0 issues
  • packages/opencode/test/kilocode/review-followup-detection.test.ts - 0 issues
  • packages/opencode/test/kilocode/review-followup.test.ts - 1 issue
  • packages/opencode/test/question/question.test.ts - 0 issues
  • packages/sdk/js/src/v2/gen/types.gen.ts - 0 issues

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.

1 participant