Skip to content

Commit f8a14b2

Browse files
authored
feat(antigravity): show subagent calls and results (pingdotgg#9515)
1 parent 3653cb2 commit f8a14b2

7 files changed

Lines changed: 728 additions & 16 deletions

File tree

‎apps/mobile/src/lib/threadActivity.test.ts‎

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,104 @@ describe("buildThreadFeed", () => {
21212121
});
21222122

21232123
describe("quiet timeline: nested agents", () => {
2124+
it.each(["task.updated", "task.progress"] as const)(
2125+
"does not mark an ordinary task complete when it resumes through %s",
2126+
(resumeKind) => {
2127+
const thread = makeThread({
2128+
id: ThreadId.make("resumed-agent"),
2129+
projectId: ProjectId.make("project-1"),
2130+
title: "Resumed agent",
2131+
activities: (
2132+
[
2133+
["task.progress", "running", "Review"],
2134+
["task.updated", "idle", "Task idle"],
2135+
[resumeKind, "running", "Review resumed"],
2136+
] as const
2137+
).map(([kind, status, summary], index) =>
2138+
makeActivity({
2139+
id: EventId.make(`resumed-${index}`),
2140+
kind,
2141+
summary,
2142+
createdAt: `2026-04-01T00:00:0${index + 1}.000Z`,
2143+
payload: {
2144+
taskId: "agent-1",
2145+
agentKind: "agent",
2146+
title: "Reviewer",
2147+
status,
2148+
detail: summary,
2149+
},
2150+
}),
2151+
),
2152+
});
2153+
const rows = buildThreadFeed(thread).flatMap((entry) =>
2154+
entry.type === "activity-group" ? entry.activities : [],
2155+
);
2156+
expect(rows).toMatchObject([
2157+
{
2158+
lifecycleStatus: "inProgress",
2159+
summary: "Reviewer",
2160+
workEntry: { label: resumeKind === "task.progress" ? "Review resumed" : "Review" },
2161+
},
2162+
]);
2163+
},
2164+
);
2165+
2166+
it.each(["cancelled", "failed", "interrupted"] as const)(
2167+
"replaces Antigravity progress with %s without a timeline bypass flag",
2168+
(status) => {
2169+
const thread = makeThread({
2170+
id: ThreadId.make("antigravity-agents"),
2171+
projectId: ProjectId.make("project-1"),
2172+
title: "Antigravity subagents",
2173+
activities: [
2174+
...["trajectory:4", "trajectory:5"].map((taskId, index) =>
2175+
makeActivity({
2176+
id: EventId.make(`progress-${index}`),
2177+
kind: "task.progress",
2178+
summary: "Antigravity subagent",
2179+
createdAt: `2026-04-01T00:00:0${index + 1}.000Z`,
2180+
payload: {
2181+
taskId,
2182+
taskType: "subagent",
2183+
agentKind: "agent",
2184+
title: "Antigravity subagent",
2185+
detail: "Antigravity subagent",
2186+
status: "running",
2187+
},
2188+
}),
2189+
),
2190+
makeActivity({
2191+
id: EventId.make("agent-stopped"),
2192+
kind: "task.updated",
2193+
summary: `Task ${status}`,
2194+
createdAt: "2026-04-01T00:00:03.000Z",
2195+
payload: {
2196+
taskId: "trajectory:4",
2197+
taskType: "subagent",
2198+
agentKind: "agent",
2199+
title: "Antigravity subagent",
2200+
status,
2201+
error: "Antigravity process stopped.",
2202+
},
2203+
}),
2204+
],
2205+
});
2206+
const rows = buildThreadFeed(thread).flatMap((entry) =>
2207+
entry.type === "activity-group" ? entry.activities : [],
2208+
);
2209+
expect(rows).toHaveLength(2);
2210+
expect(rows[0]).toMatchObject({
2211+
lifecycleStatus: status === "failed" ? "failed" : "stopped",
2212+
detail: "Antigravity process stopped.",
2213+
workEntry: { taskId: "trajectory:4", toolTitle: "Antigravity subagent" },
2214+
});
2215+
expect(rows[1]).toMatchObject({
2216+
lifecycleStatus: "inProgress",
2217+
workEntry: { taskId: "trajectory:5" },
2218+
});
2219+
},
2220+
);
2221+
21242222
it("keeps a nested agent's terminal row but hides its background work", () => {
21252223
const thread = makeThread({
21262224
id: ThreadId.make("thread-nested"),

‎apps/mobile/src/lib/threadActivity.ts‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,15 @@ function resolvePendingUserInputAnswer(
321321
return selectedOptionValues[0] ?? null;
322322
}
323323

324-
/** Codex children settle via task.updated (idle/failed/interrupted), never
325-
* task.completed — these rows are mobile's only terminal signal for them. */
324+
/** Some providers settle agents through task.updated instead of task.completed. */
326325
const MOBILE_TERMINAL_UPDATE_STATUSES: ReadonlySet<string> = new Set([
327-
"idle",
328326
"completed",
329327
"failed",
330328
"cancelled",
331329
"interrupted",
332330
]);
333331

334-
function isTerminalBypassUpdate(activity: OrchestrationThreadActivity): boolean {
332+
function isTerminalTaskUpdate(activity: OrchestrationThreadActivity): boolean {
335333
if (activity.kind !== "task.updated") {
336334
return false;
337335
}
@@ -340,9 +338,9 @@ function isTerminalBypassUpdate(activity: OrchestrationThreadActivity): boolean
340338
? (activity.payload as Record<string, unknown>)
341339
: null;
342340
return (
343-
payload?.timelineBypass === true &&
344-
typeof payload.status === "string" &&
345-
MOBILE_TERMINAL_UPDATE_STATUSES.has(payload.status)
341+
typeof payload?.status === "string" &&
342+
(MOBILE_TERMINAL_UPDATE_STATUSES.has(payload.status) ||
343+
(payload.timelineBypass === true && payload.status === "idle"))
346344
);
347345
}
348346

@@ -351,8 +349,7 @@ function isTerminalBypassUpdate(activity: OrchestrationThreadActivity): boolean
351349
* activity lives in the Agents sheet, not the work log. Terminal rows are
352350
* kept — with no Agents surface on mobile they are the terminal signal
353351
* (a surface that hides rows must keep its own terminal signal). That means
354-
* task.completed (Claude) AND terminal bypassed task.updated (Codex, whose
355-
* children never emit task.completed — review finding).
352+
* task.completed and terminal task.updated, including Antigravity cancellation.
356353
*/
357354
function isAgentInternalActivity(activity: OrchestrationThreadActivity): boolean {
358355
const payload =
@@ -362,7 +359,7 @@ function isAgentInternalActivity(activity: OrchestrationThreadActivity): boolean
362359
if (!payload) {
363360
return false;
364361
}
365-
const isTerminalTaskRow = activity.kind === "task.completed" || isTerminalBypassUpdate(activity);
362+
const isTerminalTaskRow = activity.kind === "task.completed" || isTerminalTaskUpdate(activity);
366363
if (payload.timelineBypass === true && !isTerminalTaskRow) {
367364
return true;
368365
}
@@ -387,8 +384,7 @@ function deriveWorkLogEntries(
387384
if (activity.tone !== "error" && isWorktreeSetupActivity(activity.kind)) continue;
388385
if (activity.kind === "tool.started") continue;
389386
if (activity.kind === "task.started") continue;
390-
// Terminal bypassed updates pass: Codex children's only terminal signal.
391-
if (activity.kind === "task.updated" && !isTerminalBypassUpdate(activity)) continue;
387+
if (activity.kind === "task.updated" && !isTerminalTaskUpdate(activity)) continue;
392388
if (activity.kind === "tool.progress") continue;
393389
if (activity.kind === "context-window.updated") continue;
394390
if (activity.summary === "Checkpoint captured") continue;
@@ -432,9 +428,7 @@ function toDerivedWorkLogEntry(activity: OrchestrationThreadActivity): DerivedWo
432428
const changedFiles = extractChangedFiles(payload);
433429
const title = extractToolTitle(payload);
434430
const toolPresentation = extractToolActivityPresentation(payload);
435-
// task.updated included: terminal bypassed updates (Codex children's only
436-
// terminal signal) must carry task identity so they collapse per child
437-
// instead of stacking anonymous "Task idle" rows.
431+
// Terminal task updates carry identity so they replace each child's progress row.
438432
const isTaskActivity =
439433
activity.kind === "task.progress" ||
440434
activity.kind === "task.completed" ||
@@ -498,6 +492,9 @@ function toDerivedWorkLogEntry(activity: OrchestrationThreadActivity): DerivedWo
498492
});
499493
if (detail && !repeatsCommand) entry.detail = detail;
500494
}
495+
if (isTaskActivity && typeof payload?.error === "string" && payload.error.trim()) {
496+
entry.detail = payload.error;
497+
}
501498
if (viewedImagePath) {
502499
entry.viewedImagePath = viewedImagePath;
503500
}
@@ -1099,6 +1096,8 @@ function extractWorkLogToolLifecycleStatus(
10991096
payload: Record<string, unknown> | null,
11001097
): WorkLogToolLifecycleStatus | undefined {
11011098
const status = payload?.status;
1099+
if (status === "pending" || status === "running" || status === "waiting") return "inProgress";
1100+
if (status === "cancelled" || status === "interrupted") return "stopped";
11021101
if (
11031102
status === "inProgress" ||
11041103
status === "completed" ||

0 commit comments

Comments
 (0)