Add Review Sweep: one-click agentic review of unsettled work

Adds a sidebar-v2 button that reviews every unsettled thread across all
connected environments: an LLM summarizes each thread, suggests a
corrected title when the current one is misleading, and recommends
settling threads whose work has concluded. Results stream into a new
/review-sweep page with per-item Apply buttons and Apply All — nothing
applies without a click.

- contracts: ReviewThreadSummaryInput/Result, review.summarizeThread WS
  RPC, reviewSweep capability flag (old servers are skipped)
- server: generateThreadReview TextGeneration op across all five
  providers, conservative prompt with transcript capping, and
  ReviewService.summarizeThread reading the projection
- client-runtime: summarizeThread RPC command atom
- web: reviewSweepStore runner (concurrency 3, runId-guarded, survives
  navigation), /review-sweep view, SidebarV2 entry button

Settle recommendations are blocked for active threads at four layers:
prompt rules, normalizeThreadReview, a server-side projection re-check
(never trusts the client's canSettleNow), and a client canSettle
re-check at apply time.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5 committed 2026-07-23 19:24:05 -07:00
1 parent 67a7b1a1d3
commit f8aa8450d1
26 files changed
+1457 -13

No files matched your search

@@ -22,10 +22,12 @@ import {
buildBranchNamePrompt,
buildCommitMessagePrompt,
buildPrContentPrompt,
buildThreadReviewPrompt,
buildThreadTitlePrompt,
} from "./TextGenerationPrompts.ts";
import * as TextGeneration from "./TextGeneration.ts";
import {
normalizeThreadReview,
sanitizeCommitSubject,
sanitizePrTitle,
sanitizeThreadTitle,
@@ -39,6 +41,7 @@ const OpenCodeTextGenerationOperation = Schema.Literals([
"generatePrContent",
"generateBranchName",
"generateThreadTitle",
"generateThreadReview",
]);
type OpenCodeTextGenerationOperation = typeof OpenCodeTextGenerationOperation.Type;
@@ -253,7 +256,8 @@ export const makeOpenCodeTextGeneration = Effect.fn("makeOpenCodeTextGeneration"
| "generateCommitMessage"
| "generatePrContent"
| "generateBranchName"
| "generateThreadTitle";
| "generateThreadTitle"
| "generateThreadReview";
}) =>
sharedServerMutex.withPermit(
Effect.gen(function* () {
@@ -611,10 +615,31 @@ export const makeOpenCodeTextGeneration = Effect.fn("makeOpenCodeTextGeneration"
};
});
const generateThreadReview: TextGeneration.TextGeneration["Service"]["generateThreadReview"] =
Effect.fn("OpenCodeTextGeneration.generateThreadReview")(function* (input) {
const { prompt, outputSchema } = buildThreadReviewPrompt({
title: input.title,
isActive: input.isActive,
firstUserMessage: input.firstUserMessage,
recentMessages: input.recentMessages,
});
const generated = yield* runOpenCodeJson({
operation: "generateThreadReview",
cwd: input.cwd,
prompt,
outputSchemaJson: outputSchema,
modelSelection: input.modelSelection,
});
return normalizeThreadReview(generated, input.isActive);
});
return {
generateCommitMessage,
generatePrContent,
generateBranchName,
generateThreadTitle,
generateThreadReview,
} satisfies TextGeneration.TextGeneration["Service"];
});