Sweep UI v3: grid, reveal-when-done, one-line next steps

Real-data feedback round two:

- Results render as a responsive grid (1/2/3 columns) instead of a
  full-width list.
- While the sweep runs, the page shows only a progress count
  ("Reviewing your work — 7 of 18"); results reveal all at once when
  every thread is done, so triage happens in one pass over a stable
  layout instead of chasing cards as they pop in.
- The model now returns a one-sentence imperative nextStep ("Review
  and merge PR #4415.") which becomes the card body — a direct answer
  to "what should I do here". Summaries are capped at one sentence and
  demoted to an info-icon tooltip.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5 committed 2026-07-24 05:05:01 -07:00
1 parent f508f42215
commit b763709a3e
8 files changed
+129 -70

No files matched your search

@@ -95,6 +95,7 @@ function makeLayer(input: {
input.generateThreadReview?.(reviewInput) ??
Effect.succeed({
summary: "Did the thing.",
nextStep: "Settle this thread.",
suggestedTitle: null,
recommendSettle: true,
settleReason: "Work concluded.",
@@ -267,6 +268,7 @@ describe("ReviewService", () => {
generateThreadReview: () =>
Effect.succeed({
summary: "Bumped the settle default; PR merged.",
nextStep: "Nothing left — settle this thread.",
suggestedTitle: "Bump settle default",
recommendSettle: true,
settleReason: "PR merged, nothing pending.",
@@ -316,6 +318,7 @@ describe("ReviewService", () => {
generateThreadReview: () =>
Effect.succeed({
summary: "Still working.",
nextStep: "Wait for the agent.",
suggestedTitle: null,
recommendSettle: true,
settleReason: "Looks done to me.",
@@ -358,6 +361,7 @@ describe("ReviewService", () => {
generateThreadReview: () =>
Effect.succeed({
summary: "Looks finished.",
nextStep: "Settle this thread.",
suggestedTitle: null,
recommendSettle: true,
settleReason: "Done.",
@@ -423,6 +427,7 @@ describe("ReviewService", () => {
generateThreadReview: () =>
Effect.succeed({
summary: "Looks finished.",
nextStep: "Settle this thread.",
suggestedTitle: null,
recommendSettle: true,
settleReason: "Done.",
+1
View File
@@ -264,6 +264,7 @@ export const make = Effect.gen(function* () {
return {
threadId: input.threadId,
summary: generated.summary,
nextStep: generated.nextStep,
suggestedTitle: generated.suggestedTitle,
recommendSettle,
settleReason: recommendSettle ? generated.settleReason : null,
@@ -81,6 +81,8 @@ export interface ThreadReviewGenerationInput {
export interface ThreadReviewGenerationResult {
summary: string;
/** One imperative sentence: the user's single next action. */
nextStep: string;
/** Null when the current title is still accurate. */
suggestedTitle: string | null;
recommendSettle: boolean;
@@ -191,6 +191,7 @@ describe("buildThreadReviewPrompt", () => {
describe("normalizeThreadReview", () => {
const raw = {
summary: " Work finished. ",
nextStep: " Settle it. ",
suggestedTitle: '"Ship settle default"',
recommendSettle: true,
settleReason: " PR merged. ",
@@ -199,6 +200,7 @@ describe("normalizeThreadReview", () => {
it("sanitizes fields and keeps settle recommendation for inactive threads", () => {
expect(normalizeThreadReview(raw, false)).toEqual({
summary: "Work finished.",
nextStep: "Settle it.",
suggestedTitle: "Ship settle default",
recommendSettle: true,
settleReason: "PR merged.",
@@ -249,9 +249,10 @@ export function buildThreadReviewPrompt(input: ThreadReviewPromptInput) {
const prompt = [
"You review a coding-agent conversation thread and report its state.",
"Return a JSON object with keys: summary, suggestedTitle, recommendSettle, settleReason.",
"Return a JSON object with keys: summary, nextStep, suggestedTitle, recommendSettle, settleReason.",
"Rules:",
"- summary: 1-2 sentences covering what was asked and where the work landed",
"- summary: ONE sentence, max ~25 words: what was asked and where it landed",
"- nextStep: ONE short imperative sentence with the user's single next action (e.g. 'Review and merge PR #123.', 'Answer the agent's question about auth scopes.', 'Nothing left — settle this thread.')",
"- suggestedTitle: a corrected 3-8 word title ONLY if the current title is misleading or a placeholder like 'New thread'; otherwise null",
"- recommendSettle: true ONLY when the work clearly concluded (done, abandoned, or superseded) and nothing awaits the user",
"- settleReason: one short sentence justifying recommendSettle, or null when recommendSettle is false",
@@ -273,6 +274,7 @@ export function buildThreadReviewPrompt(input: ThreadReviewPromptInput) {
const outputSchema = Schema.Struct({
summary: Schema.String,
nextStep: Schema.String,
suggestedTitle: Schema.NullOr(Schema.String),
recommendSettle: Schema.Boolean,
settleReason: Schema.NullOr(Schema.String),
@@ -71,6 +71,7 @@ export function sanitizeThreadTitle(raw: string): string {
export function normalizeThreadReview(
raw: {
summary: string;
nextStep: string;
suggestedTitle: string | null;
recommendSettle: boolean;
settleReason: string | null;
@@ -78,11 +79,13 @@ export function normalizeThreadReview(
isActive: boolean,
): {
summary: string;
nextStep: string;
suggestedTitle: string | null;
recommendSettle: boolean;
settleReason: string | null;
} {
const summary = raw.summary.trim().replace(/\s+/g, " ");
const nextStep = raw.nextStep.trim().replace(/\s+/g, " ");
const suggestedTitle =
raw.suggestedTitle && raw.suggestedTitle.trim().length > 0
? sanitizeThreadTitle(raw.suggestedTitle)
@@ -94,6 +97,7 @@ export function normalizeThreadReview(
: null;
return {
summary: summary.length > 0 ? summary : "No summary available.",
nextStep: nextStep.length > 0 ? nextStep : "Review this thread.",
suggestedTitle: suggestedTitle === "New thread" ? null : suggestedTitle,
recommendSettle,
settleReason,
@@ -8,6 +8,7 @@ import {
ArchiveIcon,
ArrowRightIcon,
CircleAlertIcon,
InfoIcon,
ListChecksIcon,
LoaderIcon,
PencilLineIcon,
@@ -47,6 +48,7 @@ import { Card } from "../ui/card";
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../ui/empty";
import { SidebarInset } from "../ui/sidebar";
import { Spinner } from "../ui/spinner";
import { Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
// ---------------------------------------------------------------------------
// Triage buckets: ordered by "how fast can you clear this" — one-click
@@ -219,12 +221,17 @@ function SweepItemCard({
</Button>
) : null;
// The one-line "what should I do" is the card body; the full summary
// lives behind the info icon so the grid stays scannable.
const nextStep =
item.status === "error"
? null
: (result?.nextStep ??
(bucket === "settle" && result?.settleReason ? result.settleReason : null));
return (
<Card className={cn("gap-1.5 border-s-2 p-3", meta.accent)}>
<div className="flex items-center gap-2">
{item.status === "pending" || item.status === "running" ? (
<Spinner className="size-3.5 shrink-0 text-muted-foreground" />
) : null}
<Card className={cn("min-w-0 gap-1.5 border-s-2 p-3", meta.accent)}>
<div className="flex items-center gap-1.5">
<Link
to="/$environmentId/$threadId"
params={buildThreadRouteParams(item.ref)}
@@ -235,8 +242,26 @@ function SweepItemCard({
{bucket === "settle" && item.settleApplied ? (
<Badge variant="outline">Settled</Badge>
) : null}
<div className="ms-auto flex shrink-0 items-center gap-1.5">
{primaryAction}
<div className="ms-auto flex shrink-0 items-center gap-1">
{result?.summary ? (
<Tooltip>
<TooltipTrigger
render={
<Button
size="icon-xs"
variant="ghost"
className="text-muted-foreground/70"
aria-label="Show thread summary"
/>
}
>
<InfoIcon className="size-3.5" />
</TooltipTrigger>
<TooltipPopup side="bottom" className="max-w-80">
{result.summary}
</TooltipPopup>
</Tooltip>
) : null}
<Button
size="icon-xs"
variant="ghost"
@@ -252,29 +277,29 @@ function SweepItemCard({
<SweepItemMetaRow item={item} projectTitle={projectTitle} workspaceRoot={workspaceRoot} />
{item.status === "error" ? (
<p className="text-sm text-red-400/90">{item.errorMessage}</p>
) : result !== null ? (
<p className="text-sm text-muted-foreground">{result.summary}</p>
) : (
<p className="text-sm text-muted-foreground/60">Reviewing…</p>
)}
{bucket === "settle" && result?.settleReason ? (
<p className="text-xs italic text-muted-foreground/80">{result.settleReason}</p>
<p className="line-clamp-2 text-sm text-red-400/90">{item.errorMessage}</p>
) : nextStep ? (
<p className="line-clamp-2 text-sm text-foreground/90">{nextStep}</p>
) : null}
{bucket === "title" && result?.suggestedTitle ? (
<div className="flex flex-wrap items-center gap-2 text-sm">
<span className="text-muted-foreground/70 line-through">{item.threadTitle}</span>
<ArrowRightIcon className="size-3.5 text-muted-foreground/70" />
<span className="font-medium text-foreground">{result.suggestedTitle}</span>
<div className="flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs">
<span className="max-w-full truncate text-muted-foreground/70 line-through">
{item.threadTitle}
</span>
<ArrowRightIcon className="size-3 shrink-0 text-muted-foreground/70" />
<span className="max-w-full truncate font-medium text-foreground">
{result.suggestedTitle}
</span>
</div>
) : null}
{result?.suggestedTitle && item.titleApplied ? (
<p className="text-xs text-muted-foreground">
<p className="truncate text-xs text-muted-foreground">
Renamed to <span className="font-medium text-foreground">{result.suggestedTitle}</span>.
</p>
) : null}
{primaryAction ? <div className="flex justify-end pt-0.5">{primaryAction}</div> : null}
</Card>
);
}
@@ -503,6 +528,19 @@ export function ReviewSweepView() {
<div className="min-h-0 flex-1 overflow-y-auto px-3 py-4 sm:px-5">
{phase === "idle" ? (
<SweepPreRunSummary />
) : running ? (
<Empty>
<EmptyHeader>
<Spinner className="mx-auto size-6 text-muted-foreground" />
<EmptyTitle>
Reviewing your work — {reviewedCount} of {visibleItems.length}
</EmptyTitle>
<EmptyDescription>
Results appear all at once when every thread is reviewed, so you can triage in one
pass. Feel free to navigate away; the sweep keeps running.
</EmptyDescription>
</EmptyHeader>
</Empty>
) : visibleItems.length === 0 ? (
<Empty>
<EmptyHeader>
@@ -511,53 +549,55 @@ export function ReviewSweepView() {
</EmptyHeader>
</Empty>
) : (
<div className="mx-auto flex w-full max-w-3xl flex-col gap-6">
{truncatedCount > 0 ? (
<p className="text-xs text-muted-foreground">
Reviewing the {visibleItems.length} most recent threads; {truncatedCount} more
were skipped this run.
</p>
) : null}
{buckets.map(([bucket, bucketItems]) => {
const meta = BUCKET_META[bucket];
const BucketIcon = meta.icon;
return (
<section key={bucket} className="flex flex-col gap-2">
<div className="flex items-baseline gap-2">
<h2 className="flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-foreground/80">
<BucketIcon className="size-3.5" />
{meta.title}
<span className="font-normal text-muted-foreground">
· {bucketItems.length}
</span>
</h2>
{meta.hint ? (
<span className="truncate text-xs text-muted-foreground/70">
{meta.hint}
</span>
) : null}
</div>
<div className="flex flex-col gap-2">
{bucketItems.map((item) => {
const projectKey = scopedProjectKey(
scopeProjectRef(item.ref.environmentId, item.projectId),
);
const project = projectsByKey.get(projectKey);
return (
<SweepItemCard
key={scopedThreadKey(item.ref)}
item={item}
bucket={bucket}
projectTitle={project?.title ?? "Unknown project"}
workspaceRoot={project?.workspaceRoot ?? null}
/>
);
})}
</div>
</section>
);
})}
</div>
<TooltipProvider>
<div className="mx-auto flex w-full max-w-6xl flex-col gap-6">
{truncatedCount > 0 ? (
<p className="text-xs text-muted-foreground">
Reviewed the {visibleItems.length} most recent threads; {truncatedCount} more
were skipped this run.
</p>
) : null}
{buckets.map(([bucket, bucketItems]) => {
const meta = BUCKET_META[bucket];
const BucketIcon = meta.icon;
return (
<section key={bucket} className="flex flex-col gap-2">
<div className="flex items-baseline gap-2">
<h2 className="flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-foreground/80">
<BucketIcon className="size-3.5" />
{meta.title}
<span className="font-normal text-muted-foreground">
· {bucketItems.length}
</span>
</h2>
{meta.hint ? (
<span className="truncate text-xs text-muted-foreground/70">
{meta.hint}
</span>
) : null}
</div>
<div className="grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3">
{bucketItems.map((item) => {
const projectKey = scopedProjectKey(
scopeProjectRef(item.ref.environmentId, item.projectId),
);
const project = projectsByKey.get(projectKey);
return (
<SweepItemCard
key={scopedThreadKey(item.ref)}
item={item}
bucket={bucket}
projectTitle={project?.title ?? "Unknown project"}
workspaceRoot={project?.workspaceRoot ?? null}
/>
);
})}
</div>
</section>
);
})}
</div>
</TooltipProvider>
)}
</div>
</div>
+3
View File
@@ -56,6 +56,9 @@ export type ReviewThreadDiffStats = typeof ReviewThreadDiffStats.Type;
export const ReviewThreadSummaryResult = Schema.Struct({
threadId: ThreadId,
summary: TrimmedNonEmptyString,
/** One imperative sentence: the user's single next action. Optional for
pre-nextStep servers. */
nextStep: Schema.optionalKey(TrimmedNonEmptyString),
/** Null when the current title is still accurate. */
suggestedTitle: Schema.NullOr(TrimmedNonEmptyString),
recommendSettle: Schema.Boolean,