fix(web): drop the redundant Environment-ready row + tighten popover top

The READY badge next to the executor name already conveys ready-state;
the dedicated "Environment ready · 12s" row above the executor info
just added vertical noise. Skip rendering for the ready phase (other
phases that surface non-redundant info — preparing, resuming, failed —
still render). Drop top padding on the executor info section now that
nothing sits above it on the happy path.
This commit is contained in:
José Almeida
2026-05-06 23:36:01 +01:00
parent 12956f1e9c
commit f8dd01b5a9
3 changed files with 9 additions and 34 deletions
@@ -1,7 +1,7 @@
"use client";
import { useMemo } from "react";
import { IconAlertTriangle, IconCheck, IconLoader2 } from "@tabler/icons-react";
import { IconAlertTriangle, IconLoader2 } from "@tabler/icons-react";
import { useAppStore } from "@/components/state-provider";
import type {
@@ -129,13 +129,13 @@ function lastIndexWhere<T>(items: T[], pred: (item: T) => boolean): number {
}
export function PrepareStatusSection({ summary }: { summary: PrepareSummary }) {
if (summary.phase === "idle") return null;
if (summary.phase === "idle" || summary.phase === "ready") return null;
if (summary.phase === "resuming") return <ResumingRow />;
if (summary.phase === "preparing" || summary.phase === "preparing_fallback") {
return <PreparingRow summary={summary} />;
}
if (summary.phase === "failed") return <FailedRow summary={summary} />;
return <ReadyRow summary={summary} />;
return null;
}
function ResumingRow() {
@@ -207,28 +207,3 @@ function FailedRow({ summary }: { summary: PrepareSummary }) {
</div>
);
}
function ReadyRow({ summary }: { summary: PrepareSummary }) {
return (
<div
data-testid="executor-prepare-status"
data-phase="ready"
className="border-b border-border px-3 py-2 flex items-center gap-2 text-xs text-muted-foreground"
>
<IconCheck className="h-3.5 w-3.5 text-green-500" />
<span>
Environment ready
{summary.durationMs ? ` · ${formatDuration(summary.durationMs)}` : ""}
</span>
</div>
);
}
function formatDuration(ms: number): string {
if (ms < 1000) return `${ms}ms`;
const secs = Math.round(ms / 1000);
if (secs < 60) return `${secs}s`;
const mins = Math.floor(secs / 60);
const remSecs = secs % 60;
return remSecs > 0 ? `${mins}m ${remSecs}s` : `${mins}m`;
}
@@ -143,7 +143,9 @@ describe("ExecutorSettingsButton", () => {
expect(screen.getByText(/Reconnecting to the existing environment/)).toBeTruthy();
});
it("shows an Environment ready row once preparation completes", async () => {
it("hides the prepare-status section once preparation completes", async () => {
// The READY badge next to the executor name conveys ready-state; the
// dedicated "Environment ready · 12s" row is redundant noise.
mockPrepareState = {
sessionId: SESSION_ID,
status: "completed",
@@ -154,9 +156,7 @@ describe("ExecutorSettingsButton", () => {
render(<ExecutorSettingsButton taskId={TASK_ID} sessionId={SESSION_ID} />);
screen.getByTestId(SETTINGS_BUTTON_TESTID).click();
const status = await screen.findByTestId(PREPARE_STATUS_TESTID);
expect(status.dataset.phase).toBe("ready");
expect(screen.getByText(/Environment ready/)).toBeTruthy();
expect(screen.getByText(/13s/)).toBeTruthy();
expect(screen.queryByTestId(PREPARE_STATUS_TESTID)).toBeNull();
expect(screen.queryByText(/Environment ready/)).toBeNull();
});
});
@@ -313,7 +313,7 @@ function EnvironmentInfo({
}
return (
<div className="px-3 pt-2 pb-1.5 space-y-1.5">
<div className="px-3 pb-1.5 space-y-1.5">
<div className="flex items-center justify-between gap-2">
<span className="font-medium text-foreground">{formatExecutorType(env.executor_type)}</span>
<StatusBadge env={env} container={container} />