Skip to content

Commit 406ead5

Browse files
committed
fix: restore Codex subagent waiting indicator
PR #3522 hid both `wait` and `closeAgent` collab-agent events. `wait` ("Waiting for subagents") is the visible state that the main thread is blocked on a running subagent; dropping it made the conversation look done while a subagent was still working. Keep `closeAgent` hidden as lifecycle noise but restore `wait` so the in-progress spinner shows. Generated-By: PostHog Code Task-Id: 515f2e33-762c-412a-8a2d-a217bbace052
1 parent 46f300a commit 406ead5

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

packages/agent/src/adapters/codex-app-server/mapping.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,49 @@ describe("mapAppServerNotification", () => {
262262
});
263263
});
264264

265+
it("maps a started wait tool call so the UI shows the main thread waiting on its subagents", () => {
266+
const result = mapAppServerNotification(
267+
"s-1",
268+
APP_SERVER_NOTIFICATIONS.ITEM_STARTED,
269+
{
270+
item: {
271+
type: "collabAgentToolCall",
272+
id: "wait-1",
273+
tool: "wait",
274+
status: "inProgress",
275+
senderThreadId: "main-thread",
276+
},
277+
},
278+
);
279+
280+
expect(result).toEqual({
281+
sessionId: "s-1",
282+
update: {
283+
sessionUpdate: "tool_call",
284+
toolCallId: "wait-1",
285+
title: "Wait for subagents",
286+
kind: "other",
287+
status: "in_progress",
288+
rawInput: {},
289+
_meta: { posthog: { toolName: "wait_agent" } },
290+
},
291+
});
292+
});
293+
294+
it("still drops closeAgent lifecycle events", () => {
295+
expect(
296+
mapAppServerNotification("s-1", APP_SERVER_NOTIFICATIONS.ITEM_STARTED, {
297+
item: {
298+
type: "collabAgentToolCall",
299+
id: "close-1",
300+
tool: "closeAgent",
301+
status: "inProgress",
302+
senderThreadId: "main-thread",
303+
},
304+
}),
305+
).toBeNull();
306+
});
307+
265308
it("keeps a completed spawn tool call terminal while its subagent is running", () => {
266309
const result = mapAppServerNotification(
267310
"s-1",

packages/agent/src/adapters/codex-app-server/mapping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ function describeTool(item: AppServerItem): ToolDescriptor | null {
411411
output: dynamicToolText(item.contentItems),
412412
};
413413
case "collabAgentToolCall":
414-
if (item.tool === "wait" || item.tool === "closeAgent") {
414+
if (item.tool === "closeAgent") {
415415
return null;
416416
}
417417
return {

0 commit comments

Comments
 (0)