Add the Review Loop: unattended review-and-fix rounds in the desktop app and in loop phases

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-28 21:09:02 -08:00
1 parent d6a28b5dc8
commit 57567d7a0b
71 files changed
+11331 -443

No files matched your search

+44 -2
View File
@@ -210,6 +210,11 @@ export function windowTitleFor(dir) {
*/
export function loopWindowTitle(dir, state) {
const name = lastSegment(dir);
if (state.kind === "rounds") {
const where = state.afterRounds || `Round ${state.round}`;
const round = state.step === "Waiting on you" ? `Review Loop needs you: ${where}` : state.afterRounds ? `Review Loop: ${state.afterRounds}` : `Review Loop: Round ${state.round} of ${state.rounds}`;
return name ? `${round} - ${name}` : round;
}
const what = state.step === "Waiting on you" ? `Loop needs you: Phase ${state.phase}` : `Loop: Phase ${state.phase} of ${state.phases}`;
return name ? `${what} - ${name}` : what;
}
@@ -221,6 +226,7 @@ export function loopWindowTitle(dir, state) {
* of the spec up to the last this run builds.
*/
export function loopBanner(state) {
if (state.kind === "rounds") return roundsBanner(state);
const { phase, phases, phaseName, step } = state;
const named = phaseName ? `Phase ${phase} of ${phases}: ${phaseName}` : `Phase ${phase} of ${phases}`;
const pips = Array.from({ length: Math.max(phases, 0) }, (_, i) => (i + 1 < phase ? "done" : i + 1 === phase ? "current" : "todo"));
@@ -247,6 +253,40 @@ export function loopBanner(state) {
return { ...base, title: "Implementation loop running", detail: ran ? `${where} \u00b7 ${ran}` : where };
}
/**
* The Review Loop's banner (`kind: "rounds"`): the same words as the phase banner
* with "round" for "phase", one pip per round up to the cap, and the detail line
* the app builds from the round, step and counts ("Round 2 of 3: Fixing 3 findings
* (1 Critical, 2 Warning)", carried in `phaseName`). After the rounds,
* `afterRounds` names the Suggestions batch or the final check, and every pip
* shows done.
*/
function roundsBanner(state) {
const { round, rounds, step } = state;
const after = state.afterRounds || "";
const named = after || `Round ${round} of ${rounds}`;
const detailLine = state.phaseName || (step ? `${named}: ${step}` : named);
const pips = Array.from({ length: Math.max(rounds, 0) }, (_, i) => (after || i + 1 < round ? "done" : i + 1 === round ? "current" : "todo"));
const base = { tone: "running", pips, hint: "Working on its own. You can walk away." };
if (state.stopping) {
return { ...base, title: "Stopping", detail: "The agent is ending. You will be asked what to do with the round's changes.", hint: "The stop screen follows in a moment." };
}
if (step === "Waiting on you") {
return { ...base, tone: "waiting", title: "The Review Loop needs your answer", detail: `${named} is waiting on the question below.`, hint: "Nothing is lost while it waits." };
}
if (state.stopAfterRound) {
return { ...base, title: "Stopping after this round", detail: `${named} finishes, is judged and committed, then the Review Loop stops.`, hint: "Stop now ends the agent at once." };
}
if (step === "Starting") {
if (state.phaseRetried) return { ...base, title: after ? `Retrying the ${after.toLowerCase()}` : `Retrying round ${round}`, detail: `The agent crashed or went quiet, so a fresh one is picking up ${after ? `the ${after.toLowerCase()}` : named}.` };
if (after) return { ...base, title: "Rounds done", detail: `Opening a fresh agent for the ${after.toLowerCase()}.` };
if (round > 1) return { ...base, title: `Round ${round - 1} done`, detail: `Opening a fresh agent for ${named}.` };
return { ...base, title: "Starting the Review Loop", detail: `Opening a fresh agent for ${named}.` };
}
const ran = loopRunText(state);
return { ...base, title: "Review Loop running", detail: ran ? `${detailLine} · ${ran}` : detailLine };
}
/**
* What the running phase runs on, from the app's `loop-state`: "Thrifty (sonnet,
* low)" for a phase on a strength, "(opus, high)" for a Match my session phase
@@ -267,9 +307,11 @@ export function loopRunText(state) {
*/
export function loopStopLabels(state) {
const stopping = Boolean(state.stopping);
const on = Boolean(state.stopAfterPhase);
const rounds = state.kind === "rounds";
const on = Boolean(rounds ? state.stopAfterRound : state.stopAfterPhase);
const unit = rounds ? "round" : "phase";
return {
afterText: on ? "Cancel stop after this phase" : "Stop after this phase",
afterText: on ? `Cancel stop after this ${unit}` : `Stop after this ${unit}`,
afterDisabled: stopping || (!on && state.canStopAfter === false),
nowDisabled: stopping,
};