fix(web): remove agent id from subagent metadata chips (#1205)

This commit is contained in:
Carlos Florêncio
2026-05-31 20:16:26 +01:00
committed by GitHub
parent 5f24349aae
commit b2faab430b
5 changed files with 7 additions and 12 deletions
@@ -3,7 +3,7 @@ import type { SubagentTaskPayload } from "@/components/task/chat/types";
import { subagentMetaChips } from "@/components/task/chat/messages/subagent-meta";
/**
* Compact row of metadata chips (duration, tokens, tools, model, ids) rendered
* Compact row of metadata chips (duration, tokens, tools, model, session) rendered
* under a completed subagent's header. Renders nothing when no metric fields
* are present, so the card degrades gracefully across agents.
*/
@@ -25,7 +25,6 @@ describe("subagentMetaChips", () => {
{ label: "duration", value: "2.2s" },
{ label: "tokens", value: "9,987 tokens" },
{ label: "tools", value: "0 tools" },
{ label: "agent", value: "agent_012345…" },
]);
});
@@ -55,7 +54,9 @@ describe("subagentMetaChips", () => {
expect(subagentMetaChips(payload)).toEqual([{ label: "tools", value: "0 tools" }]);
});
it("does not truncate short ids", () => {
expect(subagentMetaChips({ agent_id: "short" })).toEqual([{ label: "agent", value: "short" }]);
it("does not truncate short session ids", () => {
expect(subagentMetaChips({ child_session_id: "short" })).toEqual([
{ label: "session", value: "short" },
]);
});
});
@@ -27,8 +27,8 @@ function formatTools(count: number): string {
/**
* Turns a SubagentTaskPayload into an ordered list of display chips. Different
* agents populate different subsets (Claude: agent_id/tokens/duration/
* tool_use_count; OpenCode: model/child_session_id; Cursor: duration_ms only),
* agents populate different subsets (Claude: tokens/duration/tool_use_count;
* OpenCode: model/child_session_id; Cursor: duration_ms only),
* so each field is only included when meaningfully present. Duration and tokens
* are skipped when zero; tool_use_count is shown even at zero since "0 tools"
* is meaningful for a completed subagent.
@@ -50,9 +50,6 @@ export function subagentMetaChips(payload: SubagentTaskPayload | undefined): Sub
if (payload.model) {
chips.push({ label: "model", value: payload.model });
}
if (payload.agent_id) {
chips.push({ label: "agent", value: truncateId(payload.agent_id) });
}
if (payload.child_session_id) {
chips.push({ label: "session", value: truncateId(payload.child_session_id) });
}
@@ -47,7 +47,6 @@ test.describe("Mobile subagent card", () => {
await expect(card.locator('[data-testid="subagent-meta-duration"]')).toContainText("2.2s");
await expect(card.locator('[data-testid="subagent-meta-tokens"]')).toContainText("9,987");
await expect(card.locator('[data-testid="subagent-meta-tools"]')).toContainText("3 tools");
await expect(card.locator('[data-testid="subagent-meta-agent"]')).toContainText("agent_e2e");
// The subagent's internal tool call nests under its card (parentToolUseId).
await expect(card.locator('[data-testid="subagent-child-count"]')).toContainText("1 tool call");
-2
View File
@@ -55,8 +55,6 @@ test.describe("Subagent card", () => {
await expect(card.locator('[data-testid="subagent-meta-duration"]')).toContainText("2.2s");
await expect(card.locator('[data-testid="subagent-meta-tokens"]')).toContainText("9,987");
await expect(card.locator('[data-testid="subagent-meta-tools"]')).toContainText("3 tools");
// The agent id is truncated with an ellipsis, so assert on a substring.
await expect(card.locator('[data-testid="subagent-meta-agent"]')).toContainText("agent_e2e");
// The subagent's internal tool call is nested UNDER its card (the mock emits
// a child carrying `_meta.claudeCode.parentToolUseId`), not as a flat sibling.