Happy review

This commit is contained in:
Ian Gulliver
2026-10-15 20:07:36 -07:00
parent ccd55afe13
commit 35368242e3
14 changed files with 312 additions and 191 deletions
+8 -3
View File
@@ -942,12 +942,17 @@ export interface components {
id: string;
task_id: string;
snapshot_n: number;
/** @description The reviewer's session. */
/** @description The reviewer's session; empty when skipped. */
agent_session_id: string;
/** @description Empty when skipped. */
vendor: string;
/** @description Empty when skipped. */
model: string;
/** @enum {string} */
state: "running" | "done" | "failed";
/**
* @description skipped: the snapshot's step changed no files, so no reviewer ran.
* @enum {string}
*/
state: "running" | "done" | "failed" | "skipped";
/** @description done: the reviewer's submit_review arguments: summary (Markdown) and findings, each with severity, category, title, detail, path and line. */
result?: Record<string, never>;
/** @description failed: why. */
+2
View File
@@ -40,6 +40,8 @@ function stateText(r: Review): string {
return reviewCounts(r);
case "failed":
return "failed";
case "skipped":
return "skipped: no changes";
}
}
+22 -5
View File
@@ -439,11 +439,11 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
put(snapRow(p as unknown as Snapshot, ctx));
continue;
}
if (ev.kind === "review.finished") {
if (ev.kind === "review.started" || ev.kind === "review.finished") {
const r = p as unknown as Review;
const button = ctx.reviewButtons.get(r.snapshot_n);
if (button) {
markFindings(button, findingCount(r));
markReview(button, r);
}
}
if (ev.kind === "agent.tool_call" && isSubagentCall(p)) {
@@ -846,9 +846,26 @@ function claudeTaskStatus(p: Record<string, unknown>, ctx: Ctx): void {
}
}
function markFindings(button: HTMLElement, n: number): void {
replace(button, "review", n > 0 && h("span", { class: "badge", title: `${n} findings` }, n));
function markReview(button: HTMLElement, r: Review): void {
const n = findingCount(r);
button.classList.toggle("attention", n > 0);
if (r.state === "running") {
replace(button, "review", h("span", { class: "review-mark spinner", title: "review in progress" }));
return;
}
if (r.state === "failed") {
replace(button, "review");
return;
}
if (r.state === "skipped") {
replace(button, "review", h("span", { class: "review-mark skipped", title: "skipped: no changes" }, "●"));
return;
}
if (n === 0) {
replace(button, "review", h("span", { class: "review-mark clean", title: "no findings" }, "✓"));
return;
}
replace(button, "review", h("span", { class: "badge", title: `${n} findings` }, n));
}
function snapRow(snap: Snapshot, ctx: Ctx): HTMLElement {
@@ -1015,7 +1032,7 @@ function renderEvent(ev: ByreEvent, ctx: Ctx): HTMLElement | null {
case "review.finished": {
const r = p as unknown as Review;
const outcome = r.state === "failed" ? `failed: ${r.error}` : reviewCounts(r);
const outcome = r.state === "failed" ? `failed: ${r.error}` : r.state === "skipped" ? "skipped: no changes" : reviewCounts(r);
return h("div", { class: `note${r.state === "failed" ? " error" : ""}` }, `review of snapshot #${r.snapshot_n}: ${outcome} `, when);
}