fix(ui/tasks): failures read from the error catalogue

This commit is contained in:
sam committed 2026-11-13 13:41:23 +11:00
1 parent f9ac9229d5
commit 4c54d250f6
21 files changed
+124 -40

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
// Failure copy for the dashboard's own page.
export const dashboard = {
page: {
unresponsive: (detail: string) => `Archie is not responding: ${detail}`,
},
} as const;
+6
View File
@@ -3,8 +3,14 @@
// changed here and nowhere else.
import { chat } from "./chat.ts";
import { common } from "./common.ts";
import { dashboard } from "./dashboard.ts";
import { logs } from "./logs.ts";
import { tasks } from "./tasks.ts";
export const errors = {
chat,
common,
dashboard,
logs,
tasks,
} as const;
+10
View File
@@ -0,0 +1,10 @@
// Failure and empty-state copy for the log page.
export const logs = {
read: {
unreadable: "Cannot read logs",
},
empty: {
streamUnavailable: "Log stream unavailable",
streamUnavailableDetail: "This process is not delivering live daemon logs.",
},
} as const;
+44
View File
@@ -0,0 +1,44 @@
// Failure copy for the task board, the run page and its panels.
export const tasks = {
state: {
unresponsive: "Archie is not responding",
},
notes: {
listUnreadable:
"The task list could not be read, so the current status and operator controls are unavailable.",
notInRecentList: (id: string) =>
`Task ${id} is not in the recent tasks list, so its status and operator controls are unavailable.`,
},
panels: {
noAnswer: "Archie did not answer.",
},
attemptConfig: {
loadFailed: "Could not load this task's events",
},
// Shared by the stage rail and the attempts panel: both read the same request.
attempts: {
loadFailed: "Could not load this task's attempts",
},
debug: {
loadFailed: "Could not load the stored record",
},
changedFiles: {
loadFailed: "Could not load this attempt's changed files",
},
logs: {
loadFailed: "Could not load this attempt's log.",
pageFailed: "Could not load that page",
},
header: {
attemptFailed: (attempt: number | null, stage?: string) =>
`Attempt ${attempt} failed${stage ? ` during ${stage}` : ""}`,
noErrorLine: "No error log line was recorded for this attempt.",
jumpFailed: "Could not read this attempt’s error log.",
},
rowActions: {
authRequired: "Authentication required",
sessionExpired: "Dashboard authentication is required.",
broken: (message: string) => `${message}. Try again, or check the daemon.`,
unavailable: (label: string) => `${label} is unavailable`,
},
} as const;
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Alert, AlertDescription } from "@/components/ui/alert";
import { errors } from "@/copy/errors";
import { storeToRefs } from "pinia";
import { computed } from "vue";
@@ -22,7 +23,7 @@ const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "in
<template>
<h1 class="sr-only">Dashboard</h1>
<Alert v-if="error" variant="destructive" class="mb-4"><AlertDescription>Archie is not responding: {{ error }}</AlertDescription></Alert>
<Alert v-if="error" variant="destructive" class="mb-4"><AlertDescription>{{ errors.dashboard.page.unresponsive(error) }}</AlertDescription></Alert>
<div :class="setupIncomplete ? 'grid items-start gap-4 @3xl:grid-cols-[minmax(0,1fr)_320px]' : 'mx-auto max-w-5xl'">
<div class="grid min-w-0 gap-4">
<QuickTask class="mb-2" />
+4 -3
View File
@@ -7,7 +7,8 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { api, describeError } from "@/lib/api";
import { useOrgStore } from "@/stores/org";
import NewTaskDialog from "@/tasks/NewTaskDialog.vue";
import { firstLine } from "@/tasks/first-line";
@@ -35,7 +36,7 @@ onMounted(async () => {
definitions.value = (list?.definitions ?? []).filter((d) => d.enabled);
workflow.value ||= definitions.value[0]?.id ?? "";
} catch (err) {
loadError.value = String((err as Error).message || err);
loadError.value = describeError(err, errors.common.unknown);
} finally {
loaded.value = true;
}
@@ -70,7 +71,7 @@ async function run() {
});
void router.push(`/tasks/${result.task_id}`);
} catch (err) {
error.value = String((err as Error).message || err);
error.value = describeError(err, errors.common.unknown);
} finally {
submitting.value = false;
}
+2 -1
View File
@@ -5,6 +5,7 @@ import LogTable from "@/base/LogTable.vue";
import { Skeleton } from "@/components/ui/skeleton";
import { entryKey } from "./log-entries";
import { errors } from "@/copy/errors";
import LogsEmpty from "./LogsEmpty.vue";
import { emptyDetail, emptyTitle, entries, loading, readError } from "./state";
@@ -47,7 +48,7 @@ watch(
<div ref="scroller" class="max-h-[62vh] overflow-y-auto text-caption">
<!-- A failed read is about this page's request, not about the log, so it
says what the server said rather than borrowing an empty state. -->
<LogsEmpty v-if="readError" title="Cannot read logs" :detail="readError" />
<LogsEmpty v-if="readError" :title="errors.logs.read.unreadable" :detail="readError" />
<div
v-else-if="loading && !entries.length"
class="flex flex-col gap-3 px-3 py-4"
+3 -2
View File
@@ -1,12 +1,13 @@
// What the logs list says when it has nothing to show: a dead stream, a
// deployment with no durable history, or filters that match nothing.
import { errors } from "@/copy/errors";
/** logsEmptyTitle names the situation. */
export function logsEmptyTitle(
durableUnavailable: boolean,
streamState: string,
): string {
if (streamState === "unavailable") return "Log stream unavailable";
if (streamState === "unavailable") return errors.logs.empty.streamUnavailable;
if (durableUnavailable) return "No logs yet";
return "Nothing matches";
}
@@ -17,7 +18,7 @@ export function logsEmptyDetail(
streamState: string,
): string {
if (streamState === "unavailable") {
return "This process is not delivering live daemon logs.";
return errors.logs.empty.streamUnavailableDetail;
}
if (durableUnavailable) {
return "This deployment keeps no durable history.";
+4 -3
View File
@@ -1,6 +1,7 @@
import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { api, describeError } from "@/lib/api";
import { useSessionStore } from "@/stores/session";
import type { LogEntry } from "@/lib/log";
import type { StatusKind } from "@/lib/status";
@@ -65,7 +66,7 @@ export const entries = computed(() => {
});
/** A failed read, else the file the lines came from. */
export const meta = computed(() => (readError.value ? "Cannot read logs" : logFile.value));
export const meta = computed(() => (readError.value ? errors.logs.read.unreadable : logFile.value));
/** The stream's state as a badge kind. Never `ok` for a stream that is still
* connecting, and never `warn` for one that has given up: the two are
@@ -109,7 +110,7 @@ export async function loadLogs(): Promise<void> {
if(current!==generation)return;
// The server's own message is the only part of a failure an operator can
// act on, so it is what the list says instead of the lines.
readError.value = (err as Error).message || String(err);
readError.value = describeError(err, errors.common.unknown);
} finally {
if(current===generation)loading.value = false;
}
+3 -2
View File
@@ -2,6 +2,7 @@
import { computed } from "vue";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { errors } from "@/copy/errors";
import { configSchema } from "@/lib/task-meta";
import JsonBlock from "./JsonBlock.vue";
@@ -39,8 +40,8 @@ const recognised = computed(() => schema.value === configSchema());
/>
<PanelError
v-else-if="events === null"
title="Could not load this task's events"
detail="Archie did not answer."
:title="errors.tasks.attemptConfig.loadFailed"
:detail="errors.tasks.panels.noAnswer"
/>
<Empty v-else-if="!event">
+3 -2
View File
@@ -2,6 +2,7 @@
import { computed } from "vue";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { errors } from "@/copy/errors";
import ChangeCapture from "./ChangeCapture.vue";
import PanelError from "./PanelError.vue";
@@ -37,8 +38,8 @@ const nothingRecorded = computed(
<PanelLoading v-if="state === undefined" label="Loading changed files…" />
<PanelError
v-else-if="state === null"
title="Could not load this attempt's changed files"
detail="Archie did not answer."
:title="errors.tasks.changedFiles.loadFailed"
:detail="errors.tasks.panels.noAnswer"
/>
<Empty v-else-if="undecodable">
+4 -2
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { errors } from "@/copy/errors";
import JsonBlock from "./JsonBlock.vue";
import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
@@ -24,8 +26,8 @@ defineProps<{
<PanelLoading v-if="state === undefined" label="Loading the stored record…" />
<PanelError
v-else-if="state === null"
title="Could not load the stored record"
detail="Archie did not answer."
:title="errors.tasks.debug.loadFailed"
:detail="errors.tasks.panels.noAnswer"
/>
<div v-else>
<JsonBlock :value="state" />
+4 -3
View File
@@ -11,7 +11,8 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { SuggestInput } from "@/components/ui/suggest-input";
import { Spinner } from "@/components/ui/spinner";
import { Textarea } from "@/components/ui/textarea";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { api, describeError } from "@/lib/api";
import { delivered } from "@/lib/delivered";
import type { WorkflowDefinition, WorkflowStats } from "@/workflows/workflow-rows";
import {
@@ -44,7 +45,7 @@ onMounted(async () => {
stats.value = workflows?.workflows ?? [];
recentRepos.value = (repositories ?? []).map((repo) => `${repo.owner}/${repo.name}`);
} catch (err) {
loadError.value = String((err as Error).message || err);
loadError.value = describeError(err, errors.common.unknown);
}
});
@@ -92,7 +93,7 @@ async function submit() {
});
emit("started", result.task_id);
} catch (err) {
error.value = String((err as Error).message || err);
error.value = describeError(err, errors.common.unknown);
} finally {
submitting.value = false;
}
+3 -2
View File
@@ -16,6 +16,7 @@ import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
import StageRow from "./StageRow.vue";
import { selectConfigEvent, taskTimeLimitMs } from "./attempt-config";
import { errors } from "@/copy/errors";
import { duration } from "./timeline-event";
import { stageStatusMeta } from "./stage-rail";
import { useTaskRun } from "./use-task-run";
@@ -100,8 +101,8 @@ const timeLimit = computed(() => {
/>
<PanelError
v-else-if="state === null"
title="Could not load this task's attempts"
detail="Archie did not answer."
:title="errors.tasks.attempts.loadFailed"
:detail="errors.tasks.panels.noAnswer"
/>
<template v-else>
<Empty v-if="!attempts.length">
+4 -3
View File
@@ -15,6 +15,7 @@ import { Badge } from "@/components/ui/badge";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import { useOrgStore } from "@/stores/org";
import { runQuery, type LogState } from "./task-run";
import { firstLine } from "./first-line";
@@ -43,7 +44,7 @@ const failure = computed(() => {
const stage = attempt.value?.stages?.find((s) => s.error);
const current = run.attemptNumber === run.currentAttempt;
if (current && status.value === "parked") return { title: "Blocked", detail: run.task?.park_reason || stage?.error || "", parked: true };
if (attempt.value?.status === "failed" || (current && status.value === "dead")) return { title: `Attempt ${run.attemptNumber} failed${stage?.name ? ` during ${stage.name}` : ""}`, detail: stage?.error || run.task?.park_reason || "", parked: false };
if (attempt.value?.status === "failed" || (current && status.value === "dead")) return { title: errors.tasks.header.attemptFailed(run.attemptNumber, stage?.name), detail: stage?.error || run.task?.park_reason || "", parked: false };
return null;
});
// The daemon names a workflow's identity by its id in the parked reason; this
@@ -74,7 +75,7 @@ async function jumpToLog(): Promise<void> {
if (selected !== run.attemptNumber) return;
const entry = logs.entries?.[0];
if (!entry?.id) {
jumpError.value = "No error log line was recorded for this attempt.";
jumpError.value = errors.tasks.header.noErrorLine;
return;
}
run.setFilters({ level: "ERROR", stage: "" });
@@ -82,7 +83,7 @@ async function jumpToLog(): Promise<void> {
await nextTick();
await router.replace({ query: runQuery("log", selected), hash: `#log-line-${entry.id}` });
} catch {
if (selected === run.attemptNumber) jumpError.value = "Could not read this attempt’s error log.";
if (selected === run.attemptNumber) jumpError.value = errors.tasks.header.jumpFailed;
} finally {
jumping.value = false;
}
+5 -4
View File
@@ -11,6 +11,7 @@ import {
EmptyTitle,
} from "@/components/ui/empty";
import { api } from "@/lib/api";
import { errors } from "@/copy/errors";
import PanelLoading from "./PanelLoading.vue";
import PanelError from "./PanelError.vue";
@@ -150,7 +151,7 @@ const view = computed(() => {
if (state === null)
return {
kind: "failed" as const,
status: "This attempt's log could not be loaded",
status: errors.tasks.logs.loadFailed,
};
// A reader exists in this process but the attempt has no log file. That is a
// fact about the attempt, not about the deployment.
@@ -233,8 +234,8 @@ const rowKey = (entry: LogEntry) => String(entry.id ?? `${entry.time}|${entry.me
<PanelError
v-else-if="view.kind === 'failed'"
title="Could not load this attempt's log."
detail="Archie did not answer."
:title="errors.tasks.logs.loadFailed"
:detail="errors.tasks.panels.noAnswer"
retry-label="Retry"
@retry="emit('retry')"
/>
@@ -270,7 +271,7 @@ const rowKey = (entry: LogEntry) => String(entry.id ?? `${entry.time}|${entry.me
<Button variant="outline" size="sm" :disabled="!canOlder" @click="loadOlder">Older</Button>
<Button variant="outline" size="sm" :disabled="!canNewer || paging" @click="loadNewer">Newer</Button>
<span v-if="paging" class="text-caption text-fg-muted">Loading…</span>
<span v-else-if="pageError" class="text-caption text-danger">Could not load that page</span>
<span v-else-if="pageError" class="text-caption text-danger">{{ errors.tasks.logs.pageFailed }}</span>
<span v-else-if="current?.more_available" class="text-caption text-fg-muted"
>More available</span
>
+3 -2
View File
@@ -3,6 +3,7 @@ import { AlertTriangle } from "@lucide/vue";
import { computed } from "vue";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { errors } from "@/copy/errors";
import { useTaskRun } from "./use-task-run";
@@ -20,10 +21,10 @@ const run = useTaskRun();
const note = computed(() => {
if (run.taskList === null) {
return "The task list could not be read, so the current status and operator controls are unavailable.";
return errors.tasks.notes.listUnreadable;
}
if (Array.isArray(run.taskList) && !run.task) {
return `Task ${props.id} is not in the recent tasks list, so its status and operator controls are unavailable.`;
return errors.tasks.notes.notInRecentList(props.id);
}
return "";
});
+5 -4
View File
@@ -28,6 +28,7 @@ import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { MoreMenu } from "@/components/ui/more-menu";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { errors } from "@/copy/errors";
import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
import { actionFor, retryModes, type ActionMeta } from "@/lib/task-meta";
import type { Task } from "./task";
@@ -150,10 +151,10 @@ const confirmLabel = computed(() => confirmingMeta.value?.label || "Confirm");
const errorText = computed(() => {
if (!error.value) return "";
if (error.value.kind === "session-expired")
return "Dashboard authentication is required.";
return errors.tasks.rowActions.sessionExpired;
if (error.value.kind === "refused")
return `${error.value.message}`;
return `${error.value.message}. Try again, or check the daemon.`;
return errors.tasks.rowActions.broken(error.value.message);
});
// A link control points at the forge artefact the action names. Chat-sourced
@@ -278,7 +279,7 @@ function onConfirmationOpen(open: boolean) {
class="w-56 gap-0.5 px-2 py-1.5 text-caption whitespace-normal"
>
<AlertTitle v-if="error.kind === 'session-expired'" class="text-caption"
>Authentication required</AlertTitle
>{{ errors.tasks.rowActions.authRequired }}</AlertTitle
>
<AlertDescription class="text-caption">{{ errorText }}</AlertDescription>
</Alert>
@@ -317,7 +318,7 @@ function onConfirmationOpen(open: boolean) {
<Button variant="ghost" size="sm" disabled>{{ control.label }}</Button>
</span>
</TooltipTrigger>
<TooltipContent>{{ control.label }} is unavailable</TooltipContent>
<TooltipContent>{{ errors.tasks.rowActions.unavailable(control.label) }}</TooltipContent>
</Tooltip>
</template>
+3 -2
View File
@@ -8,6 +8,7 @@ import DebugView from "./DebugView.vue";
import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
import TaskLogs from "./TaskLogs.vue";
import { errors } from "@/copy/errors";
import { RUN_TABS } from "./task-run";
import { useTaskRun } from "./use-task-run";
@@ -34,8 +35,8 @@ const run = useTaskRun();
<PanelError
v-else-if="run.attempts === null"
title="Could not load this task's attempts"
detail="Archie did not answer."
:title="errors.tasks.attempts.loadFailed"
:detail="errors.tasks.panels.noAnswer"
retry-label="Retry"
@retry="run.refreshAll()"
/>
+4 -3
View File
@@ -24,7 +24,8 @@ import PageHeader from "@/base/PageHeader.vue";
import { keepRows } from "@/lib/keep-unchanged";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { api } from "@/lib/api";
import { api, describeError } from "@/lib/api";
import { errors } from "@/copy/errors";
import { statusList } from "@/lib/task-meta";
import { useLiveResource } from "@/stores/session";
import TaskFilters from "./TaskFilters.vue";
@@ -122,7 +123,7 @@ async function load() {
moreError.value = null;
} catch (err) {
if (current !== loadGeneration) return;
const message = String((err as Error).message || err);
const message = describeError(err, errors.common.unknown);
if (tasks.value === null) error.value = message;
else moreError.value = message;
}
@@ -144,7 +145,7 @@ async function loadMore() {
moreError.value = null;
} catch (err) {
if (current !== loadGeneration) return;
moreError.value = String((err as Error).message || err);
moreError.value = describeError(err, errors.common.unknown);
} finally {
loadingMore.value = false;
}
+2 -1
View File
@@ -10,6 +10,7 @@ import {
EmptyTitle,
} from "@/components/ui/empty";
import { Spinner } from "@/components/ui/spinner";
import { errors } from "@/copy/errors";
/**
* What the board says when it has no rows to draw: still fetching, unreachable,
@@ -25,7 +26,7 @@ const emit = defineEmits<{ clear: []; retry: [] }>();
const copy = computed(() => {
if (props.kind === "error") {
return {
title: "Archie is not responding",
title: errors.tasks.state.unresponsive,
description: props.detail || "",
};
}