feat(webui): the dashboard answers the review gate, including a re-review's instructions

The server offers re-review for a waiting task, and it refuses one
without instructions, so the control needs a dialog of its own rather
than the plain confirm: it collects the operator's focus and posts
api.taskAction(id, "rereview", {instructions}). taskAction now takes the
review-gate payload (instructions and the finding keys approve posts, an
absent selection meaning all), and the freeze-dried catalog gains
Re-review so the first render matches the served catalog. The rereview
event kinds join the live-update topic list.

ui/dist is regenerated and committed; task test:ui and the typecheck pass.
This commit is contained in:
sam committed 2026-10-02 02:27:59 +10:00
1 parent 68a17aed91
commit eaabc254be
8 files changed
+158 -66

No files matched your search

+10 -2
View File
@@ -150,10 +150,18 @@ export const api = {
request<T>(`/api/tasks/${encodeURIComponent(id)}/changes` + qs(params)),
taskDebug: <T = unknown>(id: string, params?: QueryParams) =>
request<T>(`/api/tasks/${encodeURIComponent(id)}/debug` + qs(params)),
taskAction: <T = unknown>(id: string, action: string) =>
// taskAction posts an operator action. A review-gate answer may carry a
// payload: the instructions a rereview requires, and the finding keys an
// approve posts (an absent selection means every offered finding). Every
// other action sends neither.
taskAction: <T = unknown>(
id: string,
action: string,
payload?: { instructions?: string; findings?: string[] },
) =>
request<T>(`/api/tasks/${encodeURIComponent(id)}/action`, {
method: "POST",
body: { action },
body: { action, ...payload },
}),
setup: <T = unknown>() => request<T>("/api/setup"),
capabilities: <T = unknown>() => request<T>("/api/capabilities"),
+1
View File
@@ -56,6 +56,7 @@ export const DEFAULT_ACTIONS: ActionMeta[] = [
confirm: `Stop "{title}"? Recoverable work will remain parked.`,
},
{ id: "approve", label: "Approve", kind: "primary" },
{ id: "rereview", label: "Re-review", kind: "quiet" },
{
id: "reject",
label: "Reject",
+5 -1
View File
@@ -27,7 +27,11 @@ export interface DashboardApi {
tasks<T = unknown>(): Promise<T>;
task<T = unknown>(id: string): Promise<T>;
captures<T = unknown>(limit?: number): Promise<T>;
taskAction<T = unknown>(id: string, action: string): Promise<T>;
taskAction<T = unknown>(
id: string,
action: string,
payload?: { instructions?: string; findings?: string[] },
): Promise<T>;
}
/** The MCP-shaped envelope a tool result is returned in. */
+2
View File
@@ -24,8 +24,10 @@ const taskKinds = new Set([
"pr_rejected",
"human_approved",
"human_rejected",
"human_rereviewed",
"agent_approved",
"agent_rejected",
"agent_rereviewed",
"changes_captured",
"config_captured",
"work_request_submitted",
+5
View File
@@ -23,6 +23,11 @@ export interface Task {
created_at?: string;
updated_at?: string;
actions?: string[];
/** The operator-approval gate's document, as JSON. The rereview dialog
* reads its round count; a task without one never answers a gate. */
review_gate?: string;
/** How many re-reviews this gate has granted, against the server's cap. */
rereview_rounds?: number;
}
</script>
+75 -3
View File
@@ -14,12 +14,22 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
import { actionFor, type ActionMeta } from "@/lib/task-meta";
import type { Task } from "./TaskRow.vue";
@@ -60,6 +70,13 @@ const error = ref<{ kind: ActionErrorKind; message: string } | null>(null);
const confirming = ref<string | null>(null);
const confirmingId = ref<string | null>(null);
// A re-review carries instructions the plain confirm dialog cannot collect
// (docs/prds/pr-review-operator-response.md, Decision 1), and the server
// refuses a re-review without them, so it opens a dialog of its own.
const rereviewOpen = ref(false);
const rereviewId = ref<string | null>(null);
const instructions = ref("");
const controls = computed<Control[]>(() =>
shownActionIds(props.task.actions, props.only)
.map((id) => actionFor(id))
@@ -139,9 +156,15 @@ function variantFor(kind: string): ControlVariant {
}
// A control that names a consequence is confirmed first; the two that only open
// a forge page are not, because they change nothing.
// a forge page are not, because they change nothing. A re-review needs
// instructions, which its own dialog collects.
function request(id: string) {
error.value = null;
if (id === "rereview") {
rereviewId.value = id;
rereviewOpen.value = true;
return;
}
if (actionFor(id)?.confirm) {
confirmingId.value = id;
confirming.value = id;
@@ -150,14 +173,14 @@ function request(id: string) {
void run(id);
}
async function run(id: string) {
async function run(id: string, payload?: { instructions?: string }) {
confirming.value = null;
inFlight.value = true;
error.value = null;
try {
// The route path and the API both address a task by string; the list serves
// ids as numbers, so the row's own id is narrowed once, here.
await api.taskAction(String(props.task.id), id);
await api.taskAction(String(props.task.id), id, payload);
emit("done", props.task.id);
} catch (err) {
error.value = classifyActionError(err);
@@ -166,6 +189,19 @@ async function run(id: string) {
}
}
function onRereviewOpen(open: boolean) {
rereviewOpen.value = open;
if (!open) instructions.value = "";
}
function submitRereview() {
const id = rereviewId.value;
const text = instructions.value.trim();
if (!id || !text) return;
rereviewOpen.value = false;
void run(id, { instructions: text });
}
function onConfirmationOpen(open: boolean) {
if (!open) confirming.value = null;
}
@@ -257,6 +293,42 @@ function requestFromMenu(id: string) {
</DropdownMenu>
</div>
<Dialog :open="rereviewOpen" @update:open="onRereviewOpen">
<DialogContent class="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Re-review this pull request?</DialogTitle>
<DialogDescription>
The review phases run again with your instructions. Two re-reviews
are allowed; this is
{{ props.task.rereview_rounds ? "the next" : "the first" }} one.
</DialogDescription>
</DialogHeader>
<div class="flex flex-col gap-2">
<Label for="review-instructions"
>What should the reviewers focus on?</Label
>
<Textarea
id="review-instructions"
v-model="instructions"
class="min-h-24"
placeholder="e.g. check the migration ordering and the SQL path"
:disabled="inFlight"
/>
</div>
<DialogFooter>
<Button variant="ghost" :disabled="inFlight" @click="onRereviewOpen(false)">
Keep waiting
</Button>
<Button
:disabled="inFlight || !instructions.trim()"
@click="submitRereview"
>
Re-review
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<AlertDialog :open="confirming !== null" @update:open="onConfirmationOpen">
<AlertDialogContent>
<AlertDialogHeader>