Skip to content

Conversation

@code-crusher
Copy link
Member

No description provided.

@matter-code-review
Copy link
Contributor

Context

Release of version 5.1.0 focusing on enhancing the code review experience through native VS Code diff integration and implementing telemetry for code generation metrics.

Implementation

Summary By MatterAI MatterAI logo

🔄 What Changed

Introduced version 5.1.0 featuring native VS Code diff viewing for pending edits, automated line-change telemetry (added/updated/deleted) sent to Matter AI API upon accepting changes, and UI enhancements for reasoning blocks including thinking-time timers and new progress indicators.

🔍 Impact of the Change

Significantly improves developer transparency by allowing side-by-side diff reviews within the editor. Provides the business with critical telemetry on AI efficiency and usage limits while improving the UX of long-running reasoning tasks.

📁 Total Files Changed

Click to Expand
File ChangeLog
Config Fetch src/core/webview/ClineProvider.ts Removed redundant line in Kilocode configuration retrieval.
Message Handler src/core/webview/webviewMessageHandler.ts Added handlers for viewPendingFileDiffs and fileEditReviewAcceptAll with API telemetry.
Diff Controller src/integrations/editor/FileEditReviewController.ts Implemented handleAcceptAll to calculate line-based diff metrics.
Version Bump src/package.json Updated extension version to 5.1.0.
Message Types src/shared/WebviewMessage.ts Added viewPendingFileDiffs to the Webview message union type.
Chat UI webview-ui/src/components/chat/ChatRow.tsx Integrated MatterProgressIndicator and updated reasoning block props.
Task Control webview-ui/src/components/chat/ChatView.tsx Fixed state management for sendingDisabled when cancelling tasks.
Progress UI webview-ui/src/components/chat/ProgressIndicator.tsx Created MatterProgressIndicator with animated dot sequence.
Style Tweak webview-ui/src/components/chat/QueuedMessages.tsx Minor CSS adjustment for queued message containers.
Reasoning Timer webview-ui/src/components/chat/ReasoningBlock.tsx Added logic to track and display elapsed 'thinking' time for AI responses.
Diff Buttons webview-ui/src/components/chat/kilocode/AcceptRejectButtons.tsx Added 'View Diff' button to trigger native VS Code diff view.
Usage Display webview-ui/src/components/kilocode/BottomApiConfig.tsx Refined monthly limit and remaining reviews display logic.

🧪 Test Added/Recommended

Recommended

  • Unit tests for handleAcceptAll in FileEditReviewController.ts to verify line count accuracy across various diff scenarios.
  • Integration tests for the fileEditReviewAcceptAll message flow to ensure telemetry is sent correctly even if the API is slow.

🔒 Security Vulnerabilities

  • Telemetry Data: The fileEditReviewAcceptAll handler sends repository names and line counts to an external API. Ensure users are aware of this telemetry per privacy policies.
  • Token Handling: The kilocodeToken is retrieved from state and sent in headers; ensure it is always handled over HTTPS (confirmed by the hardcoded URL).

Screenshots

before after
N/A N/A

How to Test

  1. Trigger a task that generates file edits.
  2. In the chat UI, click the new "View Diff" button to verify native VS Code diff windows open for all pending files.
  3. Click "Accept All" and monitor the network tab to verify a POST request to api.matterai.so with correct line counts and language metadata.
  4. Observe the reasoning block during a streaming response to see the active timer.

Get in Touch

Axon Code Discord.

Copy link
Contributor

@matter-code-review matter-code-review bot left a comment

Choose a reason for hiding this comment

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

🧪 PR Review is completed: The PR introduces diff viewing and line counting features. There is a critical logic issue in fileEditReviewAcceptAll where pending edits are cleared before being accessed for language detection. Also identified potential UI bugs in ReasoningBlock and robustness improvements for URI handling and network requests.

Skipped files
  • CHANGELOG.md: Skipped file pattern
  • webview-ui/src/i18n/locales/ar/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/ca/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/cs/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/de/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/en/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/es/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/fr/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/hi/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/id/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/it/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/ja/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/ko/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/nl/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/pl/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/pt-BR/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/ru/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/th/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/tr/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/uk/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/vi/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/zh-CN/chat.json: Skipped file pattern
  • webview-ui/src/i18n/locales/zh-TW/chat.json: Skipped file pattern
⬇️ Low Priority Suggestions (1)
src/core/webview/webviewMessageHandler.ts (1 suggestion)

Location: src/core/webview/webviewMessageHandler.ts (Lines 980-981)

🔵 Code Quality

Issue: Unnecessary as any cast on the switch case label. The WebviewMessage type definition has been updated to include viewPendingFileDiffs, so the cast suppresses valuable type checking.

Fix: Remove as any.

Impact: Improves type safety.

-  		// kilocode_change start: View pending file diffs in VS Code diff view
-  		case "viewPendingFileDiffs" as any: {
+  		// kilocode_change start: View pending file diffs in VS Code diff view
+  		case "viewPendingFileDiffs": {

Comment on lines +1505 to +1557
// Execute the accept all command and get line counters
const lineCounters = await vscode.commands.executeCommand<
{ linesAdded: number; linesUpdated: number; linesDeleted: number } | undefined
>("axon-code.fileEdit.acceptAll")

// Send line counters to server if we have data
if (
lineCounters &&
(lineCounters.linesAdded > 0 || lineCounters.linesUpdated > 0 || lineCounters.linesDeleted > 0)
) {
try {
// Get state to retrieve kilocodeToken
const state = await provider.getState()
const kilocodeToken = state.apiConfiguration?.kilocodeToken

if (!kilocodeToken) {
provider.log("KiloCode token not found, skipping line counter update")
break
}

// Get git repository info for x-axon-repo header
const { getGitRepositoryInfo } = await import("../../utils/git")
const gitInfo = await getGitRepositoryInfo(provider.cwd)
const repo = gitInfo.repositoryUrl || path.basename(provider.cwd)

// Get the primary language from the first edited file
const pendingEdits = currentTask.fileEditReviewController.getPendingEdits()
let language = "ts" // default
if (pendingEdits.size > 0) {
const firstFile = Array.from(pendingEdits.keys())[0]
const ext = path.extname(firstFile).toLowerCase()
const languageMap: Record<string, string> = {
".ts": "ts",
".tsx": "tsx",
".js": "js",
".jsx": "jsx",
".py": "py",
".java": "java",
".go": "go",
".rs": "rs",
".cpp": "cpp",
".c": "c",
".cs": "cs",
".php": "php",
".rb": "rb",
".swift": "swift",
".kt": "kt",
".dart": "dart",
".vue": "vue",
".svelte": "svelte",
}
language = languageMap[ext] || "ts"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 Logic Error

Issue: pendingEdits are retrieved after axon-code.fileEdit.acceptAll command execution. Since the accept command clears the pending edits in FileEditReviewController, pendingEdits will always be empty here, causing the language detection to always default to "ts".

Fix: Retrieve the pending edits and determine the language before executing the accept command.

Impact: Incorrect language reporting in metrics.

Suggested change
// Execute the accept all command and get line counters
const lineCounters = await vscode.commands.executeCommand<
{ linesAdded: number; linesUpdated: number; linesDeleted: number } | undefined
>("axon-code.fileEdit.acceptAll")
// Send line counters to server if we have data
if (
lineCounters &&
(lineCounters.linesAdded > 0 || lineCounters.linesUpdated > 0 || lineCounters.linesDeleted > 0)
) {
try {
// Get state to retrieve kilocodeToken
const state = await provider.getState()
const kilocodeToken = state.apiConfiguration?.kilocodeToken
if (!kilocodeToken) {
provider.log("KiloCode token not found, skipping line counter update")
break
}
// Get git repository info for x-axon-repo header
const { getGitRepositoryInfo } = await import("../../utils/git")
const gitInfo = await getGitRepositoryInfo(provider.cwd)
const repo = gitInfo.repositoryUrl || path.basename(provider.cwd)
// Get the primary language from the first edited file
const pendingEdits = currentTask.fileEditReviewController.getPendingEdits()
let language = "ts" // default
if (pendingEdits.size > 0) {
const firstFile = Array.from(pendingEdits.keys())[0]
const ext = path.extname(firstFile).toLowerCase()
const languageMap: Record<string, string> = {
".ts": "ts",
".tsx": "tsx",
".js": "js",
".jsx": "jsx",
".py": "py",
".java": "java",
".go": "go",
".rs": "rs",
".cpp": "cpp",
".c": "c",
".cs": "cs",
".php": "php",
".rb": "rb",
".swift": "swift",
".kt": "kt",
".dart": "dart",
".vue": "vue",
".svelte": "svelte",
}
language = languageMap[ext] || "ts"
}
// Get the primary language from the first edited file before they are cleared
const pendingEdits = currentTask.fileEditReviewController.getPendingEdits()
let language = "ts" // default
if (pendingEdits.size > 0) {
const firstFile = Array.from(pendingEdits.keys())[0]
const ext = path.extname(firstFile).toLowerCase()
const languageMap: Record<string, string> = {
".ts": "ts",
".tsx": "tsx",
".js": "js",
".jsx": "jsx",
".py": "py",
".java": "java",
".go": "go",
".rs": "rs",
".cpp": "cpp",
".c": "c",
".cs": "cs",
".php": "php",
".rb": "rb",
".swift": "swift",
".kt": "kt",
".dart": "dart",
".vue": "vue",
".svelte": "svelte",
}
language = languageMap[ext] || "ts"
}
// Execute the accept all command and get line counters
const lineCounters = await vscode.commands.executeCommand<
{ linesAdded: number; linesUpdated: number; linesDeleted: number } | undefined
>("axon-code.fileEdit.acceptAll")
// Send line counters to server if we have data
if (
lineCounters &&
(lineCounters.linesAdded > 0 || lineCounters.linesUpdated > 0 || lineCounters.linesDeleted > 0)
) {
try {
// Get state to retrieve kilocodeToken
const state = await provider.getState()
const kilocodeToken = state.apiConfiguration?.kilocodeToken
if (!kilocodeToken) {
provider.log("KiloCode token not found, skipping line counter update")
break
}
// Get git repository info for x-axon-repo header
const { getGitRepositoryInfo } = await import("../../utils/git")
const gitInfo = await getGitRepositoryInfo(provider.cwd)
const repo = gitInfo.repositoryUrl || path.basename(provider.cwd)

Comment on lines +1560 to +1562
const url = `https://api.matterai.so/axoncode/meta/${currentTask.taskId}/lines`
const response = await fetch(url, {
method: "POST",
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Robustness

Issue: The fetch request lacks a timeout configuration. If the API endpoint hangs, this operation could remain pending indefinitely.

Fix: Add an AbortSignal with a reasonable timeout (e.g., 10 seconds).

Impact: Prevents potential resource leaks and hanging operations.

Suggested change
const url = `https://api.matterai.so/axoncode/meta/${currentTask.taskId}/lines`
const response = await fetch(url, {
method: "POST",
// Send POST request to update line counters
const url = `https://api.matterai.so/axoncode/meta/${currentTask.taskId}/lines`
const response = await fetch(url, {
signal: AbortSignal.timeout(10000),
method: "POST",

Comment on lines +1001 to +1003
const originalUri = vscode.Uri.parse(`cline-diff:${fileName}`).with({
query: Buffer.from(edit.originalContent).toString("base64"),
})
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Code Quality

Issue: Using vscode.Uri.parse with a constructed string cline-diff:${fileName} is unsafe if fileName contains spaces or special characters that are not URL-encoded.

Fix: Use vscode.Uri.from which handles path encoding correctly.

Impact: Ensures reliable URI creation for files with special characters.

Suggested change
const originalUri = vscode.Uri.parse(`cline-diff:${fileName}`).with({
query: Buffer.from(edit.originalContent).toString("base64"),
})
// Create a URI for the original content using the diff view scheme
const originalUri = vscode.Uri.from({
scheme: "cline-diff",
path: fileName,
query: Buffer.from(edit.originalContent).toString("base64"),
})


const seconds = Math.floor(elapsed / 1000)
const secondsLabel = t("chat:reasoning.seconds", { count: seconds })
const displayElapsed = isStreaming ? elapsed : finalElapsed
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 UI Bug

Issue: displayElapsed uses isStreaming to decide whether to show elapsed or finalElapsed. If isStreaming is true (global chat state) but the current block is finished (partial is false), it incorrectly shows elapsed (which is reset to 0) instead of finalElapsed.

Fix: Use the partial prop to determine if the block is still active.

Impact: Correctly displays the final duration for completed reasoning blocks while the chat is still streaming.

Suggested change
const displayElapsed = isStreaming ? elapsed : finalElapsed
const displayElapsed = partial ? elapsed : finalElapsed

@code-crusher code-crusher merged commit 2e425ce into main Jan 12, 2026
6 of 14 checks passed
@code-crusher code-crusher deleted the release/v5.1.0 branch January 12, 2026 06:54
@code-crusher code-crusher restored the release/v5.1.0 branch January 12, 2026 06:59
@code-crusher
Copy link
Member Author

/matter review-max

@matter-code-review
Copy link
Contributor

I couldn't clone the repository.

@code-crusher
Copy link
Member Author

/matter review-max

1 similar comment
@code-crusher
Copy link
Member Author

/matter review-max

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