Skip to content
Python

feat(gui): Steps header with mode and stamps, answer link (OPE-244)

Devika Verma2293dfcb4041
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index a5f03f87..4cb7be36 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -419,6 +419,8 @@ export function App() {
// team view; `stepsKey` moves on live step events and at a turn's end so it follows along.
const [stepsOpen, setStepsOpen] = useState(false);
const [stepsKey, setStepsKey] = useState(0);
+ // A turn's answer opened the panel: the answer's time picks the turn (unix seconds).
+ const [stepsAt, setStepsAt] = useState<{ ts?: number; n: number } | null>(null);
const [teamWorkerId, setTeamWorkerId] = useState<string | null>(null);
const [teamWorkerFilter, setTeamWorkerFilter] = useState<WorkerFilter | null>(null);
const [teamSummary, setTeamSummary] = useState<TeamSummary | null>(null);
@@ -2355,6 +2357,12 @@ export function App() {
setSurface("audit");
}}
onUndoMemory={(id, previous) => void undoMemorySave(id, previous)}
+ onOpenSteps={agent !== "chat" ? (ts) => {
+ setStepsAt((prev) => ({ ts, n: (prev?.n || 0) + 1 }));
+ setStepsOpen(true);
+ setTeamViewOpen(false);
+ setRailHidden(false);
+ } : undefined}
// §33 ref #3: sub-threshold streamed text renders INSIDE the live turn
// group (header when collapsed, quiet line when expanded) — never as a
// floating paragraph.
@@ -2631,7 +2639,7 @@ export function App() {
/>
</div>
<RightRail
- teamView={stepsOpen && sessionId ? <StepsPanel sessionId={sessionId} refreshKey={stepsKey} onClose={() => setStepsOpen(false)} /> : teamViewOpen ? <TeamView openKey={boardRailKey} board={boardOwner === sessionId ? board : null} summary={teamSummary?.lead_session === sessionId ? teamSummary : null} initialItem={boardDetailId} initialWorkerId={teamWorkerId} initialWorkerFilter={teamWorkerFilter} onOpenFullSession={(id) => { const w = sessions.find(s => s.session_id === id); if (w) void selectSession(w.session_id, w.workspace, w.agent); }} sessionId={sessionId} sessions={sessions} machine={machine} machineName={curSession?.machine_name} onClose={() => { setTeamViewOpen(false); setBoardDetailId(null); setTeamWorkerId(null); setTeamWorkerFilter(null); }} onRefresh={() => { void refreshBoard(); setBrowserRefreshKey(k => k + 1); }} /> : undefined}
+ teamView={stepsOpen && sessionId ? <StepsPanel sessionId={sessionId} refreshKey={stepsKey} openAt={stepsAt} onClose={() => setStepsOpen(false)} /> : teamViewOpen ? <TeamView openKey={boardRailKey} board={boardOwner === sessionId ? board : null} summary={teamSummary?.lead_session === sessionId ? teamSummary : null} initialItem={boardDetailId} initialWorkerId={teamWorkerId} initialWorkerFilter={teamWorkerFilter} onOpenFullSession={(id) => { const w = sessions.find(s => s.session_id === id); if (w) void selectSession(w.session_id, w.workspace, w.agent); }} sessionId={sessionId} sessions={sessions} machine={machine} machineName={curSession?.machine_name} onClose={() => { setTeamViewOpen(false); setBoardDetailId(null); setTeamWorkerId(null); setTeamWorkerFilter(null); }} onRefresh={() => { void refreshBoard(); setBrowserRefreshKey(k => k + 1); }} /> : undefined}
active={surface === "session" && agent !== "chat" && !railHidden}
sessionId={sessionId}
refreshKey={browserRefreshKey}
diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.ts
index e4488d5f..314a35ce 100644
--- a/surfaces/gui/src/api.ts
+++ b/surfaces/gui/src/api.ts
@@ -4401,6 +4401,10 @@ export interface RecordedTurn {
stamp: Record<string, any>;
buckets: Record<string, any>;
usage: Record<string, any>;
+ // The approval mode and auto-approver at turn start (UX-059 OB-1 header pill).
+ approval_mode?: string | null;
+ attended?: boolean | null;
+ reviewer?: { active?: boolean; shadow?: boolean; kind?: string | null; model?: string | null } | null;
}
export interface RecordedStep {
diff --git a/surfaces/gui/src/components/StepsPanel.test.tsx b/surfaces/gui/src/components/StepsPanel.test.tsx
index 2cefdb2e..3e4bdf9a 100644
--- a/surfaces/gui/src/components/StepsPanel.test.tsx
+++ b/surfaces/gui/src/components/StepsPanel.test.tsx
@@ -216,6 +216,48 @@ describe("StepsPanel", () => {
expect((await screen.findByTestId("steps-questions")).textContent).toContain("unrelated_destination: yes (0.99)");
});
+ it("shows the mode, the reviewer and the turn's stamps in the header", async () => {
+ // UX-059 OB-1 mode pill; OB-12, OB-14, OB-15 stamp line.
+ vi.mocked(getRecordedTurns).mockResolvedValue([{ ...turn,
+ approval_mode: "auto-approve", reviewer: { active: true, shadow: false, kind: "session_model", model: "openrouter:model-b" },
+ buckets: { ...turn.buckets, auto_approver: 2900 },
+ stamp: { machine: { kind: "this_machine", name: "DESKTOP-1", app_version: "0.2.3" }, sandbox: { provider: "direct", enforcement: "none" },
+ persona_fp: "c5dc98", model: { id: "openrouter:model-b", provider_title: "OpenRouter" } } }] as any);
+ vi.mocked(getTurnSteps).mockResolvedValue(steps as any);
+ render(<StepsPanel sessionId="s1" onClose={() => {}} />);
+ expect((await screen.findByTestId("steps-mode")).textContent).toBe("Auto-approve · session model (openrouter:model-b)");
+ const stamp = screen.getByTestId("steps-stamp").textContent || "";
+ for (const part of ["DESKTOP-1 · 0.2.3", "No sandbox", "ⓕc5dc98", "openrouter:model-b · OpenRouter"]) expect(stamp).toContain(part);
+ expect((await screen.findByTestId("steps-checks")).textContent).toContain("1 check · 1 allowed · 0 asked you · 0 blocked · 2.9s · session model (openrouter:model-b)");
+ });
+
+ it("names a shadow reviewer and a sandbox", async () => {
+ vi.mocked(getRecordedTurns).mockResolvedValue([{ ...turn, approval_mode: "interactive",
+ reviewer: { active: false, shadow: true, kind: "openai_decisions", model: null },
+ stamp: { machine: { kind: "cloud", name: "box-7" }, sandbox: { provider: "OpenShell", enforcement: "full", profile: "limited" } } }] as any);
+ vi.mocked(getTurnSteps).mockResolvedValue([] as any);
+ render(<StepsPanel sessionId="s1" onClose={() => {}} />);
+ expect((await screen.findByTestId("steps-mode")).textContent).toBe("Ask for approval · shadow: OpenAI Decisions");
+ expect(screen.getByTestId("steps-stamp").textContent).toContain("box-7 (cloud)");
+ expect(screen.getByTestId("steps-stamp").textContent).toContain("OpenShell · enforced · network limited");
+ });
+
+ it("opens the turn an answer's Steps link points at", async () => {
+ // UX-059 OB-1: the "Steps" link in a turn's footer. The answer's time picks the turn.
+ // The next message was sent within a second of turn 1's answer (round-2 check).
+ const turns = [{ ...turn, turn_id: "t1", seq: 1, started_at: 1_000_000, duration_ms: 4_200 },
+ { ...turn, turn_id: "t2", seq: 2, started_at: 1_004_600, duration_ms: 3_000 },
+ { ...turn, turn_id: "t3", seq: 3, started_at: 3_000_000, duration_ms: null }];
+ vi.mocked(getRecordedTurns).mockResolvedValue(turns as any);
+ vi.mocked(getTurnSteps).mockResolvedValue(steps as any);
+ const { rerender } = render(<StepsPanel sessionId="s1" openAt={{ ts: 1004, n: 1 }} onClose={() => {}} />);
+ await screen.findByText("Turn 1 of 3");
+ rerender(<StepsPanel sessionId="s1" openAt={{ ts: 1007, n: 2 }} onClose={() => {}} />);
+ await screen.findByText("Turn 2 of 3");
+ rerender(<StepsPanel sessionId="s1" openAt={{ ts: 3010, n: 3 }} onClose={() => {}} />);
+ await screen.findByText("Turn 3 of 3");
+ });
+
it("says when a session has no recorded steps", async () => {
vi.mocked(getRecordedTurns).mockResolvedValue([]);
render(<StepsPanel sessionId="old" onClose={() => {}} />);
diff --git a/surfaces/gui/src/components/StepsPanel.tsx b/surfaces/gui/src/components/StepsPanel.tsx
index 7a4865d0..6d79ecbf 100644
--- a/surfaces/gui/src/components/StepsPanel.tsx
+++ b/surfaces/gui/src/components/StepsPanel.tsx
@@ -28,6 +28,52 @@ export function formatDuration(ms: number | null | undefined): string {
return s ? `${m}m ${s}s` : `${m}m`;
}
+const MODE_KEYS: Record<string, string> = {
+ discuss: "composer.mode.discuss", interactive: "composer.mode.interactive", plan: "steps.mode.plan",
+ "auto-approve": "composer.mode.auto_approve", "bypass-approvals": "composer.mode.auto", auto: "composer.mode.auto",
+ "dangerously-bypass-approvals": "steps.mode.dangerous",
+};
+
+/** Who reviews in Auto-approve or Shadow evaluation: the session model by name, or the service. */
+export function reviewerLabel(r: RecordedTurn["reviewer"], t: (k: string, o?: any) => string): string {
+ if (!r || !r.kind) return "";
+ if (r.kind === "session_model") return r.model ? t("steps.reviewer.session_model_named", { model: r.model }) : t("steps.reviewer.session_model");
+ return t(`steps.reviewer.${r.kind}`, { defaultValue: r.kind });
+}
+
+/** The mode pill (OB-1): the approval mode, and in Auto-approve or Shadow evaluation the reviewer. */
+export function modeLabel(turn: RecordedTurn, t: (k: string, o?: any) => string): string {
+ if (!turn.approval_mode) return "";
+ const mode = t(MODE_KEYS[turn.approval_mode] || "", { defaultValue: turn.approval_mode });
+ const r = turn.reviewer;
+ const who = reviewerLabel(r, t);
+ if (r?.active && who) return `${mode} · ${who}`;
+ if (r?.shadow && who) return `${mode} · ${t("steps.reviewer.shadow", { reviewer: who })}`;
+ return mode;
+}
+
+/** The header's stamp line (OB-12, OB-14, OB-15): machine · sandbox · coworker · model and provider. */
+export function stampLine(stamp: Record<string, any> | undefined, t: (k: string, o?: any) => string): string {
+ if (!stamp) return "";
+ const parts: string[] = [];
+ const m = stamp.machine;
+ if (m) {
+ const where = m.kind && m.kind !== "this_machine" ? ` (${t(`steps.machine.${m.kind}`, { defaultValue: m.kind })})` : "";
+ parts.push(`${m.name || t("steps.machine.this_machine")}${where}${m.app_version ? ` · ${m.app_version}` : ""}`);
+ }
+ const sb = stamp.sandbox;
+ if (sb) {
+ parts.push(!sb.enforcement || sb.enforcement === "none" || sb.provider === "direct"
+ ? t("steps.sandbox.none")
+ : [sb.provider, t(`steps.sandbox.${sb.enforcement}`, { defaultValue: sb.enforcement }),
+ sb.profile ? t("steps.sandbox.network", { profile: sb.profile }) : ""].filter(Boolean).join(" · "));
+ }
+ if (stamp.persona_fp) parts.push(`ⓕ${stamp.persona_fp}`);
+ const md = stamp.model;
+ if (md?.id) parts.push([md.id, md.provider_title].filter(Boolean).join(" · "));
+ return parts.join(" · ");
+}
+
function formatBytes(n: number): string {
if (n < 1024) return `${n} B`;
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
@@ -121,10 +167,13 @@ function nest(steps: RecordedStep[]): { step: RecordedStep; depth: number }[] {
export function StepsPanel({
sessionId,
refreshKey = 0,
+ openAt = null,
onClose,
}: {
sessionId: string;
refreshKey?: number;
+ // Opened from a turn's answer: its time (unix seconds) picks the turn that produced it.
+ openAt?: { ts?: number; n: number } | null;
onClose: () => void;
}) {
const { t } = useTranslation();
@@ -156,6 +205,16 @@ export function StepsPanel({
};
}, [sessionId, refreshKey]);
+ // An answer's Steps link: the first turn that had not ended before that answer (the turns
+ // before it all ended earlier). The answer's time is in whole seconds, hence the second's slack.
+ useEffect(() => {
+ if (!openAt || !turns || !turns.length || openAt.ts == null) return;
+ const at = openAt.ts * 1000 - 1000;
+ const idx = turns.findIndex((tn) => tn.duration_ms == null || tn.started_at + tn.duration_ms >= at);
+ setTurnIdx(idx < 0 ? turns.length - 1 : idx);
+ setTab("timeline");
+ }, [openAt?.n, turns]); // eslint-disable-line react-hooks/exhaustive-deps
+
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]);
@@ -185,6 +244,12 @@ export function StepsPanel({
<button className="team-close" aria-label={t("steps.close")} onClick={onClose}>×</button>
</div>
+ {turn && (modeLabel(turn, t) || stampLine(turn.stamp, t)) && (
+ <div className="steps-stamp" data-testid="steps-stamp">
+ {modeLabel(turn, t) && <span className="steps-mode" data-testid="steps-mode">{modeLabel(turn, t)}</span>}
+ {stampLine(turn.stamp, t) && <span className="steps-stamp-line">{stampLine(turn.stamp, t)}</span>}
+ </div>
+ )}
{error && <p className="steps-empty">{t("steps.load_error")}</p>}
{turns && turns.length === 0 && <p className="steps-empty" data-testid="steps-none">{t("steps.not_recorded")}</p>}
@@ -209,6 +274,8 @@ export function StepsPanel({
allowed: checks.filter((c) => c.attrs.result === "allow").length,
asked: checks.filter((c) => c.attrs.result !== "allow" && c.attrs.result !== "deny").length,
blocked: checks.filter((c) => c.attrs.result === "deny").length,
+ time: formatDuration(turn.buckets.auto_approver || 0),
+ reviewer: reviewerLabel(turn.reviewer, t) || reviewerLabel(checks[0]?.attrs?.reviewer, t) || "—",
})}
</p>
)}
diff --git a/surfaces/gui/src/components/Transcript.test.tsx b/surfaces/gui/src/components/Transcript.test.tsx
index 71f33f02..3da89130 100644
--- a/surfaces/gui/src/components/Transcript.test.tsx
+++ b/surfaces/gui/src/components/Transcript.test.tsx
@@ -410,4 +410,13 @@ describe("mode notice", () => {
expect(screen.queryByTestId("mode-notice")).toBeNull();
expect(screen.getByText("Context compacted").className).not.toContain("notice-block");
});
+
+ it("offers the turn's steps from its answer", () => {
+ // UX-059 OB-1: a "Steps" link in each answer's footer, with the answer's time.
+ const onOpenSteps = vi.fn();
+ render(<Transcript items={[{ kind: "user", text: "hi", ts: 100 }, { kind: "assistant", text: "hello", ts: 105 }] as any}
+ onApprove={() => {}} onOpenSteps={onOpenSteps} />);
+ fireEvent.click(screen.getByTestId("bubble-steps"));
+ expect(onOpenSteps).toHaveBeenCalledWith(105);
+ });
});
diff --git a/surfaces/gui/src/components/Transcript.tsx b/surfaces/gui/src/components/Transcript.tsx
index e400f638..878084b9 100644
--- a/surfaces/gui/src/components/Transcript.tsx
+++ b/surfaces/gui/src/components/Transcript.tsx
@@ -37,7 +37,7 @@ function ClampedUserText({ text }: { text: string }) {
// Lives in a ZERO-HEIGHT strip under the bubble (absolute, inside the transcript's 20px gap)
// so revealing it on group-hover never shifts the layout. `ts` is unix seconds — canonical
// messages carry it, pre-stamp history doesn't, so the time simply omits itself when absent.
-function BubbleMeta({ text, ts, align }: { text: string; ts?: number; align: "left" | "right" }) {
+function BubbleMeta({ text, ts, align, onOpenSteps }: { text: string; ts?: number; align: "left" | "right"; onOpenSteps?: (ts?: number) => void }) {
const { t } = useTranslation();
const [copied, setCopied] = useState(false);
const when = typeof ts === "number" ? new Date(ts * 1000) : null;
@@ -73,6 +73,17 @@ function BubbleMeta({ text, ts, align }: { text: string; ts?: number; align: "le
{when.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })}
</span>
)}
+ {onOpenSteps && (
+ // UX-059 OB-1: the turn's steps, from its answer.
+ <button
+ className="cursor-pointer hover:text-muted"
+ data-testid="bubble-steps"
+ title={t("steps.open_title")}
+ onClick={() => onOpenSteps(ts)}
+ >
+ {t("steps.open")}
+ </button>
+ )}
</div>
</div>
);
@@ -487,6 +498,8 @@ interface Props {
// OPE-238: open Activity on one tool call's audit rows (from the "changes made without
// asking" summary). Without it the summary shows no audit links.
onOpenAudit?: (callId: string) => void;
+ // UX-059 OB-1: open the Steps panel at the turn that ended with this answer (its time).
+ onOpenSteps?: (ts?: number) => void;
}
// The transcript index whose notice gets the Retry button: the tail error notice, looking
@@ -546,7 +559,7 @@ function McpNotice({
}
-export function Transcript({ items, running, streamingText, onRetry, onOpenConnectors, onUndoMemory, onAllowAnyway, onOpenAudit }: Props) {
+export function Transcript({ items, running, streamingText, onRetry, onOpenConnectors, onUndoMemory, onAllowAnyway, onOpenAudit, onOpenSteps }: Props) {
const { t } = useTranslation();
// §33 grouping: a turn = the maximal run of assistant/tool/resolved-approval items between
// breakers (user, connector, notices, plan/dir requests…). Trailing assistant texts are the
@@ -666,7 +679,7 @@ export function Transcript({ items, running, streamingText, onRetry, onOpenConne
<div className="who">{t("transcript.who_assistant")}</div>
{item.reasoning && <ThinkingBlock text={item.reasoning} />}
<Markdown text={item.text} />
- <BubbleMeta text={item.text} ts={item.ts} align="left" />
+ <BubbleMeta text={item.text} ts={item.ts} align="left" onOpenSteps={onOpenSteps} />
</div>
);
case "dirreq":
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 737be490..0beff1a3 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -3059,10 +3059,33 @@
"summary": "Summary",
"other": "Other"
},
- "checks_line_one": "Auto-approve: {{count}} check · {{allowed}} allowed · {{asked}} asked you · {{blocked}} blocked",
- "checks_line_other": "Auto-approve: {{count}} checks · {{allowed}} allowed · {{asked}} asked you · {{blocked}} blocked",
+ "checks_line_one": "Auto-approve: {{count}} check · {{allowed}} allowed · {{asked}} asked you · {{blocked}} blocked · {{time}} · {{reviewer}}",
+ "checks_line_other": "Auto-approve: {{count}} checks · {{allowed}} allowed · {{asked}} asked you · {{blocked}} blocked · {{time}} · {{reviewer}}",
"unknown_line_one": "{{count}} step was still running when OpenWorker stopped; its time is unknown.",
"unknown_line_other": "{{count}} steps were still running when OpenWorker stopped; their times are unknown.",
+ "mode": {
+ "plan": "Plan",
+ "dangerous": "Dangerous full access"
+ },
+ "reviewer": {
+ "session_model": "session model",
+ "session_model_named": "session model ({{model}})",
+ "openai_decisions": "OpenAI Decisions",
+ "typesafe_jev": "TypeSafe Jev",
+ "shadow": "shadow: {{reviewer}}"
+ },
+ "machine": {
+ "this_machine": "This machine",
+ "cloud": "cloud",
+ "remote": "remote machine",
+ "joined": "joined machine"
+ },
+ "sandbox": {
+ "none": "No sandbox",
+ "full": "enforced",
+ "partial": "partly enforced",
+ "network": "network {{profile}}"
+ },
"row": {
"context": "Context built",
"model": "Model",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index eb86b7f0..b320edde 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -3015,9 +3015,32 @@
"summary": "摘要",
"other": "其他"
},
- "checks_line_other": "自动审批:{{count}} 次检查 · {{allowed}} 次允许 · {{asked}} 次询问你 · {{blocked}} 次阻止",
+ "checks_line_other": "自动审批:{{count}} 次检查 · {{allowed}} 次允许 · {{asked}} 次询问你 · {{blocked}} 次阻止 · {{time}} · {{reviewer}}",
"unknown_line_one": "{{count}} 个步骤在 OpenWorker 停止时仍在运行,其用时未知。",
"unknown_line_other": "{{count}} 个步骤在 OpenWorker 停止时仍在运行,其用时未知。",
+ "mode": {
+ "plan": "计划",
+ "dangerous": "危险的完全访问"
+ },
+ "reviewer": {
+ "session_model": "会话模型",
+ "session_model_named": "会话模型({{model}})",
+ "openai_decisions": "OpenAI Decisions",
+ "typesafe_jev": "TypeSafe Jev",
+ "shadow": "影子:{{reviewer}}"
+ },
+ "machine": {
+ "this_machine": "本机",
+ "cloud": "云端",
+ "remote": "远程机器",
+ "joined": "已加入的机器"
+ },
+ "sandbox": {
+ "none": "无沙箱",
+ "full": "强制执行",
+ "partial": "部分执行",
+ "network": "网络 {{profile}}"
+ },
"row": {
"context": "构建上下文",
"model": "模型",
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index 7a179bfe..b2cfae01 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -2432,6 +2432,9 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:
.steps-turn-picker button { padding:2px 6px!important; }
.steps-turn-picker button:disabled { opacity:.35; cursor:default; }
.steps-body { flex:1; min-height:0; overflow:auto; padding:12px 14px 20px; }
+.steps-stamp { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:8px 14px 0; font-size:var(--fs-meta); color:var(--muted); }
+.steps-mode { padding:1px 8px; border-radius:999px; background:var(--chrome-hover); color:var(--ink); white-space:nowrap; }
+.steps-stamp-line { min-width:0; overflow-wrap:anywhere; }
.steps-empty { padding:16px 14px; color:var(--muted); font-size:var(--fs-ui); }
.steps-tiles { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:10px; }
.steps-tile { background:var(--chrome-hover); border-radius:8px; padding:9px 10px; display:flex; flex-direction:column; gap:2px; }