From b763709a3e2cced5ab8f35ec956b4b52cb15ba66 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Fri, 24 Jul 2026 05:05:01 -0700 Subject: [PATCH] Sweep UI v3: grid, reveal-when-done, one-line next steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- apps/server/src/review/ReviewService.test.ts | 5 + apps/server/src/review/ReviewService.ts | 1 + .../src/textGeneration/TextGeneration.ts | 2 + .../TextGenerationPrompts.test.ts | 2 + .../textGeneration/TextGenerationPrompts.ts | 6 +- .../src/textGeneration/TextGenerationUtils.ts | 4 + .../reviewSweep/ReviewSweepView.tsx | 176 +++++++++++------- packages/contracts/src/review.ts | 3 + 8 files changed, 129 insertions(+), 70 deletions(-) diff --git a/apps/server/src/review/ReviewService.test.ts b/apps/server/src/review/ReviewService.test.ts index e1a9ebdb72..fdc8663831 100644 --- a/apps/server/src/review/ReviewService.test.ts +++ b/apps/server/src/review/ReviewService.test.ts @@ -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.", diff --git a/apps/server/src/review/ReviewService.ts b/apps/server/src/review/ReviewService.ts index b62bf0d941..e7bd8859a1 100644 --- a/apps/server/src/review/ReviewService.ts +++ b/apps/server/src/review/ReviewService.ts @@ -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, diff --git a/apps/server/src/textGeneration/TextGeneration.ts b/apps/server/src/textGeneration/TextGeneration.ts index 7f21897572..14cdaed03a 100644 --- a/apps/server/src/textGeneration/TextGeneration.ts +++ b/apps/server/src/textGeneration/TextGeneration.ts @@ -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; diff --git a/apps/server/src/textGeneration/TextGenerationPrompts.test.ts b/apps/server/src/textGeneration/TextGenerationPrompts.test.ts index f920c8b363..e568801fd5 100644 --- a/apps/server/src/textGeneration/TextGenerationPrompts.test.ts +++ b/apps/server/src/textGeneration/TextGenerationPrompts.test.ts @@ -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.", diff --git a/apps/server/src/textGeneration/TextGenerationPrompts.ts b/apps/server/src/textGeneration/TextGenerationPrompts.ts index e501760fd4..a7227ae37a 100644 --- a/apps/server/src/textGeneration/TextGenerationPrompts.ts +++ b/apps/server/src/textGeneration/TextGenerationPrompts.ts @@ -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), diff --git a/apps/server/src/textGeneration/TextGenerationUtils.ts b/apps/server/src/textGeneration/TextGenerationUtils.ts index 8c7538aad0..7a57c23a0f 100644 --- a/apps/server/src/textGeneration/TextGenerationUtils.ts +++ b/apps/server/src/textGeneration/TextGenerationUtils.ts @@ -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, diff --git a/apps/web/src/components/reviewSweep/ReviewSweepView.tsx b/apps/web/src/components/reviewSweep/ReviewSweepView.tsx index 795279256a..6655c23bb0 100644 --- a/apps/web/src/components/reviewSweep/ReviewSweepView.tsx +++ b/apps/web/src/components/reviewSweep/ReviewSweepView.tsx @@ -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({ ) : 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 ( - -
- {item.status === "pending" || item.status === "running" ? ( - - ) : null} + +
Settled ) : null} -
- {primaryAction} +
+ {result?.summary ? ( + + + } + > + + + + {result.summary} + + + ) : null}