Skip to content
Python

fix(gui): Steps panel fixes from the in-app check (OPE-244)

Devika Vermabe474879b828
diff --git a/surfaces/gui/src/components/StepsPanel.test.tsx b/surfaces/gui/src/components/StepsPanel.test.tsx
index 29822f33..cfff3890 100644
--- a/surfaces/gui/src/components/StepsPanel.test.tsx
+++ b/surfaces/gui/src/components/StepsPanel.test.tsx
@@ -94,6 +94,21 @@ describe("StepsPanel", () => {
expect(usage.textContent).toContain("1 call did not report usage");
});
+ it("closes a step's details when another turn is picked", async () => {
+ const turn2 = { ...turn, turn_id: "t2", seq: 2 };
+ vi.mocked(getRecordedTurns).mockResolvedValue([turn, turn2] as any);
+ vi.mocked(getTurnSteps).mockResolvedValue(steps as any);
+ vi.mocked(getStepDetail).mockResolvedValue(steps[1]);
+ render(<StepsPanel sessionId="s1" onClose={() => {}} />);
+ await screen.findByText("Turn 2 of 2");
+ await waitFor(() => expect(screen.getAllByTestId("steps-row")).toHaveLength(6));
+ fireEvent.click(screen.getAllByTestId("steps-row")[1]);
+ await screen.findByTestId("steps-details");
+ fireEvent.click(screen.getByRole("button", { name: "Previous turn" }));
+ await screen.findByText("Turn 1 of 2");
+ expect(screen.queryByTestId("steps-details")).toBeNull();
+ });
+
it("says when a session has no recorded steps", async () => {
vi.mocked(getRecordedTurns).mockResolvedValue([]);
render(<StepsPanel sessionId="old" onClose={() => {}} />);
@@ -104,6 +119,8 @@ describe("StepsPanel", () => {
describe("formatDuration", () => {
it("reads like the mock", () => {
expect(formatDuration(100)).toBe("0.1s");
+ expect(formatDuration(4)).toBe("<0.1s");
+ expect(formatDuration(0)).toBe("0.0s");
expect(formatDuration(3400)).toBe("3.4s");
expect(formatDuration(41_000)).toBe("41s");
expect(formatDuration(134_000)).toBe("2m 14s");
diff --git a/surfaces/gui/src/components/StepsPanel.tsx b/surfaces/gui/src/components/StepsPanel.tsx
index 756be783..c2cebe86 100644
--- a/surfaces/gui/src/components/StepsPanel.tsx
+++ b/surfaces/gui/src/components/StepsPanel.tsx
@@ -20,6 +20,7 @@ const BUCKETS = ["waiting", "tools", "model", "auto_approver", "summary"] as con
/** 0.1s, 3.4s, 41s, 2m 14s: the panel's one duration format. */
export function formatDuration(ms: number | null | undefined): string {
if (ms == null || !Number.isFinite(ms)) return "—";
+ if (ms > 0 && ms < 100) return "<0.1s";
if (ms < 10_000) return `${(ms / 1000).toFixed(1)}s`;
if (ms < 60_000) return `${Math.round(ms / 1000)}s`;
const m = Math.floor(ms / 60_000);
@@ -105,6 +106,8 @@ export function StepsPanel({
}, [sessionId, refreshKey]);
const turn = turns && turnIdx != null && turnIdx >= 0 ? turns[turnIdx] : null;
+ // A step's details belong to its turn: picking another turn closes them.
+ useEffect(() => setSelected(null), [turn?.turn_id]);
useEffect(() => {
if (!turn) return;
let live = true;
@@ -242,6 +245,7 @@ function StepDetails({ sessionId, stepId, turn }: { sessionId: string; stepId: s
if (a.ttft_ms != null) rows.push([t("steps.detail.ttft"), formatDuration(a.ttft_ms)]);
if (a.finish_reason) rows.push([t("steps.detail.stopped"), a.finish_reason]);
if (a.tools_offered) rows.push([t("steps.detail.tools"), `${a.tools_offered} · ${a.tools_hash || ""}`]);
+ if (turn.stamp?.persona_fp) rows.push([t("steps.detail.coworker"), `ⓕ${turn.stamp.persona_fp}`]);
if (a.error) rows.push([t("steps.detail.error"), `${a.error.type}${a.error.text ? ` · ${a.error.text}` : ""}`]);
}
if (d.kind === "tool") {
@@ -294,7 +298,7 @@ function StepDetails({ sessionId, stepId, turn }: { sessionId: string; stepId: s
))}
</ol>
)}
- {d.message && (
+ {d.message && d.message.content && (
<pre className="steps-pre">{d.message.content}{d.message.cut ? "\n…" : ""}</pre>
)}
{d.exchange_rebuilt?.length > 0 && (
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 4f2730db..e651d0df 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -3145,6 +3145,7 @@
"mode": "Mode",
"reviewer": "Reviewer",
"reason": "Reason",
+ "coworker": "Coworker fingerprint",
"session_prompt": "Session prompt",
"size": "Context block size"
},
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index b9fad4a1..7177014b 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -3100,6 +3100,7 @@
"mode": "模式",
"reviewer": "审批者",
"reason": "原因",
+ "coworker": "协作者指纹",
"session_prompt": "会话提示词",
"size": "上下文块大小"
},