Skip to content
Python

Align team disclosures and simplify worker approval cards

Rohit C Prasadede4320f33e2
diff --git a/surfaces/gui/e2e/team-polish.spec.ts b/surfaces/gui/e2e/team-polish.spec.ts
new file mode 100644
index 00000000..8007ec4e
--- /dev/null
+++ b/surfaces/gui/e2e/team-polish.spec.ts
@@ -0,0 +1,70 @@
+import { expect } from "@playwright/test";
+import { test, sendSessionEvent } from "./fixtures";
+
+const theme = process.env.TEAM_POLISH_THEME === "dark" ? "dark" : "light";
+test.beforeEach(async ({ page }) => {
+ await page.addInitScript(value => localStorage.setItem("openwork-theme", value), theme);
+});
+
+test("completed, created and running disclosure rows share geometry", async ({ page }) => {
+ await page.setViewportSize({ width: 1120, height: 900 });
+ await page.goto("/");
+ await sendSessionEvent(page, { type: "turn_start", data: { input: "Prepare the Acme team" } });
+ await sendSessionEvent(page, { type: "tool_proposed", data: { name: "propose_team", arguments: {} } });
+ await sendSessionEvent(page, { type: "tool_finished", data: { name: "propose_team", status: "ok",
+ display: { team_created: { team_id: "acme-team", workers: [{ actor: "Sam", persona: "swe-worker" }, { actor: "Maya", persona: "test-worker" }] } } } });
+ await sendSessionEvent(page, { type: "tool_proposed", data: { name: "list_items", arguments: {} } });
+ const headers = page.locator(".transcript > details > .transcript-disclosure");
+ await expect(headers).toHaveCount(3);
+ const boxes = await headers.evaluateAll(nodes => nodes.map(node => {
+ const rect = node.getBoundingClientRect();
+ const icon = node.querySelector("svg")!.getBoundingClientRect();
+ const label = node.querySelector("span")!.getBoundingClientRect();
+ return { x: rect.x, y: rect.y, height: rect.height, iconX: icon.x, iconCenter: icon.y + icon.height / 2,
+ center: rect.y + rect.height / 2, labelX: label.x };
+ }));
+ for (const box of boxes) {
+ expect(Math.abs(box.iconX - boxes[0].iconX)).toBeLessThan(1);
+ expect(Math.abs(box.labelX - boxes[0].labelX)).toBeLessThan(1);
+ expect(Math.abs(box.height - boxes[0].height)).toBeLessThan(1);
+ expect(Math.abs(box.iconCenter - box.center)).toBeLessThan(1);
+ }
+ expect(Math.abs((boxes[1].y - boxes[0].y) - (boxes[2].y - boxes[1].y))).toBeLessThan(1);
+ await page.screenshot({ path: `test-results/team-disclosures-aligned-${theme}.png` });
+});
+
+for (const width of [1440, 1000, 760]) {
+ test(`sleeping strip matches the composer at ${width}px`, async ({ page }) => {
+ await page.setViewportSize({ width: 1440, height: 1000 });
+ await page.goto("/");
+ await page.getByPlaceholder(/Ask the coworker/).fill("staff the team");
+ await page.getByRole("button", { name: "Send" }).click();
+ await page.getByTestId("teamreq-approve").click();
+ await page.locator(".sidebar").getByText("Build the statements page").click();
+ await page.setViewportSize({ width, height: 1000 });
+ const strip = page.getByTestId("sleep-strip");
+ await expect(strip).toBeVisible();
+ const s = (await strip.boundingBox())!;
+ const c = (await page.locator(".composer").boundingBox())!;
+ expect(Math.abs(s.x - c.x)).toBeLessThan(1);
+ expect(Math.abs(s.width - c.width)).toBeLessThan(1);
+ expect(await strip.evaluate(e => e.scrollWidth <= e.clientWidth)).toBe(true);
+ await page.locator(".composer-wrap").screenshot({ path: `test-results/team-sleep-${width}-${theme}.png` });
+ });
+}
+
+test("lead approval shows the full command once and retains the lead explanation", async ({ page }) => {
+ await page.goto("/");
+ const command = "cd /workspace/acme/billing-service && npm run build";
+ await sendSessionEvent(page, { type: "permission_required", data: {
+ name: "decide_worker_call", arguments: { worker: "Maya", call_id: "worker-call", decision: "allow", note: "The build verifies the assigned task." },
+ worker_call: { tool: "run_shell", worker: "Maya", arguments: { command, description: "Verify the build" },
+ reason: `command: ${command} · description: Verify the build`, state: "pending" },
+ } });
+ const card = page.getByTestId("workerdec-card");
+ await expect(card).toBeVisible();
+ expect((await card.textContent())!.split(command)).toHaveLength(2);
+ await expect(card.locator(".approval-reason")).toHaveCount(0);
+ await expect(card).toContainText("The build verifies the assigned task.");
+ await card.screenshot({ path: `test-results/team-worker-command-once-${theme}.png` });
+});
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index 062a4a62..f74829c3 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -2310,32 +2310,6 @@ export function App() {
}}
/>
)}
- {/* A scheduled agent must never read as a dead one: while a self-wake is
- pending and no turn is running, say so and offer the obvious action. */}
- {activeInfo?.liveness === "sleeping" && !running && (
- <div className="sleep-strip" data-testid="sleep-strip">
- <span className="sleep-dot" />
- <span className="sleep-text">
- {t("app.sleep.label")}
- {activeInfo.sleeping_until
- ? t("app.sleep.until", {
- time: new Date(activeInfo.sleeping_until).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }),
- })
- : ""}
- {activeInfo.team?.role === "lead"
- ? t("app.sleep.team_clause")
- : t("app.sleep.trigger_clause")}{" "}
- {t("app.sleep.talk_anytime")}
- </span>
- <button
- className="btn sm"
- data-testid="sleep-status-btn"
- onClick={() => send(t("app.sleep.status_prompt"))}
- >
- {t("app.sleep.ask_status")}
- </button>
- </div>
- )}
{!connected && !booting && !currentRowOffline && !(isCloudMode() && !machine) && (
<div className="reconnecting-strip" data-testid="session-reconnecting" role="status">
{machine ? t("misc.app.machine_reconnecting") : t("misc.app.reconnecting")}
@@ -2347,6 +2321,25 @@ export function App() {
</div>
)}
<Composer
+ statusSlot={activeInfo?.liveness === "sleeping" && !running ? (
+ <div className="sleep-strip" data-testid="sleep-strip">
+ <span className="sleep-dot" />
+ <span className="sleep-text">
+ {t("app.sleep.label")}
+ {activeInfo.sleeping_until
+ ? t("app.sleep.until", {
+ time: new Date(activeInfo.sleeping_until).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }),
+ }) : ""}
+ {activeInfo.team?.role === "lead"
+ ? t("app.sleep.team_clause") : t("app.sleep.trigger_clause")}{" "}
+ {t("app.sleep.talk_anytime")}
+ </span>
+ <button className="btn sm" data-testid="sleep-status-btn"
+ onClick={() => send(t("app.sleep.status_prompt"))}>
+ {t("app.sleep.ask_status")}
+ </button>
+ </div>
+ ) : undefined}
teamSlot={curSession?.team?.role === "lead" && teamSummary?.lead_session === sessionId ? <TeamQuickLook key={sessionId} summary={teamSummary} onOpen={openTeamView} machine={curSession?.machine_name} /> : undefined}
mode={mode}
// §11.6: a worker's approvals follow its lead — the picker is read-only for it.
diff --git a/surfaces/gui/src/components/Composer.tsx b/surfaces/gui/src/components/Composer.tsx
index adf6f0d2..325e7160 100644
--- a/surfaces/gui/src/components/Composer.tsx
+++ b/surfaces/gui/src/components/Composer.tsx
@@ -125,6 +125,7 @@ interface Props {
// The pending-approval card rendered above the input (plan / work-items / team / tool /
// folder requests). Attended sessions only — Unattended parks the prompt in the Inbox.
approvalSlot?: ReactNode;
+ statusSlot?: ReactNode;
teamSlot?: ReactNode;
// UX-044: "View & edit…" in the Project memory submenu routes to the memory panel.
onOpenMemory?: () => void;
@@ -552,6 +553,7 @@ export function Composer(props: Props) {
return (
<div className="composer-wrap px-6 pb-5 pt-4">
+ {props.statusSlot && <div className="max-w-3xl mx-auto mb-3">{props.statusSlot}</div>}
{props.approvalSlot}
{dictationError && (
diff --git a/surfaces/gui/src/components/TeamUpdateLine.tsx b/surfaces/gui/src/components/TeamUpdateLine.tsx
index ce22790b..644802ea 100644
--- a/surfaces/gui/src/components/TeamUpdateLine.tsx
+++ b/surfaces/gui/src/components/TeamUpdateLine.tsx
@@ -108,7 +108,7 @@ export function TeamUpdateLine({
open={defaultOpen || undefined}
data-testid="team-update"
>
- <summary className="team-update-head">
+ <summary className="team-update-head transcript-disclosure">
<Icon name="chevronDown" size={12} />
<span>
{rows.length
@@ -185,12 +185,12 @@ export function TeamCreatedLine({
const { t } = useTranslation();
return (
<details className="team-update" data-testid="team-created">
- <summary className="team-update-head">
+ <summary className="team-update-head transcript-disclosure">
<Icon name="chevronDown" size={12} />
- {t("teamview.created", {
+ <span>{t("teamview.created", {
count: workers.length,
roles: new Set(workers.map((w) => w.persona)).size,
- })}
+ })}</span>
</summary>
<div className="team-update-body">
{workers.map((w) => (
diff --git a/surfaces/gui/src/components/Transcript.tsx b/surfaces/gui/src/components/Transcript.tsx
index b8c0fe8c..b1b5a1ac 100644
--- a/surfaces/gui/src/components/Transcript.tsx
+++ b/surfaces/gui/src/components/Transcript.tsx
@@ -389,13 +389,13 @@ function TurnGroup({
return (
<details className="stepgroup" open={open}>
<summary
- className="stepgroup-head flex items-center gap-2 py-0.5 cursor-pointer select-none text-ui text-faint hover:text-muted"
+ className="stepgroup-head transcript-disclosure cursor-pointer select-none text-ui text-faint hover:text-muted"
onClick={(e) => {
e.preventDefault(); // drive open/closed from state, not the native toggle
setUserToggle(!open);
}}
>
- <span className={"chev inline-block transition-transform" + (open ? " rotate-90" : "")}>›</span>
+ <Icon name="chevronDown" size={12} />
<span>
<span>{running ? t("transcript.turn.running", { label: stepsLabel }) : stepsLabel}</span>
{declined > 0 && (
diff --git a/surfaces/gui/src/components/WorkerDecisionCard.test.tsx b/surfaces/gui/src/components/WorkerDecisionCard.test.tsx
index a0e961e4..f897f23c 100644
--- a/surfaces/gui/src/components/WorkerDecisionCard.test.tsx
+++ b/surfaces/gui/src/components/WorkerDecisionCard.test.tsx
@@ -9,12 +9,34 @@ import { inboxItemBuilders } from "../gallery/inboxItems";
import { STATES, statePayload } from "../gallery/states";
import { ApprovalCard } from "./ApprovalCard";
import { InboxItemCard } from "./InboxItemCard";
+import { WorkerDecisionCard } from "./WorkerDecisionCard";
const state = (id: string) => STATES["worker-decision"].find((s) => s.id === id)!;
describe("WorkerDecisionCard", () => {
afterEach(cleanup);
+ it.each(["", "This requires access to the project directory.\n"])("does not repeat generated command summaries, retaining policy text (%s)", policy => {
+ const command = "cd /workspace/acme/billing-service && npm run build && npm run test -- --run";
+ render(<WorkerDecisionCard decision={{ worker: "Maya", callId: "call", decision: "allow", note: "Verify the build." }}
+ workerCall={{ tool: "run_shell", arguments: { command, description: "Check the build" },
+ reason: `${policy}command: ${command} · description: Check the build` }}
+ onFollow={vi.fn()} onOverride={vi.fn()} />);
+ const card = screen.getByTestId("workerdec-call");
+ expect(card.querySelectorAll(".approval-reason")).toHaveLength(policy ? 1 : 0);
+ expect(card.textContent?.split(command)).toHaveLength(2);
+ if (policy) expect(card.textContent).toContain(policy.trim());
+ });
+
+ it("removes a truncated generated summary for a long command", () => {
+ const command = "npm run check " + "--sample-long-option ".repeat(20);
+ const summary = command.trim().slice(0, 79) + "…";
+ render(<WorkerDecisionCard decision={{ worker: "Maya", callId: "call", decision: "deny", note: "Use the scoped test." }}
+ workerCall={{ tool: "run_shell", arguments: { command, description: "Check" }, reason: `command: ${summary} · description: Check` }}
+ onFollow={vi.fn()} onOverride={vi.fn()} />);
+ expect(screen.getByTestId("workerdec-call").querySelector(".approval-reason")).toBeNull();
+ });
+
it("shows the worker's command and the lead's reason, never the call id", () => {
render(<ApprovalCard item={approvalItemFromPayload(statePayload("worker-decision", "lead-denies-command"))} onApprove={vi.fn()} />);
const card = screen.getByTestId("workerdec-card");
diff --git a/surfaces/gui/src/components/WorkerDecisionCard.tsx b/surfaces/gui/src/components/WorkerDecisionCard.tsx
index 98c4befa..f3f8e857 100644
--- a/surfaces/gui/src/components/WorkerDecisionCard.tsx
+++ b/surfaces/gui/src/components/WorkerDecisionCard.tsx
@@ -53,6 +53,25 @@ function nounFor(tool?: string): Noun {
return "action";
}
+// Older/current servers include an argument preview in the parked prompt body.
+// For shell calls the title + command block already show those same two fields.
+// Remove only that exact generated line, retaining distinct policy explanations.
+function distinctWorkerReason(call?: WorkerCall | null): string {
+ const reason = call?.reason || "";
+ const args = call?.arguments || {};
+ const shorten = (text: string, limit: number) => {
+ const chars = Array.from(text);
+ return chars.length > limit ? chars.slice(0, limit - 1).join("") + "…" : text;
+ };
+ const summary = call?.tool === "run_shell" && typeof args.command === "string"
+ && Object.keys(args).every(k => k === "command" || k === "description")
+ ? shorten(Object.entries(args).map(([key, value]) =>
+ `${key}: ${shorten(String(value).trim().replace(/\s+/g, " "), 80)}`,
+ ).join(" · "), 240) : "";
+ return reason.split("\n").filter(line => line.trim() !== "requires approval"
+ && (!summary || line.trim() !== summary)).join("\n").trim();
+}
+
export function WorkerDecisionCard({
decision,
workerCall,
@@ -80,6 +99,7 @@ export function WorkerDecisionCard({
const args = workerCall?.arguments && typeof workerCall.arguments === "object" ? workerCall.arguments : {};
const preview =
typeof args.command === "string" ? args.command : typeof args.content === "string" ? args.content : "";
+ const workerReason = distinctWorkerReason(workerCall);
return (
<div
className={bare ? "workerdec bare" : "approval workerdec" + (compact ? " approval-dock" : "")}
@@ -107,8 +127,8 @@ export function WorkerDecisionCard({
<div className="workerdec-call" data-testid="workerdec-call">
<TitleText line={humanizeApprovalTitle(workerCall.tool, args)} />
{preview && <PreviewBlock text={preview} />}
- {workerCall.reason && workerCall.reason !== "requires approval" && (
- <div className="approval-reason">{workerCall.reason}</div>
+ {workerReason && (
+ <div className="approval-reason">{workerReason}</div>
)}
</div>
) : (
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index 3fe409c9..03325d52 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -1546,6 +1546,12 @@ html[data-theme="dark"] :not(.connector-badge) > .connector-icon[data-dark-mark]
(Transcript.tsx); only the <summary> disclosure-marker reset stays in CSS. ---- */
.stepgroup-head { list-style: none; }
.stepgroup-head::-webkit-details-marker { display: none; }
+.transcript-disclosure {
+ display: flex; align-items: center; gap: 8px; padding: 2px 0;
+ min-width: 0; line-height: 1.5; list-style: none;
+}
+.transcript-disclosure > svg { flex: 0 0 12px; transform: rotate(-90deg); }
+details[open] > .transcript-disclosure > svg { transform: rotate(0); }
/* §33 turn group: running-step spinner (small sibling of .waiting-spinner) */
.spinner {
display: inline-block; width: 10px; height: 10px; border-radius: 50%;
@@ -2151,13 +2157,13 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:
/* Sleeping strip — a scheduled agent never reads as a dead one. */
.sleep-strip {
- max-width: 760px; margin: 0 auto 8px; display: flex; align-items: center; gap: 9px;
+ width: 100%; min-width: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
background: var(--panel); font-size: var(--fs-ui); color: var(--muted);
}
.sleep-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn-ink); opacity: 0.7; flex-shrink: 0; animation: sleep-pulse 2.4s ease-in-out infinite; }
@keyframes sleep-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }
-.sleep-text { flex: 1; }
+.sleep-text { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.sleep-strip .btn.sm { padding: 4px 10px; font-size: var(--fs-meta); }
/* UX-038: viewer header — breadcrumb-as-back, ✕ close, one labeled ⋯ menu. */
@@ -2203,10 +2209,8 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:
.task-chip { display:inline-flex; align-items:center; gap:5px; padding:0 5px; border:0; border-radius:5px; background:var(--accent-soft, #e9f0fd); color:var(--accent, #2563eb); font:inherit; font-size:.92em; vertical-align:baseline; max-width:100%; cursor:pointer; }
.task-chip > span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.team-update { font-size:var(--fs-ui); color:var(--faint); min-width:0; }
-.team-update-head { display:flex; align-items:baseline; gap:6px; cursor:pointer; list-style:none; }
+.team-update-head { cursor:pointer; }
.team-update-head::-webkit-details-marker { display:none; }
-.team-update-head > svg { flex-shrink:0; transform:rotate(-90deg); }
-.team-update[open] > .team-update-head > svg { transform:rotate(0); }
.team-update-head time { white-space:nowrap; font-size:var(--fs-label); }
.team-update-head { min-width:0; white-space:nowrap; }
.team-update-head > span { min-width:0; overflow:hidden; text-overflow:ellipsis; }