fix(engine): zero out file stats on empty-merge mergeDetails
Follow-up to 9492ed4c4: when the merge was empty (no commit made),
filesChanged/insertions/deletions were still being captured from
git show --shortstat HEAD — which describes pre-merge HEAD's commit,
unrelated to this task. Consumers (dashboard, audit log) would render
those numbers next to "no commit landed", which is misleading.
Clear stats to 0 alongside the omitted commitSha. Also drop the stats
line from the agent-log summary when mergeWasEmpty.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3013,11 +3013,18 @@ export async function aiMergeTask(
|
||||
);
|
||||
}
|
||||
|
||||
// When the merge was empty (no commit made), the captured stats describe
|
||||
// pre-merge HEAD's commit, not anything this task did. Clear them so
|
||||
// consumers don't display unrelated numbers next to "no commit landed".
|
||||
const recordedFilesChanged = mergeWasEmpty ? 0 : filesChanged;
|
||||
const recordedInsertions = mergeWasEmpty ? 0 : insertions;
|
||||
const recordedDeletions = mergeWasEmpty ? 0 : deletions;
|
||||
|
||||
const mergeDetails: MergeDetails = {
|
||||
commitSha: recordedSha,
|
||||
filesChanged,
|
||||
insertions,
|
||||
deletions,
|
||||
filesChanged: recordedFilesChanged,
|
||||
insertions: recordedInsertions,
|
||||
deletions: recordedDeletions,
|
||||
mergeCommitMessage: commitLog,
|
||||
mergedAt: new Date().toISOString(),
|
||||
mergeConfirmed: true,
|
||||
@@ -3042,7 +3049,7 @@ export async function aiMergeTask(
|
||||
} else if (isEmptyCommit) {
|
||||
summaryParts.push("squash collapsed to empty (sha deferred)");
|
||||
}
|
||||
if (filesChanged !== undefined) {
|
||||
if (!mergeWasEmpty && filesChanged !== undefined) {
|
||||
summaryParts.push(`${filesChanged} file${filesChanged === 1 ? "" : "s"} changed (+${insertions ?? 0}/-${deletions ?? 0})`);
|
||||
}
|
||||
await store.appendAgentLog(
|
||||
|
||||
Reference in New Issue
Block a user