diff --git a/ui/src/tasks/StartNewRun.vue b/ui/src/tasks/StartNewRun.vue
deleted file mode 100644
index 74ed0f7c7..000000000
--- a/ui/src/tasks/StartNewRun.vue
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- {{ unavailable }}
-
-
-
- New run
- {{ confirmText }}
-
-
- Cancel
-
-
- Start run
-
-
-
-
- {{ errorText }}
-
-
diff --git a/ui/src/tasks/TaskHeader.vue b/ui/src/tasks/TaskHeader.vue
index 3323153ca..2a71a94e7 100644
--- a/ui/src/tasks/TaskHeader.vue
+++ b/ui/src/tasks/TaskHeader.vue
@@ -22,14 +22,13 @@ 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";
-import StartNewRun from "./StartNewRun.vue";
import TaskRowActions from "./TaskRowActions.vue";
-import { shownActionIds } from "./task-actions";
+import { headerActionIds } from "./task-actions";
import { useTaskRun } from "./use-task-run";
/**
* The task's head: where it sits, what it is, its state and forge links, and
- * the page's one decision, starting a new run. A parked task opens with the
+ * its server-authorized lifecycle controls. A parked task opens with the
* reason it stopped.
*/
const props = defineProps<{ id: string }>();
@@ -89,12 +88,6 @@ async function jumpToLog(): Promise {
}
}
-// The head has room for the reap an operator reaches for once a task is
-// finished with. Whether this task offers it is the server's action list,
-// never this page's opinion about the status. Approval answers live with the
-// thing being approved.
-const HEAD_ACTIONS = computed(() => ["archive", "merge"]);
-
// The run's inputs and written outputs, one row per name.
const rows = (values?: Record) =>
Object.entries(values ?? {}).map(([label, value]) => ({
@@ -108,9 +101,7 @@ const sections = computed(() =>
{ title: "Outputs", rows: rows(run.attempts?.outputs) },
].filter((section) => section.rows.length),
);
-const headerActions = computed(() =>
- shownActionIds(run.task?.actions, HEAD_ACTIONS.value),
-);
+const headerActions = computed(() => headerActionIds(run.task));
@@ -152,10 +143,9 @@ const headerActions = computed(() =>
-
diff --git a/ui/src/tasks/task-actions.ts b/ui/src/tasks/task-actions.ts
index d50780f44..9fd5dc134 100644
--- a/ui/src/tasks/task-actions.ts
+++ b/ui/src/tasks/task-actions.ts
@@ -1,11 +1,13 @@
+import { reviewGateOffer } from "./review-gate.ts";
+
/**
* Which lifecycle controls a surface renders.
*
* A task offers whatever the server says it offers -- the action list rides
* with the task -- so a status the server will not archive is never offered an
* Archive control here. A surface may narrow that list to the controls it has
- * room for (the task head has room for one), but narrowing can only ever
- * remove: a control the server did not send cannot be conjured by naming it.
+ * room for, but narrowing can only ever remove: a control the server did not
+ * send cannot be conjured by naming it.
*/
export function shownActionIds(
actions: readonly string[] | null | undefined,
@@ -15,3 +17,39 @@ export function shownActionIds(
if (!only || only.length === 0) return [...actions];
return actions.filter((id) => only.includes(id));
}
+
+const PLAN_PANEL_ACTIONS = new Set(["approve", "reject"]);
+const REVIEW_GATE_PANEL_ACTIONS = new Set(["approve", "rereview", "reject"]);
+
+/**
+ * Which lifecycle controls the task detail header (/tasks/:id) renders.
+ *
+ * Starts from the full server-authorized action list and omits only the
+ * approval controls already rendered by an active TaskApproval or
+ * TaskReviewGate panel on the page.
+ */
+export function headerActionIds(
+ task:
+ | {
+ status?: string;
+ approval?: string;
+ plan?: string;
+ review_gate?: string;
+ actions?: readonly string[] | null;
+ }
+ | null
+ | undefined,
+): string[] {
+ const offered = shownActionIds(task?.actions);
+ if (!offered.length || !task) return offered;
+ const planActive = task.approval === "plan" && Boolean(task.plan?.trim());
+ const reviewGateActive =
+ task.status === "waiting_approval" &&
+ reviewGateOffer(task.review_gate) !== null;
+ if (!planActive && !reviewGateActive) return offered;
+ return offered.filter((id) => {
+ if (planActive && PLAN_PANEL_ACTIONS.has(id)) return false;
+ if (reviewGateActive && REVIEW_GATE_PANEL_ACTIONS.has(id)) return false;
+ return true;
+ });
+}
diff --git a/ui/src/tasks/task-run.ts b/ui/src/tasks/task-run.ts
index a3856a269..cdfe663a9 100644
--- a/ui/src/tasks/task-run.ts
+++ b/ui/src/tasks/task-run.ts
@@ -43,6 +43,7 @@ export interface TaskRecord {
id: number | string;
title?: string;
body?: string;
+ source?: string;
status?: string;
workflow?: string;
owner?: string;
@@ -52,6 +53,8 @@ export interface TaskRecord {
issue_url?: string;
pr_number?: number;
pr_url?: string;
+ branch?: string;
+ retry_mode?: string;
park_reason?: string;
tokens_used?: number;
actions?: string[];
@@ -59,7 +62,7 @@ export interface TaskRecord {
plan?: string;
/** The structured plan (JSON) the plan text was rendered from. */
plan_document?: string;
- /** What a task waiting for approval asks: "plan" or "review". */
+ /** What a task waiting for approval asks: "plan", "review", or "budget". */
approval?: string;
rereview_rounds?: number;
}
diff --git a/ui/src/tasks/use-task-run.ts b/ui/src/tasks/use-task-run.ts
index 2fa843d89..a385f8572 100644
--- a/ui/src/tasks/use-task-run.ts
+++ b/ui/src/tasks/use-task-run.ts
@@ -24,9 +24,8 @@ import {
} from "vue";
import { useRoute, useRouter } from "vue-router";
-import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
+import { api } from "@/lib/api";
import { keepValue } from "@/lib/keep-unchanged";
-import { actionFor } from "@/lib/task-meta";
import { useLiveResource } from "@/stores/session";
import {
@@ -48,11 +47,6 @@ import {
/** A keyed read has three states: pending, failed, or the response. */
type Cache = Map;
-export interface RetryError {
- kind: ActionErrorKind;
- message: string;
-}
-
export interface TaskRun {
tab: string;
attempts: AttemptsState | null | undefined;
@@ -60,15 +54,11 @@ export interface TaskRun {
events: TaskEvent[] | null | undefined;
missing: boolean;
filters: LogFilters;
- retryBusy: boolean;
- retryError: RetryError | null;
task: TaskRecord | null;
attemptNumber: number | null;
currentAttempt: number | null;
stageNames: string[];
- retryKind: string;
- canRetry: boolean;
logState: LogState | null | undefined;
changesState: ChangesState | null | undefined;
debugState: DebugState | null | undefined;
@@ -78,7 +68,6 @@ export interface TaskRun {
selectAttempt(attempt: number): void;
setFilters(next: LogFilters): void;
refreshAll(): void;
- performRetry(): Promise;
loadAttempts(): void;
loadEvents(): void;
loadTaskList(): void;
@@ -108,8 +97,6 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
const logs = ref>(new Map());
const changes = ref>(new Map());
const debug = ref>(new Map());
- const retryBusy = ref(false);
- const retryError = ref(null);
const refreshToken = ref(0);
const task = computed(() =>
@@ -140,11 +127,6 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
),
]);
- const retryMeta = computed(() => actionFor("retry"));
- const canRetry = computed(() =>
- Boolean(retryMeta.value && (task.value?.actions || []).includes("retry")),
- );
-
const logKey = computed(() =>
id.value == null || attemptNumber.value == null
? null
@@ -296,6 +278,7 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
function refreshAll(): void {
dropCaches();
+ requestedAttempt.value = null;
loadTaskList();
loadAttempts(true);
loadEvents(true);
@@ -327,30 +310,6 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
useLiveResource("tasks", refreshLive, 500);
- async function performRetry(): Promise {
- if (id.value == null) return;
- retryError.value = null;
- retryBusy.value = true;
- try {
- await api.taskAction(String(id.value), "retry");
- // A new attempt starts here. Everything cached belongs to the attempt
- // that just ended, so it is dropped rather than shown against the new
- // run: the attempt history, the events, every cached log, capture and
- // debug payload. The new attempt then becomes the selected run without a
- // reload.
- dropCaches();
- requestedAttempt.value = null;
- loadTaskList();
- loadAttempts();
- loadEvents();
- refreshToken.value += 1;
- } catch (err) {
- retryError.value = classifyActionError(err);
- } finally {
- retryBusy.value = false;
- }
- }
-
onMounted(() => {
// The page loads once for the task it was opened for; the route remounts it
// when that changes (App.vue keys the outlet on the path).
@@ -396,14 +355,10 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
events,
missing,
filters,
- retryBusy,
- retryError,
task,
attemptNumber,
currentAttempt,
stageNames,
- retryKind: computed(() => retryMeta.value?.kind || ""),
- canRetry,
logState,
changesState,
debugState,
@@ -417,7 +372,6 @@ export function provideTaskRun(id: ComputedRef): TaskRun {
filters.value = { ...next };
},
refreshAll,
- performRetry,
loadAttempts,
loadEvents,
loadTaskList,
diff --git a/ui/test/task-actions.test.ts b/ui/test/task-actions.test.ts
index be56d2605..ce6876470 100644
--- a/ui/test/task-actions.test.ts
+++ b/ui/test/task-actions.test.ts
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { shownActionIds } from "../src/tasks/task-actions.ts";
+import { headerActionIds, shownActionIds } from "../src/tasks/task-actions.ts";
test("task surfaces preserve server-authorized actions and their order", () => {
const cases: Array<[string[] | null | undefined, string[] | undefined, string[]]> = [
@@ -16,3 +16,145 @@ test("task surfaces preserve server-authorized actions and their order", () => {
assert.deepEqual(shownActionIds(offered, only), expected, JSON.stringify({ offered, only }));
}
});
+
+test("task detail header exposes all server-authorized actions unless an approval panel owns them", () => {
+ const activeReviewGate = JSON.stringify({
+ head_sha: "abc123",
+ findings: [
+ {
+ key: "f1",
+ finding: {
+ Title: "Bug",
+ Body: "Fix it",
+ File: "a.go",
+ LineStart: 1,
+ LineEnd: 2,
+ Severity: "high",
+ Score: 90,
+ Confidence: 90,
+ },
+ },
+ ],
+ });
+ const emptyReviewGate = JSON.stringify({ head_sha: "abc123", findings: [] });
+ const resolvedReviewGate = JSON.stringify({
+ head_sha: "abc123",
+ outcome: "approved",
+ findings: JSON.parse(activeReviewGate).findings,
+ });
+
+ const cases: Array<{
+ name: string;
+ task: Parameters[0];
+ expected: string[];
+ }> = [
+ {
+ name: "null and undefined tasks",
+ task: null,
+ expected: [],
+ },
+ {
+ name: "parked task exposes retry, abandon, reject",
+ task: {
+ status: "parked",
+ actions: ["retry", "abandon", "reject"],
+ },
+ expected: ["retry", "abandon", "reject"],
+ },
+ {
+ name: "queued task exposes cancel and reject",
+ task: {
+ status: "queued",
+ actions: ["cancel", "reject"],
+ },
+ expected: ["cancel", "reject"],
+ },
+ {
+ name: "running task exposes stop and reject",
+ task: {
+ status: "running",
+ actions: ["stop", "reject"],
+ },
+ expected: ["stop", "reject"],
+ },
+ {
+ name: "waiting_approval with budget approval keeps approve, reject, rereview in header",
+ task: {
+ status: "waiting_approval",
+ approval: "budget",
+ actions: ["approve", "reject", "rereview"],
+ },
+ expected: ["approve", "reject", "rereview"],
+ },
+ {
+ name: "waiting_approval with plan approval and non-empty plan omits approve and reject",
+ task: {
+ status: "waiting_approval",
+ approval: "plan",
+ plan: "# Plan\nDo the work",
+ actions: ["approve", "reject", "rereview"],
+ },
+ expected: ["rereview"],
+ },
+ {
+ name: "waiting_approval with plan approval and missing or blank plan keeps all actions in header",
+ task: {
+ status: "waiting_approval",
+ approval: "plan",
+ plan: " ",
+ actions: ["approve", "reject"],
+ },
+ expected: ["approve", "reject"],
+ },
+ {
+ name: "waiting_approval with active review gate findings omits approve, rereview, reject",
+ task: {
+ status: "waiting_approval",
+ approval: "review",
+ review_gate: activeReviewGate,
+ actions: ["approve", "reject", "rereview"],
+ },
+ expected: [],
+ },
+ {
+ name: "waiting_approval with empty review gate findings keeps actions in header",
+ task: {
+ status: "waiting_approval",
+ approval: "review",
+ review_gate: emptyReviewGate,
+ actions: ["approve", "reject", "rereview"],
+ },
+ expected: ["approve", "reject", "rereview"],
+ },
+ {
+ name: "waiting_approval with already-resolved review gate keeps actions in header",
+ task: {
+ status: "waiting_approval",
+ approval: "review",
+ review_gate: resolvedReviewGate,
+ actions: ["approve", "reject", "rereview"],
+ },
+ expected: ["approve", "reject", "rereview"],
+ },
+ {
+ name: "pr_open task exposes merge, open_pr, open_issue, reject",
+ task: {
+ status: "pr_open",
+ actions: ["merge", "open_pr", "open_issue", "reject"],
+ },
+ expected: ["merge", "open_pr", "open_issue", "reject"],
+ },
+ {
+ name: "terminal task exposes archive",
+ task: {
+ status: "merged",
+ actions: ["archive"],
+ },
+ expected: ["archive"],
+ },
+ ];
+
+ for (const { name, task, expected } of cases) {
+ assert.deepEqual(headerActionIds(task), expected, name);
+ }
+});