The best way to control Claude Code, Codex and more from any computer or phone
fix(server): a killed Antigravity subagent no longer keeps its turn running (#39519)
Julius Marminge committed
Nov 19, 2026 at 20:33 UTC
194726492b45780884d0643be88621032fcd72df
2 files changed
+50
-2
apps/server/src/provider/acp/AntigravityChildWork.test.ts
+43
@@ -11,6 +11,7 @@ import {
11
ANTIGRAVITY_SUBAGENT_BATCH_TITLE,
12
antigravitySubagentLaunches,
13
describeAntigravitySubagentLaunches,
14
+ readAntigravityChildrenAtWork,
15
readAntigravityChildWork,
16
} from "./AntigravityChildWork.ts";
17
import { sanitizeAntigravityToolPayload } from "./AntigravityProtocol.ts";
@@ -472,6 +473,48 @@ it.layer(NodeServices.layer)("readAntigravityChildWork", (it) => {
473
}),
474
);
475
476
+ it.effect("counts a detached child killed before it reported as no longer at work", () =>
477
+ Effect.gen(function* () {
478
+ const fs = yield* FileSystem.FileSystem;
479
+ const path = yield* Path.Path;
480
+ const profile = yield* fs.makeTempDirectoryScoped({ prefix: "t3-agy-killed-" });
481
+ const killed = "0a591388-d9d9-439d-a2a0-90932fd25b39";
482
+ const writeJson = (segments: ReadonlyArray<string>, value: unknown) => {
483
+ const file = path.join(profile, "antigravity-acp", "brain", ...segments);
484
+ return fs
485
+ .makeDirectory(path.dirname(file), { recursive: true })
486
+ .pipe(Effect.andThen(fs.writeFileString(file, JSON.stringify(value))));
487
+ };
488
+ const child = (conversationId: string, state: string, callId: string) =>
489
+ Effect.all([
490
+ writeJson([ROOT, ".system_generated", "subagents", `${conversationId}.json`], {
491
+ conversationId,
492
+ subagentDescriptor: { typeName: "research", role: LAUNCH.role },
493
+ state,
494
+ }),
495
+ writeJson([conversationId, ".system_generated", "messages", "launch.json"], {
496
+ sender: ROOT,
497
+ content: LAUNCH.prompt,
498
+ sourceMetadata: {
499
+ tool: { conversationId: ROOT, toolCall: { id: callId, name: "invoke_subagent" } },
500
+ },
501
+ }),
502
+ ]);
503
+
504
+ // agy 1.5.13 `manage_subagents(kill)` only rewrites the record's state; nothing reaches the parent's inbox.
505
+ yield* child(CHILD, "SUBAGENT_STATE_ALIVE", "call_alive");
506
+ yield* child(killed, "SUBAGENT_STATE_KILLED", "call_killed");
507
+
508
+ expect(
509
+ yield* readAntigravityChildrenAtWork({
510
+ profileDirectory: profile,
511
+ rootSessionId: ROOT,
512
+ toolCallIds: ["call_alive", "call_killed"],
513
+ }),
514
+ ).toEqual(["call_alive"]);
515
+ }),
516
+ );
517
+
518
it.effect("shares one transcript budget across the batch", () =>
519
Effect.gen(function* () {
520
const filler = JSON.stringify({
apps/server/src/provider/acp/AntigravityChildWork.ts
+7
-2
@@ -520,6 +520,7 @@ const decodeDetachedSubagent = Schema.decodeUnknownOption(
520
Schema.fromJsonString(
521
Schema.Struct({
522
conversationId: Schema.optional(Schema.String),
523
+ state: Schema.optional(Schema.String),
524
subagentDescriptor: Schema.optional(
525
Schema.Struct({
526
role: Schema.optional(Schema.String),
@@ -646,8 +647,9 @@ async function findDetachedInvokeRecord(
647
648
/**
649
* agy 1.5 children outlive their `invoke_subagent` call and the agent reports no end for them:
649
- * a child is done, or waits for guidance, once its message is in the parent's inbox. Returns the
650
- * launching tool call ids of children with no message yet; none when the records prove nothing.
650
+ * a child is done, or waits for guidance, once its message is in the parent's inbox or its record
651
+ * says it was killed. Returns the launching tool call ids of children with neither; none when the
652
+ * records prove nothing.
653
*/
654
export const readAntigravityChildrenAtWork = Effect.fn("readAntigravityChildrenAtWork")(
655
function* (input: {
@@ -669,6 +671,9 @@ export const readAntigravityChildrenAtWork = Effect.fn("readAntigravityChildrenA
671
const atWork: Array<string> = [];
672
for (const childId of childIds) {
673
if (reported.has(childId)) continue;
674
+ // `manage_subagents` kill only marks the record; a killed child never reports.
675
+ const subagent = await readDetachedSubagent(profileRoot, input.rootSessionId, childId);
676
+ if (subagent?.state === "SUBAGENT_STATE_KILLED") continue;
677
for (const message of await readInbox(profileRoot, childId)) {
678
const launch = detachedLaunchCall(message, input.rootSessionId);
679
if (launch !== undefined && input.toolCallIds.includes(launch.id)) {