fix(web): render the subagent expansion below the tool call's own content (#33)

Co-authored-by: Alice <alice@prismshadow.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-07-23 00:43:47 +08:00
1 parent 829ca57a43
commit 9a1257b2be
2 files changed
+30 -13

No files matched your search

+16
View File
@@ -84,6 +84,22 @@ test("subagent card survives a reload; child session title is generated from its
// Under live streaming, the child session card is nested inside the run_subagent tool card.
await openSubagent();
// --- DOM order: the subagent expansion renders BELOW the tool's own content ---
// Expand the run_subagent tool card itself so its arguments block is in the DOM, then assert
// the child-session card comes after it in document order (it used to render between the tool
// header and the expanded arguments/output).
const toolRow = page.locator("button[aria-expanded]").filter({ hasText: "run_subagent" }).first();
await toolRow.click();
await expect(toolRow).toHaveAttribute("aria-expanded", "true");
const argsPre = page.locator("pre", { hasText: '"prompt"' }).first();
await expect(argsPre).toBeVisible();
const subagentBtn = page.getByRole("button", { name: /子会话/ }).first();
const cardFollowsArgs = await argsPre.evaluate(
(pre, card) => Boolean(pre.compareDocumentPosition(card) & Node.DOCUMENT_POSITION_FOLLOWING),
await subagentBtn.elementHandle(),
);
expect(cardFollowsArgs, "subagent expansion renders below the tool arguments/output").toBe(true);
// --- Must still hold after reload (the fix's goal: parent Trace's child session pointer + server-side expansion) ---
await page.reload();
await openSubagent();