@devries-cameron20 / t3code Mirror · read-only / commits / 8b74a69019
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 09:30 UTC

fix(web): background command details open above their button (#28446)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 31, 2026 at 17:54 UTC 8b74a69019e3d0f5be62dc118c526669002fc195
5 files changed +57 -7
apps/web/src/components/chat/ComposerBannerStack.browser.test.tsx
+26
@@ -1,6 +1,7 @@
1 import { InfoIcon } from "lucide-react";
2 import type { ReactNode } from "react";
3 import { expect, it, vi } from "vite-plus/test";
4 +import { page, userEvent } from "vite-plus/test/browser";
5
6 import "~/index.css";
7
@@ -123,3 +124,28 @@ it("shows the details button while text or nested text is cut, until it fits aga
124 await screen.rerender(<ComposerBanner.Root>{noticeRow("4rem", "Ready")}</ComposerBanner.Root>);
125 await expect.element(details).not.toBeInTheDocument();
126 });
127 +
128 +it("opens the details of a long notice right above its button", async () => {
129 + const viewport = { width: window.innerWidth, height: window.innerHeight };
130 + await page.viewport(1280, 800);
131 + await using _viewport = {
132 + [Symbol.asyncDispose]: () => page.viewport(viewport.width, viewport.height),
133 + };
134 + const script = Array.from({ length: 400 }, (_, line) => `echo "line ${line}"`).join("\n");
135 + const container = document.createElement("div");
136 + container.style.cssText = "position: fixed; bottom: 4rem; right: 4rem;";
137 + await using screen = await render(noticeRow("40rem", script), { container });
138 + const details = screen.getByRole("button", { name: "Show details" });
139 + await userEvent.hover(details);
140 + const popup = page.getByLabelText("Notice details");
141 + await expect.element(popup).toBeVisible();
142 +
143 + // A positioner sized to the unscrolled text flips beside the button and covers it.
144 + await vi.waitFor(() => {
145 + const gap =
146 + details.element().getBoundingClientRect().top -
147 + popup.element().getBoundingClientRect().bottom;
148 + expect(gap).toBeGreaterThanOrEqual(0);
149 + expect(gap).toBeLessThan(8);
150 + });
151 +});
apps/web/src/components/chat/ComposerBannerStack.tsx
+1 -3
@@ -155,9 +155,7 @@ export function NoticeText({
155 side="top"
156 className="max-w-[min(30rem,calc(100vw-2rem))] whitespace-normal wrap-anywhere [--inline-button-text-align:start] [--inline-button-white-space:normal] [&_[data-slot=inline-button]]:max-w-full"
157 >
158 - <ComposerBanner.Scroll className="max-h-[min(var(--available-height),24rem,40dvh)]">
159 - {children}
160 - </ComposerBanner.Scroll>
158 + <ComposerBanner.Scroll>{children}</ComposerBanner.Scroll>
159 </PopoverPopup>
160 </Popover>
161 ) : null}
apps/web/src/components/chat/ThreadActivityBanners.tsx
+8 -1
@@ -191,7 +191,14 @@ export function backgroundWorkNowItem(input: {
191 icon: rows.every(isCommand) ? <TerminalIcon /> : <CircleDashedIcon />,
192 title: only ? (
193 <>
194 - {verb} <span className={cn(isCommand(only) && "font-mono")}>{only.task.label}</span>
194 + {verb}{" "}
195 + <span
196 + className={cn(
197 + isCommand(only) && "font-mono in-data-[slot=popover-popup]:whitespace-pre-wrap",
198 + )}
199 + >
200 + {only.task.label}
201 + </span>
202 </>
203 ) : (
204 presentation.title
packages/client-runtime/src/state/threadExecution.test.ts
+14
@@ -25,6 +25,7 @@ import {
25 deriveRunlessWorkStartedAt,
26 deriveThreadActivityRun,
27 deriveThreadRuntime,
28 + presentPendingBackgroundWork,
29 presentProviderGoal,
30 presentRunStop,
31 threadRuntimeHasInterruptibleRun,
@@ -488,3 +489,16 @@ describe("presentProviderGoal", () => {
489 ).toBe("1m / 1m tokens");
490 });
491 });
492 +
493 +describe("presentPendingBackgroundWork", () => {
494 + it("names a command by its script, not the shell that wraps it", () => {
495 + const presentation = presentPendingBackgroundWork([
496 + {
497 + taskId: "call_1",
498 + kind: "command",
499 + description: `/bin/zsh -lc "mv a.ts b.ts\ncat > b.ts <<'EOF'\nexport {};\nEOF"`,
500 + },
501 + ]);
502 + expect(presentation?.items[0]?.label).toBe("mv a.ts b.ts\ncat > b.ts <<'EOF'\nexport {};\nEOF");
503 + });
504 +});
packages/client-runtime/src/state/threadExecution.ts
+8 -3
@@ -33,6 +33,7 @@ import {
33 type ThreadStructure,
34 type ThreadStructureRuntime,
35 } from "./models.ts";
36 +import { commandDisplayText } from "../work-log/commandLabel.ts";
37 import { formatSubagentDisplayTitle } from "./subagentDisplay.ts";
38
39 const ACTIVITY_RUN_STATUSES = new Set(["preparing", "starting", "running", "waiting"]);
@@ -370,9 +371,13 @@ export function presentPendingBackgroundWork(
371 .map((task): PendingBackgroundWorkItem => {
372 const description = task.description?.trim();
373 const label =
373 - task.kind === "subagent" && description !== undefined
374 - ? formatSubagentDisplayTitle(description).trim()
375 - : description;
374 + description === undefined
375 + ? undefined
376 + : task.kind === "subagent"
377 + ? formatSubagentDisplayTitle(description).trim()
378 + : task.kind === "command" || task.kind === "monitor"
379 + ? commandDisplayText(description)
380 + : description;
381 return {
382 taskId: task.taskId,
383 kind: task.kind,