fix(antigravity): Show background command summaries and live output #40687
Openmwolson(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/40687/headopened View on GitHubtanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- @@ -1822,3 +1827,12 @@18221827 for (const entryId of fold.hiddenEntryIds) collapsedEntryIds.add(entryId);18231828 }18241829 }1830+ const tailIsActiveActivityGroup =1831+ activeTailGroup?.type === "activity-group" && activeTailGroup.runId === activeRunId;1832+ const trailingRunningCommands: ThreadFeedActivity[] = [];1833+ const trailingRunningCommandIds = new Set<string>();1834+ if (1835+ !zen &&1836+ isWorking &&1837+ latestRun?.turnEnded !== true &&1838+ !tailIsActiveActivityGroup &&@@ -1930,3 +1960,4 @@19301960 result.push(...rows);19311961 continue;19321962 }1963+ const presentationEntry =@@ -1674,0 +1698,21 @@1698+ commandLine: "python3 capture.py",1699+ toolSummary: "Capture 60 frames if sky is clean",1700+ }),1701+ );1702+ db.close();1703+ const logFile = path.join(tasksDir, "task-17.log");1704+ yield* fileSystem.writeFileString(logFile, "sky median 412 ADU\n");1705+1706+ const cmd = {1707+ toolCallId: "call_bg_capture",1708+ kind: "execute",1709+ title: "Run command",1710+ rawInput: { CommandLine: "python3 capture.py", WaitMsBeforeAsync: 5000 },1711+ } as const;1712+ const { send, startTurn, until, throughPromptSettled } =1713+ yield* openSessionWithRunningCommand({}, undefined, undefined, {1714+ profileDirectory: profile,1715+ initialToolCalls: [{ sessionUpdate: "tool_call", ...cmd, status: "in_progress" }],1716+ });1717+ yield* startTurn(1, false);1718+ yield* throughPromptSettled;@@ -0,0 +1,14 @@1+import * as NodeServices from "@effect/platform-node/NodeServices";2+import { assert, describe, it } from "@effect/vitest";3+import * as Deferred from "effect/Deferred";4+import * as Effect from "effect/Effect";5+import * as Fiber from "effect/Fiber";6+import * as FileSystem from "effect/FileSystem";7+import * as Path from "effect/Path";8+import * as Queue from "effect/Queue";9+10+import { commandStep, makeProfile, ROOT } from "./AntigravityChildWork.testkit.ts";11+import { tailAntigravityCommandOutput } from "./AntigravityTaskOutputTail.ts";12+13+describe("tailAntigravityCommandOutput", () => {14+ it.live("discovers toolSummary and streams task-<idx>.log across split UTF-8 bytes", () =>@@ -1808,6 +1813,6 @@18081813 };18091814 })()18101815 : null;1811- const activeWorkEntryIds = new Set(1812- activeWorkRow !== null || latestToolFailed ? activeToolEntries.map((entry) => entry.id) : [],1813- );1816+ const trailingRunningCommandEntries =1817+ input.isWorking &&1818+ activeWorkRow === null &&@@ -4930,0 +4985,21 @@4985+ !commandOutputTails.has(nativeItemId)4986+ ) {4987+ const stop = yield* Deferred.make<void>();4988+ const tailCommandOutput = flavor.tailCommandOutput;4989+ const tailedToolCallId = toolCall.toolCallId;4990+ const fiber = yield* tailCommandOutput({4991+ sessionId: context.nativeThreadId,4992+ toolCallId: tailedToolCallId,4993+ stop,4994+ onChunk: (chunk) =>4995+ emitProviderEvent({4996+ type: "command_output.delta",4997+ driver,4998+ threadId: context.input.threadId,4999+ itemId: turnItem.id,5000+ chunk,5001+ }),5002+ onTitle: Effect.fnUntraced(function* (nextTitle: string) {5003+ const trimmed = nextTitle.trim();5004+ if (trimmed.length === 0 || context.finalized) return;5005+ context.commandOutputTitles.set(tailedToolCallId, trimmed);
Pusheda9144c9
- @@ -1908,3 +1942,11 @@19081942 continue;19091943 }19101944 if (!collapsedEntryIds.has(entry.id)) {1945+ const filteredEntry =1946+ trailingRunningCommandIds.size > 0 && entry.type === "activity-group"1947+ ? {1948+ ...entry,1949+ activities: entry.activities.filter(1950+ (activity) => !trailingRunningCommandIds.has(activity.id),1951+ ),1952+ }
Pushed2db3719
- @@ -2168,3 +2204,14 @@21682204 if (clientTerminals !== undefined) {21692205 yield* Scope.addFinalizer(sessionScope, clientTerminals.disposeAll);21702206 }2207+ const commandOutputTails = new Map<2208+ string,2209+ {2210+ readonly context: ActiveAcpTurn;2211+ readonly fiber: Fiber.Fiber<void>;2212+ readonly stop: Deferred.Deferred<void>;2213+ }2214+ >();2215+ // Waits for the tail's last read so its output lands before the call settles.2216+ const stopCommandOutputTail = (nativeItemId: string) =>2217+ Effect.suspend(() => {
Pushed3163ada
- @@ -2168,3 +2204,18 @@21682204 if (clientTerminals !== undefined) {21692205 yield* Scope.addFinalizer(sessionScope, clientTerminals.disposeAll);21702206 }2207+ const commandOutputTails = new Map<2208+ string,2209+ {2210+ readonly context: ActiveAcpTurn;2211+ readonly fiber: Fiber.Fiber<void>;2212+ readonly stop: Deferred.Deferred<void>;2213+ }2214+ >();2215+ // Waits for the tail's last read so its output lands before the call settles.2216+ const stopCommandOutputTail = Effect.fn("AcpAdapter.stopCommandOutputTail")(function* (2217+ nativeItemId: string,2218+ ) {2219+ const tail = commandOutputTails.get(nativeItemId);2220+ if (tail === undefined) return;2221+ commandOutputTails.delete(nativeItemId);
Pushed33d82e3
- @@ -2168,3 +2204,19 @@21682204 if (clientTerminals !== undefined) {21692205 yield* Scope.addFinalizer(sessionScope, clientTerminals.disposeAll);21702206 }2207+ const commandOutputTails = new Map<2208+ string,2209+ {2210+ readonly context: ActiveAcpTurn;2211+ readonly fiber: Fiber.Fiber<void>;2212+ readonly stop: Deferred.Deferred<void>;2213+ }2214+ >();2215+ // Waits for the tail's last read so its output lands before the call settles.2216+ const stopCommandOutputTail = Effect.fn("AcpAdapter.stopCommandOutputTail")(function* (2217+ nativeItemId: string,2218+ ) {2219+ const tail = commandOutputTails.get(nativeItemId);2220+ if (tail === undefined) return;2221+ yield* Deferred.succeed(tail.stop, undefined);2222+ yield* Fiber.await(tail.fiber);
Pushede670172
Pushedd1adeac
Pushedf8030f3
Pushed21d673a
- @@ -2053,3 +2088,19 @@20532088 entry.type === "activity-group" &&2054- entry.runId !== null &&2055- failedRunIds.has(entry.runId)2089+ entry.activities.some((activity) => trailingRunningCommandIds.has(activity.id))2090+ ? {2091+ ...entry,2092+ activities: entry.activities.filter(2093+ (activity) => !trailingRunningCommandIds.has(activity.id),2094+ ),2095+ }2096+ : entry;2097+ if (filteredEntry.type === "activity-group" && filteredEntry.activities.length === 0) {2098+ continue;2099+ }2100+ const presentationEntry =2101+ isActiveTailGroup &&2102+ trailingRunningCommands.length > 0 &&2103+ filteredEntry.type === "activity-group"2104+ ? {2105+ ...filteredEntry,2106+ activities: [...filteredEntry.activities, ...trailingRunningCommands],@@ -2567,3 +2599,12 @@25672599 if (input.isWorking && !hasWorkingRow && activeTurnHeaderIndex === timelineEntries.length) {25682600 appendWorkingRow();25692601 }2602+ if (activeWorkRow === null && trailingRunningCommandEntries.length > 0) {2603+ const anchor = trailingRunningCommandEntries[0]!;2604+ const latest = trailingRunningCommandEntries.at(-1)!;2605+ const groupId = workGroupId(anchor.id);2606+ const expanded = input.expandedWorkGroupIds?.has(groupId) ?? false;2607+ const groupedEntries = trailingRunningCommandEntries.map((entry) => entry.entry);2608+ nextRows.push({2609+ kind: "work-live",2610+ id: LIVE_ACTIVITY_ROW_ID,@@ -0,0 +125,21 @@125+ } finally {126+ database.close();127+ }128+}129+130+async function readTaskLogSlice(131+ logPath: string,132+ offset: number,133+): Promise<134+ | { readonly kind: "unchanged" }135+ | {136+ readonly kind: "chunk";137+ readonly bytes: Uint8Array;138+ readonly nextOffset: number;139+ readonly reset: boolean;140+ readonly skipped: boolean;141+ }142+> {143+ const handle = await NodeFSP.open(144+ logPath,145+ NodeFS.constants.O_RDONLY | (NodeFS.constants.O_NOFOLLOW ?? 0),@@ -0,0 +123,21 @@123+ } catch {124+ return undefined;125+ } finally {126+ database.close();127+ }128+}129+130+async function readTaskLogSlice(131+ logPath: string,132+ offset: number,133+): Promise<134+ | { readonly kind: "unchanged" }135+ | {136+ readonly kind: "chunk";137+ readonly bytes: Uint8Array;138+ readonly nextOffset: number;139+ readonly reset: boolean;140+ readonly skipped: boolean;141+ }142+> {143+ const handle = await NodeFSP.open(@@ -2053,3 +2088,19 @@20532088 entry.type === "activity-group" &&2054- entry.runId !== null &&2055- failedRunIds.has(entry.runId)2089+ entry.activities.some((activity) => trailingRunningCommandIds.has(activity.id))2090+ ? {2091+ ...entry,2092+ activities: entry.activities.filter(2093+ (activity) => !trailingRunningCommandIds.has(activity.id),2094+ ),2095+ }2096+ : entry;2097+ if (filteredEntry.type === "activity-group" && filteredEntry.activities.length === 0) {2098+ continue;2099+ }2100+ const presentationEntry =2101+ isActiveTailGroup &&2102+ trailingRunningCommands.length > 0 &&2103+ filteredEntry.type === "activity-group"2104+ ? {2105+ ...filteredEntry,2106+ activities: [...filteredEntry.activities, ...trailingRunningCommands],
Pushed0c74ce4
- @@ -2840,0 +2885,21 @@2885+ // Waits for the tail's last read so its output lands before the call settles.2886+ const stopCommandOutputTail = Effect.fn("AcpAdapter.stopCommandOutputTail")(function* (2887+ nativeItemId: string,2888+ ) {2889+ const tail = commandOutputTails.get(nativeItemId);2890+ if (tail === undefined) return;2891+ yield* Deferred.succeed(tail.stop, undefined);2892+ yield* Fiber.await(tail.fiber);2893+ if (commandOutputTails.get(nativeItemId) === tail) {2894+ commandOutputTails.delete(nativeItemId);2895+ }2896+ });2897+ const stopTurnCommandOutputTails = Effect.fn("AcpAdapter.stopTurnCommandOutputTails")(2898+ function* (context: ActiveAcpTurn) {2899+ const keys = [...commandOutputTails.entries()].flatMap(([key, tail]) =>2900+ tail.context === context ? [key] : [],2901+ );2902+ yield* Effect.forEach(keys, stopCommandOutputTail, { discard: true });2903+ },2904+ );2905+ yield* Scope.addFinalizer(@@ -1942,10 +1965,16 @@1965+ ...visibleActiveToolEntries.map((entry) => entry.entry),1966+ ...trailingRunningCommandEntries.map((entry) => entry.entry),1967+ ];1968+ const liveEntry =1969+ latestRunningToolEntry ??1970+ trailingRunningCommandEntries.at(-1) ??1971+ latestVisibleToolEntry;1972+ const active = latestToolKeepsActivityLive || trailingRunningCommandEntries.length > 0;19421973 return {19431974 kind: "work-live" as const,1944- id: latestToolKeepsActivityLive1945- ? LIVE_ACTIVITY_ROW_ID1946- : `work-live:${activeWorkAnchor.id}`,1975+ id: active ? LIVE_ACTIVITY_ROW_ID : `work-live:${activeWorkAnchor.id}`,19471976 createdAt: activeWorkAnchor.createdAt,1948- entry: (latestRunningToolEntry ?? latestVisibleToolEntry).entry,1949- groupedEntries: visibleActiveToolEntries.map((entry) => entry.entry),1977+ entry: liveEntry.entry,1978+ groupedEntries: mergedEntries,19501979 groupId,19511980 expanded: input.expandedWorkGroupIds?.has(groupId) ?? false,
Sign in to join this conversation.


Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
Walkthrough
Antigravity command summaries are normalized and displayed as titles. The ACP adapter tails background command output and emits output deltas. Web and mobile timelines show in-progress commands as live activity after interim assistant messages.
Changes: Background Command Activity
apps/server/src/provider/acp/AntigravityProtocol.ts,packages/client-runtime/src/work-log/presentation.ts,apps/server/src/provider/acp/AntigravityProtocol.test.ts,apps/mobile/src/lib/threadActivity.ts,apps/web/src/components/chat/MessagesTimeline.logic.tspackages/provider-acp/src/server/adapter.ts,apps/server/src/provider/acp/AntigravityTaskOutputTail.ts,apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts,apps/server/src/provider/acp/AntigravityChildWork.testkit.ts,apps/server/src/provider/acp/AntigravityTaskOutputTail.test.ts,apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.tsapps/mobile/src/lib/threadActivity.ts,apps/web/src/components/chat/MessagesTimeline.logic.ts,apps/mobile/src/lib/threadActivity.test.ts,apps/web/src/components/chat/MessagesTimeline.active-tools.test.tsEstimated code review effort: 4 (Complex) | ~45 minutes
Change: Bug fix
Sequence Diagram(s)#
Possibly related issues
Suggested labels:
bugfixSuggested reviewers:
juliusmarminge,charlesbine,azygossMerge Risk:
Low · previous review
33d82This change surfaces Antigravity background command titles and live output in the web and mobile timelines. The remaining issues are narrow: command output could be missed in a rare timing case, the task-log path is not re-validated on every read, and the web timeline could briefly emit a duplicate live row ID after a failed tool. They are worth following up but do not block merging.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "fix(antigravity): Show background command summaries and live output" matches the main change. The changeset surfaces toolSummary as the command title and tails the task log to stream live output for background commands, both of which the title names. It is a conventional commit title in plain language, and it is specific enough for a teammate scanning history. The title does not mention the pinning of running commands below interim assistant messages on web and mobile, but it is a secondary aspect of the change and that omission is acceptable.
Full details: Description check
Explanation
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each is substantively filled in. The Problem section gives the expected behavior and the observed symptoms. The Change section lists the three fixes and why the web and mobile changes belong together. The Scope section links
#41104and a related issue. The Verification section gives commands run, test counts, and before/after screenshots. Minor gaps: the Problem section gives no step-by-step reproduction. The description states that mobile screenshots were not captured and that the mobile behavior was checked only through unit tests. It also cites two different test counts (228 tests in the description, 291 in the objectives), which should be reconciled. The description does not name the model and harness used, although the template asks for that when an agent did the work. The author does name the harness (Antigravity) in the sign-off.Finishing Touches
Generate unit tests (beta)