Skip to content

Commit 40df1f3

Browse files
committed
fix(acp): scope kill error detection to header line
1 parent 950754d commit 40df1f3

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎apps/server/src/provider/acp/AntigravityProtocol.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,27 @@ describe("Antigravity background tasks", () => {
702702
}),
703703
).toEqual([]);
704704

705+
// manage_task kill succeeded when output has inner error mentions in task logs
706+
expect(
707+
extractAntigravityBackgroundTaskCompletion({
708+
toolCallId: "call-kill-inner-err",
709+
title: "manage_task",
710+
status: "completed",
711+
data: {
712+
rawInput: { Action: "kill", TaskId: "task-123" },
713+
rawOutput:
714+
"Killed task 123.\nCaptured logs before kill:\n[ERROR] Connection reset by peer",
715+
},
716+
}),
717+
).toEqual([
718+
{
719+
taskId: "task-123",
720+
status: "completed",
721+
appendOutput:
722+
"Killed task 123.\nCaptured logs before kill:\n[ERROR] Connection reset by peer",
723+
},
724+
]);
725+
705726
// manage_task status shows completed
706727
expect(
707728
extractAntigravityBackgroundTaskCompletion({

‎apps/server/src/provider/acp/AntigravityProtocol.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,10 @@ export function extractAntigravityBackgroundTaskCompletion(
621621
/(?:^|\n)Task "([^"]+)"\s+(?:cancelled|killed)\b/i.exec(outputText) ??
622622
/(?:^|\n)Task id "([^"]+)"\s+was canceled\b/i.exec(outputText);
623623
const hasSuccessfulKillNotice = killMatch !== null;
624-
const isExplicitKillError = /(?:failed|error|not found|no task)/i.test(outputText);
624+
const firstLine = outputText.split("\n", 1)[0] ?? "";
625+
const isExplicitKillError =
626+
/(?:failed|error|not found|no task)/i.test(firstLine) ||
627+
/(?:^|\n)(?:error:|failed to kill)/i.test(outputText);
625628
if ((toolCall.status === "completed" && !isExplicitKillError) || hasSuccessfulKillNotice) {
626629
const taskId = taskIdFromInput ?? killMatch?.[1];
627630
if (taskId) {

0 commit comments

Comments
 (0)