Skip to content

release/v6.0.2#81

Merged
code-crusher merged 10 commits into
mainfrom
release/v6.0.2
Apr 28, 2026
Merged

release/v6.0.2#81
code-crusher merged 10 commits into
mainfrom
release/v6.0.2

Conversation

@code-crusher

Copy link
Copy Markdown
Member

@code-crusher code-crusher merged commit bbcae1a into main Apr 28, 2026
2 of 12 checks passed
@code-crusher code-crusher deleted the release/v6.0.2 branch April 28, 2026 07:03
@matterai-app

matterai-app Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Context

This PR introduces the multi_file_edit tool to allow the AI agent to batch multiple file modifications into a single operation, significantly improving efficiency. It also adds a /compact slash command and automated context condensation logic to manage token limits proactively.

Implementation

Summary By MatterAI MatterAI logo

🔄 What Changed

  • New Tool: Added multi_file_edit for batching text replacements across multiple files.
  • Slash Command: Introduced /compact (alias for /condense) to manually trigger context window reduction.
  • Context Management: Implemented checkAndCondenseContext in Task.ts to automatically summarize history when token usage exceeds thresholds (default 80%).
  • Parser Robustness: Enhanced AssistantMessageParser to handle natural language text inside tool arguments during streaming and fix double-encoded parameters.
  • UI/UX: Added slash command chips, improved reasoning block scrolling, and integrated VS Code theme-aware shadows for sticky messages.

🔍 Impact of the Change

  • Performance: Reduces the number of round-trips to the LLM by batching edits.
  • Reliability: Prevents context window overflows by condensing history before executing heavy tools like read_file.
  • User Experience: Provides smoother streaming feedback and better visual integration with VS Code themes.

📁 Total Files Changed

Click to Expand
File ChangeLog
multi_file_edit.ts New Tool implementation for batch file editing logic.
Task.ts Context Logic added for auto-condensation and /compact command handling.
AssistantMessageParser.ts Parser Fix for streaming JSON arguments and double-encoding.
presentAssistantMessage.ts Orchestration Update to support multi-file edits and pre-tool condensation.
system.ts Prompt Update adding instructions for multi_file_edit usage.
ChatTextArea.tsx UI Enhancement for rendering slash command chips and caret management.
fileEditTool.ts Defensive Fallback to redirect edits arrays to the multi-edit tool.
kilocode-models.ts Model Cleanup removing deprecated Axon model definitions.

🧪 Test Added/Recommended

Added

  • AssistantMessageParser.spec.ts: Tests for multi-tool responses and natural language in streaming arguments.
  • presentAssistantMessage.spec.ts: Verifies execution of multiple tool blocks in a single response.

Recommended

  • Concurrency Tests: Verify multi_file_edit behavior when two edits target overlapping lines in the same file.
  • Threshold Tests: Validate checkAndCondenseContext triggers correctly at various autoCondenseContextPercent levels.

🔒 Security Vulnerabilities

  • N/A: No new security vulnerabilities detected. Access control is maintained via existing rooIgnoreController.

Screenshots

before after
Standard text slash commands Visual chips for /compact and /newtask

How to Test

  1. Start a task and perform 2+ file edits; verify the agent uses multi_file_edit instead of multiple file_edit calls.
  2. Type /compact in the chat to manually trigger context condensation.
  3. Fill the context window near the limit and trigger a read_file; verify the agent auto-condenses before reading.

Get in Touch

  • Handle: @matterai_agent

@matterai-app matterai-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧪 PR Review is completed: Solid release PR introducing multi-file edit, context condensation, and native tool call streaming fixes. Found a few runtime safety and async handling issues in the new Task and executeCommandTool code.

Skipped files
  • webview-ui/src/i18n/locales/en/chat.json: Skipped file pattern
⬇️ Low Priority Suggestions (1)
src/core/tools/executeCommandTool.ts (1 suggestion)

Location: src/core/tools/executeCommandTool.ts (Lines 221-221)

🟠 Logic Error

Issue: The new task.say("command_output", ...) call is missing await, while all other task.say calls in this file are awaited. If say rejects or the caller relies on the message being posted before completed = true, this creates a race condition or unhandled rejection risk.

Fix: Await the task.say call to maintain consistency with the surrounding async flow.

Impact: Eliminates potential unhandled promise rejections and ensures correct message ordering

-  			task.say("command_output", result, undefined, undefined, undefined, undefined, { isNonInteractive: true })
+  			await task.say("command_output", result, undefined, undefined, undefined, undefined, { isNonInteractive: true })
+  

Comment thread src/core/task/Task.ts
Comment on lines +3160 to +3163
const contextWindow = modelInfo.contextWindow

// Calculate context usage percentage
const contextPercent = (100 * contextTokens) / contextWindow

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Logic Error

Issue: contextWindow can be undefined or 0 for some models, causing contextPercent to evaluate as NaN or Infinity. The comparison contextPercent < effectiveThreshold becomes unpredictable and may trigger or skip condensation incorrectly.

Fix: Guard against invalid contextWindow before calculating the percentage.

Impact: Prevents erroneous condensation behavior when model metadata is incomplete

Suggested change
const contextWindow = modelInfo.contextWindow
// Calculate context usage percentage
const contextPercent = (100 * contextTokens) / contextWindow
const contextWindow = modelInfo.contextWindow
// Guard against invalid context window to prevent NaN/Infinity
if (!contextWindow) {
return false
}
// Calculate context usage percentage
const contextPercent = (100 * contextTokens) / contextWindow

Comment thread src/core/task/Task.ts
Comment on lines +3182 to +3185
console.log(
`[Task#${this.taskId}] Pre-tool context check: ${contextTokens} tokens (${contextPercent.toFixed(1)}%) ` +
`exceeds threshold ${effectiveThreshold}%. Triggering condensation.`,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Code Quality

Issue: Debug console.log statement left in production code can leak internal state (token counts, thresholds) and clutter extension host logs.

Fix: Remove the debug log or replace it with a proper telemetry/verbose logger.

Impact: Keeps production logs clean

Suggested change
console.log(
`[Task#${this.taskId}] Pre-tool context check: ${contextTokens} tokens (${contextPercent.toFixed(1)}%) ` +
`exceeds threshold ${effectiveThreshold}%. Triggering condensation.`,
)

@code-crusher code-crusher mentioned this pull request Apr 29, 2026
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