refactor!: waiting_human becomes waiting_approval, with the approval kind on each task

This commit is contained in:
sam committed 2026-10-24 23:45:20 +11:00
1 parent 1f8a9964c1
commit e8a60c4abd
29 files changed
+229 -183

No files matched your search

+2 -2
View File
@@ -37,8 +37,8 @@ export const DEFAULT_STATUSES: StatusMeta[] = [
{ id: "queued", label: "Queued", kind: "idle" },
{ id: "running", label: "Running", kind: "info" },
{
id: "waiting_human",
label: "Waiting on operator",
id: "waiting_approval",
label: "Waiting for approval",
kind: "warn",
needs_you: true,
},
+6
View File
@@ -146,3 +146,9 @@ export function changeStatusLabel(id: string | undefined): string {
export function configSchema(): string {
return configSchemaRef.value;
}
/** What a task waiting for approval asks the operator to decide. */
export const approvalLabels: Record<string, string> = {
plan: "Plan",
review: "Review findings",
};
+1 -1
View File
@@ -28,7 +28,7 @@ import type { AttemptsState, Stage } from "./task-run";
* attempt: merging two attempts by stage name is the failure this design
* exists to avoid.
*
* A per-run elapsed time is deliberately NOT rendered. `waiting_human` can span
* A per-run elapsed time is deliberately NOT rendered. `waiting_approval` can span
* days, so wall time from an attempt's start is not a duration of work; only
* per-stage durations exist and only those are shown.
*/
+3 -2
View File
@@ -17,7 +17,7 @@ import { Button } from "@/components/ui/button";
import { api } from "@/lib/api";
import { runQuery, type LogState } from "./task-run";
import { firstLine } from "./first-line";
import { statusKind, statusLabel } from "@/lib/task-meta";
import { approvalLabels, statusKind, statusLabel } from "@/lib/task-meta";
import DispatchLinks from "@/bindings/DispatchLinks.vue";
import { MetadataList } from "@/components/ui/metadata-list";
import { Section } from "@/components/ui/section";
@@ -86,7 +86,7 @@ const HEAD_ACTIONS = computed(() =>
run.task?.review_gate ? ["archive", "merge"] : ["approve", "reject", "archive", "merge"],
);
// The plan a waiting task asks the operator to approve.
const plan = computed(() => (run.task?.status === "waiting_human" ? run.task?.plan?.trim() : "") || "");
const plan = computed(() => (run.task?.approval === "plan" ? run.task?.plan?.trim() : "") || "");
// The run's inputs and written outputs, one row per name.
const rows = (values?: Record<string, unknown>) =>
@@ -120,6 +120,7 @@ const headerActions = computed(() =>
<h1 class="text-2xl font-semibold break-words text-balance">{{ title }}</h1>
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
<Badge v-if="status" :variant="statusKind(status)">{{ statusLabel(status) }}</Badge>
<Badge v-if="run.task?.approval" variant="outline">{{ approvalLabels[run.task.approval] ?? run.task.approval }}</Badge>
<span v-if="run.task?.workflow" class="font-mono text-xs text-fg-muted">{{ run.task.workflow }}</span>
<a
v-if="run.task?.issue_url && run.task?.issue_number"
+1 -1
View File
@@ -9,7 +9,7 @@ import { reviewGateOffer } from "./review-gate";
const props = defineProps<{ task: Task }>();
const emit = defineEmits<{ done: [taskId: Task["id"]] }>();
const gate = computed(() => props.task.status === "waiting_human" ? reviewGateOffer(props.task.review_gate) : null);
const gate = computed(() => props.task.status === "waiting_approval" ? reviewGateOffer(props.task.review_gate) : null);
const selected = ref<string[]>([]);
watch(() => props.task.review_gate, () => {
selected.value = gate.value?.findings.map((entry) => entry.key) ?? [];
+1 -1
View File
@@ -68,7 +68,7 @@ const props = defineProps<{
const emit = defineEmits<{ done: [taskId: Task["id"]] }>();
const router = useRouter();
const gate = computed(() => props.task.status === "waiting_human" ? reviewGateOffer(props.task.review_gate) : null);
const gate = computed(() => props.task.status === "waiting_approval" ? reviewGateOffer(props.task.review_gate) : null);
// An empty selection means all findings to the server.
const approveDisabled = computed(() => !!gate.value && props.findings?.length === 0);
const inFlight = ref(false);
+2 -1
View File
@@ -6,7 +6,7 @@ import { Badge } from "@/components/ui/badge";
import { DataTable, type DataTableColumn } from "@/components/ui/data-table";
import { Timestamp } from "@/components/ui/timestamp";
import { ago } from "@/lib/format";
import { statusKind, statusLabel } from "@/lib/task-meta";
import { approvalLabels, statusKind, statusLabel } from "@/lib/task-meta";
import type { Task } from "./task";
import TaskRowActions from "./TaskRowActions.vue";
@@ -97,6 +97,7 @@ const issueHref = (task: Task) => (forgeIssue(task) && task.issue_url && task.is
<template #cell-status="{ row }">
<span class="inline-flex items-center gap-1">
<Badge :variant="statusKind(row.status ?? '')">{{ statusLabel(row.status ?? "") }}</Badge>
<Badge v-if="row.approval" variant="outline">{{ approvalLabels[row.approval] ?? row.approval }}</Badge>
<Badge v-if="row.status === 'parked' && parkClassLabels[row.park_class ?? '']" variant="outline" :title="parkClassTitle(row)">
{{ parkClassLabels[row.park_class ?? ""] }}
</Badge>
+2
View File
@@ -57,6 +57,8 @@ export interface TaskRecord {
actions?: string[];
review_gate?: string;
plan?: string;
/** What a task waiting for approval asks: "plan" or "review". */
approval?: string;
rereview_rounds?: number;
}
+2
View File
@@ -35,6 +35,8 @@ export interface Task {
* reads its round count; a task without one never answers a gate. */
review_gate?: string;
plan?: string;
/** What a task waiting for approval asks: "plan" or "review". */
approval?: string;
/** How many re-reviews this gate has granted, against the server's cap. */
rereview_rounds?: number;
}