Open-source SEO, GEO, and marketing skills for AI agents.
fix(ui): drop duplicate Tasks labels and brief block in task workspace
Yuting Zhong0445bf51cee9
diff --git a/src/components/agent-task-workspace.test.tsx b/src/components/agent-task-workspace.test.tsxindex 59cf0f8f..605188f9 100644--- a/src/components/agent-task-workspace.test.tsx+++ b/src/components/agent-task-workspace.test.tsx@@ -268,7 +268,7 @@ describe("AgentTaskWorkspace selected-task panel", () => {})}/>,);- expect(screen.getAllByText("demo-42").length).toBeGreaterThan(0);+ expect(screen.getAllByText("DEMO-42").length).toBeGreaterThan(0);expect(screen.getAllByText("Audit yesterday's spend").length).toBeGreaterThan(0);expect(screen.getAllByText("working").length).toBeGreaterThan(0);const stub = screen.getByTestId("live-transcript");diff --git a/src/components/agent-task-workspace.tsx b/src/components/agent-task-workspace.tsxindex 51704d05..5e01ffc0 100644--- a/src/components/agent-task-workspace.tsx+++ b/src/components/agent-task-workspace.tsx@@ -1,7 +1,6 @@"use client";import { useCallback, useMemo, useState, useTransition } from "react";-import Link from "next/link";import { useRouter, useSearchParams } from "next/navigation";import {CheckCircle2,@@ -137,15 +136,7 @@ export function AgentTaskWorkspace({{/* ── Left pane: task list ─────────────────────────────────────── */}<aside className="flex w-80 shrink-0 flex-col border-r bg-muted/20"><div className="border-b px-4 py-3">- <div className="flex items-baseline justify-between gap-2">- <h2 className="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground">- {agentDisplayName} · Tasks- </h2>- <span className="text-[10px] tabular-nums text-muted-foreground">- {totalCount}- </span>- </div>- <p className="mt-1 text-[11px] text-muted-foreground">+ <p className="text-[11px] text-muted-foreground">{inFlightCount > 0 ? (<span className="inline-flex items-center gap-1.5"><RunningDot size="sm" aria-label="" />@@ -219,14 +210,7 @@ export function AgentTaskWorkspace({<div className="mx-auto w-full max-w-3xl px-6 py-3"><div className="flex items-start justify-between gap-3"><div className="min-w-0 flex-1">- <div className="flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-muted-foreground">- <Link- href={projectHref(projectSlug, "/tasks")}- className="hover:text-foreground"- >- Tasks- </Link>- <span>/</span>+ <div className="text-[10px] uppercase tracking-[0.18em] text-muted-foreground"><span className="font-mono">{selected.task.display_id.toUpperCase()}</span></div><h1 className="mt-0.5 text-base font-semibold tracking-tight truncate">diff --git a/src/components/live-transcript.test.tsx b/src/components/live-transcript.test.tsxindex 05ddf3d9..b01e92ad 100644--- a/src/components/live-transcript.test.tsx+++ b/src/components/live-transcript.test.tsx@@ -137,13 +137,13 @@ describe("LiveTranscript rendering events", () => {expect(screen.getByText(/→ result/)).toBeInTheDocument();});- it("renders kickoff-style user messages as a collapsible task brief block", () => {+ it("hides kickoff-style user messages from the transcript", () => {const events: TranscriptEvent[] = [{ kind: "user_message", id: "u1", ts: 1, body: "(task assignment) audit the account" },];render(<LiveTranscript {...defaultProps({ initialEvents: events, threadId: "t-kickoff" })} />);- expect(screen.getByText(/Task brief sent to agent/i)).toBeInTheDocument();- expect(screen.getByText(/audit the account/)).toBeInTheDocument();+ expect(screen.queryByText(/Task brief sent to agent/i)).not.toBeInTheDocument();+ expect(screen.queryByText(/audit the account/)).not.toBeInTheDocument();});it("shows error-status icon when the latest tool result failed", () => {diff --git a/src/components/live-transcript.tsx b/src/components/live-transcript.tsxindex b867daa6..4c664b43 100644--- a/src/components/live-transcript.tsx+++ b/src/components/live-transcript.tsx@@ -323,13 +323,18 @@ export function LiveTranscript({};}, [pollIntervalMs, pollOnce, sendingChat, stopPolling]);- // ── Live re-attach: SSE bridge to OpenClaw's sessions.messages stream. ─- // OpenClaw buffers session JSONL until session.ended, so the polling- // path above sees nothing mid-turn. For an in-flight task (especially- // one auto-kicked-off server-side without a /api/chat SSE channel),- // this re-attaches to the gateway and forwards every session.message- // event live. Same dedup set as polling, so events that later land in- // JSONL don't double-render.+ // ── Live re-attach: SSE bridge to the shadow-transcript stream. ─────+ // OpenClaw buffers session JSONL until session.ended, so JSONL polling+ // sees nothing mid-turn. Both server-side task kickoffs and /api/chat+ // tee their gateway events to a shadow JSONL — this bridge tails that+ // file so a tab switching back to a thread mid-run picks up the stream+ // instead of staring at a frozen transcript until the turn flushes.+ //+ // The bridge runs on every thread mount, not just tasks. The shadow+ // file may not exist (idle thread) or exist-but-be-idle (run already+ // finished); both cases are no-ops on the server. Same dedup set as+ // polling, so events that later land in OpenClaw's JSONL don't+ // double-render.//// Skipped during an active /api/chat send — that path already streams// its own deltas; layering re-attach on top would just duplicate work.@@ -339,12 +344,6 @@ export function LiveTranscript({// dev-server pair shows the full path. Toggle off in prod later.const log = (...args: unknown[]) =>console.log("[live-bridge]", ...args);- if (!composerDisabled) {- log("skip: composerDisabled=false (task not in flight)", {- threadId,- });- return;- }if (sendingChat) {log("skip: sendingChat=true (/api/chat path owns streaming)", {threadId,@@ -404,14 +403,7 @@ export function LiveTranscript({log("closing", { threadId });es.close();};- }, [- agentSlug,- composerDisabled,- projectSlug,- sendingChat,- stopPolling,- threadId,- ]);+ }, [agentSlug, projectSlug, sendingChat, stopPolling, threadId]);// ── Send: optimistic user message + SSE-driven streaming reply. ─────const send = useCallback(@@ -989,7 +981,11 @@ function RenderItem({ item }: { item: RenderedItem }) {item.body.startsWith("(session start)") ||item.body.startsWith("TASK_BRIEF") ||item.body.startsWith("FIRST_TURN");- if (isKickoff) return <KickoffBlock body={item.body} />;+ // Kickoff messages duplicate the task header's Brief expandable+ // (and for FIRST_TURN flows, the on-screen onboarding context).+ // Drop them from the transcript so the chat starts with the+ // assistant's reply instead of the raw assignment payload.+ if (isKickoff) return null;return <UserBubble body={item.body} />;}if (item.kind === "assistant_text") {@@ -1022,29 +1018,6 @@ function AssistantText({ body }: { body: string }) {);}-function KickoffBlock({ body }: { body: string }) {- // Open by default so the user sees the brief was actually delivered — the- // moment the page loads, this is the only proof the agent received its- // assignment. Users can collapse it once they've read it; the chevron- // makes that affordance obvious.- return (- <details- open- className="group rounded-md border border-dashed border-muted-foreground/30 bg-muted/20 px-3 py-2 text-xs"- >- <summary className="flex cursor-pointer items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground select-none">- <span aria-hidden className="transition-transform group-open:rotate-90">- ›- </span>- Task brief sent to agent- </summary>- <pre className="mt-2 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground">- {body}- </pre>- </details>- );-}-function ToolGroup({ tools }: { tools: ToolEntry[] }) {const inFlightCount = tools.filter((t) => !t.done).length;const isLive = inFlightCount > 0;