fix(coding-agent): fixed cross-file write batching regression in apply_patch
- Reverted to flushing only on the last file write or explicitly on early failure paths within `apply_patch` multi-file operations. - Refactored error counting logic within single path entries to use clean booleans instead of numeric counters. - Replaced custom preview capping logic in task progress rendering with `capPreviewLines` and added an option to hide the expand hint.
This commit is contained in:
@@ -14,6 +14,7 @@ import { formatContextUsage } from "../modes/components/status-line/context-thre
|
||||
import { getMarkdownTheme, type Theme } from "../modes/theme/theme";
|
||||
import { stripGeneratedOutputNotice, stripRawOutputArtifactNotice } from "../tools/output-meta";
|
||||
import {
|
||||
capPreviewLines,
|
||||
formatBadge,
|
||||
formatDuration,
|
||||
formatExpandHint,
|
||||
@@ -487,14 +488,6 @@ function sanitizeRecentOutput(output: string): string {
|
||||
return text;
|
||||
}
|
||||
|
||||
function capRecentOutputForPreview(output: string, maxRows: number): string {
|
||||
const lines = output.split("\n");
|
||||
if (lines.length <= maxRows) return output;
|
||||
const visible = maxRows <= 1 ? [] : lines.slice(lines.length - (maxRows - 1));
|
||||
const hidden = lines.length - visible.length;
|
||||
return [`… ${hidden} earlier ${hidden === 1 ? "line" : "lines"}`, ...visible].join("\n");
|
||||
}
|
||||
|
||||
function renderOutputSection(
|
||||
output: string,
|
||||
continuePrefix: string,
|
||||
@@ -1062,10 +1055,14 @@ function renderAgentProgress(
|
||||
// Expanded view: recent output and tools
|
||||
if (expanded && progress.status === "running") {
|
||||
const previewRows = previewWindowRows();
|
||||
const output = capRecentOutputForPreview(
|
||||
sanitizeRecentOutput([...progress.recentOutput].reverse().join("\n")),
|
||||
previewRows,
|
||||
);
|
||||
const output = capPreviewLines(
|
||||
sanitizeRecentOutput([...progress.recentOutput].reverse().join("\n")).split("\n"),
|
||||
theme,
|
||||
{
|
||||
max: previewRows,
|
||||
expandHint: false,
|
||||
},
|
||||
).join("\n");
|
||||
lines.push(...renderOutputSection(output, continuePrefix, expanded, theme, 2, previewRows));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user