Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(agents): label the process-cleanup failure reasons on web and mobile (#11486)

Eric Yum30490f60d634
diff --git a/.github/workflows/mobile-verify.yml b/.github/workflows/mobile-verify.yml
index 6fcb631633..3e7e8cbc37 100644
--- a/.github/workflows/mobile-verify.yml
+++ b/.github/workflows/mobile-verify.yml
@@ -9,6 +9,7 @@ name: Mobile Verify
# - packages/core/** — mobile imports types AND pure functions
# (agents, markdown, permissions, api/schemas, …),
# not only @multica/core/types
+# - shared failure reason fixture — mobile tests check label coverage
# - package.json / pnpm-lock.yaml — install graph
# - pnpm-workspace.yaml — catalog versions
# - turbo.json — turbo task pipeline
@@ -25,6 +26,7 @@ on:
paths:
- "apps/mobile/**"
- "packages/core/**"
+ - "packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
@@ -35,6 +37,7 @@ on:
paths:
- "apps/mobile/**"
- "packages/core/**"
+ - "packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
diff --git a/apps/mobile/lib/failure-reason-label.test.ts b/apps/mobile/lib/failure-reason-label.test.ts
index 9e3d8aa2e1..6cc7755574 100644
--- a/apps/mobile/lib/failure-reason-label.test.ts
+++ b/apps/mobile/lib/failure-reason-label.test.ts
@@ -1,4 +1,5 @@
// @vitest-environment node
+import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import chatEn from "../locales/en/chat.json";
@@ -29,6 +30,22 @@ describe("failureReasonKey", () => {
expect(runFailureBadgeLabel("runtime_access_revoked", tEn)).toBe("Access revoked");
});
+ // The server's reason list is a fixture the Go test
+ // TestClientFailureReasonFixture keeps current. Read from disk, not
+ // imported: mobile code does not depend on packages/views.
+ it("has a label for every reason the server taxonomy defines", () => {
+ const serverReasons: string[] = JSON.parse(
+ readFileSync(
+ new URL(
+ "../../../packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json",
+ import.meta.url,
+ ),
+ "utf8",
+ ),
+ );
+ expect(serverReasons.filter((reason) => !REASONS.has(reason))).toEqual([]);
+ });
+
it("falls back to a user-friendly unknown reason", () => {
expect(failureReasonKey("not_known_yet")).toBe(
"failure_reason.default",
diff --git a/apps/mobile/lib/failure-reason-label.ts b/apps/mobile/lib/failure-reason-label.ts
index 5d3c8b5c3c..3f4ebb649d 100644
--- a/apps/mobile/lib/failure-reason-label.ts
+++ b/apps/mobile/lib/failure-reason-label.ts
@@ -29,6 +29,8 @@ export const REASONS = new Set([
"runtime_reconnect_timeout",
"runtime_recovery",
"timeout",
+ "cleanup_unconfirmed",
+ "cleanup_blocked",
"iteration_limit",
"agent_blocked",
"api_invalid_request",
diff --git a/apps/mobile/locales/en/chat.json b/apps/mobile/locales/en/chat.json
index cfaf5ed76d..4d8b5e71ac 100644
--- a/apps/mobile/locales/en/chat.json
+++ b/apps/mobile/locales/en/chat.json
@@ -113,6 +113,8 @@
"runtime_reconnect_timeout": "Daemon did not reconnect in time",
"runtime_recovery": "Daemon restarted",
"timeout": "Run timed out",
+ "cleanup_unconfirmed": "Couldn't confirm the agent process stopped",
+ "cleanup_blocked": "Previous run may still be active. After confirming it stopped, retry a failed issue run for this agent on web or desktop if available.",
"iteration_limit": "Hit the iteration limit",
"agent_blocked": "Waiting on human input",
"api_invalid_request": "Rejected by the model API",
diff --git a/apps/mobile/locales/zh-Hans/chat.json b/apps/mobile/locales/zh-Hans/chat.json
index 3c13ed6c05..1128da5a6b 100644
--- a/apps/mobile/locales/zh-Hans/chat.json
+++ b/apps/mobile/locales/zh-Hans/chat.json
@@ -113,6 +113,8 @@
"runtime_reconnect_timeout": "守护进程未及时重新连接",
"runtime_recovery": "守护进程已重启",
"timeout": "运行超时",
+ "cleanup_unconfirmed": "未能确认智能体进程已退出",
+ "cleanup_blocked": "上次运行可能尚未结束。确认已停止后,如有该智能体的失败任务运行,可在网页版或桌面版重试。",
"iteration_limit": "达到迭代次数上限",
"agent_blocked": "等待人工输入",
"api_invalid_request": "模型 API 拒绝了请求",
diff --git a/apps/mobile/locales/zh-Hant/chat.json b/apps/mobile/locales/zh-Hant/chat.json
index 58e982940a..4ccf805ee3 100644
--- a/apps/mobile/locales/zh-Hant/chat.json
+++ b/apps/mobile/locales/zh-Hant/chat.json
@@ -113,6 +113,8 @@
"runtime_reconnect_timeout": "守護程序未及時重新連線",
"runtime_recovery": "守護程序已重啟",
"timeout": "執行逾時",
+ "cleanup_unconfirmed": "未能確認 AI 代理行程已結束",
+ "cleanup_blocked": "上次執行可能尚未結束。確認已停止後,如有此 AI 代理的失敗任務執行紀錄,可在網頁版或桌面版重試。",
"iteration_limit": "達到迭代次數上限",
"agent_blocked": "等待人工輸入",
"api_invalid_request": "模型 API 拒絕了請求",
diff --git a/apps/mobile/turbo.json b/apps/mobile/turbo.json
new file mode 100644
index 0000000000..cd9dc3c90b
--- /dev/null
+++ b/apps/mobile/turbo.json
@@ -0,0 +1,13 @@
+{
+ "extends": ["//"],
+ "tasks": {
+ "test": {
+ "inputs": [
+ "$TURBO_DEFAULT$",
+ // lib/failure-reason-label.test.ts checks mobile's labels against the
+ // failure reasons the server can emit, kept in one shared fixture.
+ "$TURBO_ROOT$/packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json"
+ ]
+ }
+ }
+}
diff --git a/packages/views/agents/components/tabs/activity-tab.render.test.tsx b/packages/views/agents/components/tabs/activity-tab.render.test.tsx
index ca8bb6ce6e..cad96a4264 100644
--- a/packages/views/agents/components/tabs/activity-tab.render.test.tsx
+++ b/packages/views/agents/components/tabs/activity-tab.render.test.tsx
@@ -331,3 +331,22 @@ describe("AgentWorkSections windowed history", () => {
expect(screen.queryByText("Issue issue-104")).not.toBeInTheDocument();
});
});
+
+describe("AgentWorkSections failure label", () => {
+ it("lets a long failure reason truncate beside the title and shows it in full on hover", async () => {
+ const failed: AgentTask = {
+ ...historyTask(0),
+ issue_id: "issue-1",
+ status: "failed",
+ failure_reason: "runtime_access_denied",
+ } as AgentTask;
+ agentTasksRef.current = () => Promise.resolve({ tasks: [failed], nextCursor: null });
+ renderTab();
+ const fullText = enAgents.task_failure.reasons.runtime_access_denied;
+ const label = await screen.findByText(fullText);
+ expect(label).toHaveAttribute("title", fullText);
+ expect(label).toHaveClass("min-w-0", "truncate");
+ expect(label).not.toHaveClass("shrink-0");
+ expect(await screen.findByText("Issue issue-1")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/agents/components/tabs/activity-tab.tsx b/packages/views/agents/components/tabs/activity-tab.tsx
index fe0baa613a..c1476870ea 100644
--- a/packages/views/agents/components/tabs/activity-tab.tsx
+++ b/packages/views/agents/components/tabs/activity-tab.tsx
@@ -779,7 +779,10 @@ const RecentTaskRow = memo(function RecentTaskRow({
the raw `task.error` (untranslated, with absolute paths, #7411)
lives in the transcript's Run details instead. */}
{failureLabel && (
- <span className="hidden shrink-0 text-caption text-destructive sm:inline">
+ <span
+ className="hidden min-w-0 max-w-[50%] truncate text-caption text-destructive sm:inline"
+ title={failureLabel}
+ >
{failureLabel}
</span>
)}
diff --git a/packages/views/agents/components/tabs/task-failure.test.ts b/packages/views/agents/components/tabs/task-failure.test.ts
index ecc22548ed..ad288f1e91 100644
--- a/packages/views/agents/components/tabs/task-failure.test.ts
+++ b/packages/views/agents/components/tabs/task-failure.test.ts
@@ -11,6 +11,9 @@ import koAgents from "../../../locales/ko/agents.json";
import zhHansAgents from "../../../locales/zh-Hans/agents.json";
import ruAgents from "../../../locales/ru/agents.json";
import zhHantAgents from "../../../locales/zh-Hant/agents.json";
+// Generated from server/pkg/taskfailure AllReasons; the Go test
+// TestClientFailureReasonFixture keeps it in step with the backend.
+import serverFailureReasons from "./test-fixtures/server-failure-reasons.json";
import {
FAILURE_REASON_I18N_KEYS,
@@ -47,6 +50,26 @@ function fixedT(locale: SupportedLocale): TFunction<"agents"> {
const enT = fixedT("en");
+describe("FAILURE_REASON_I18N_KEYS", () => {
+ // Every reason the backend can write needs a label, otherwise the run row
+ // shows the raw code.
+ it("has a label for every reason the server taxonomy defines", () => {
+ const missing = serverFailureReasons.filter(
+ (reason) => !Object.prototype.hasOwnProperty.call(FAILURE_REASON_I18N_KEYS, reason),
+ );
+ expect(missing).toEqual([]);
+ });
+
+ it("labels a run whose process cleanup was not confirmed", () => {
+ expect(failureReasonLabel("cleanup_unconfirmed", enT)).toBe(
+ "Couldn't confirm the agent process stopped",
+ );
+ expect(failureReasonLabel("cleanup_blocked", enT)).toBe(
+ "Previous run may be active; rerun manually",
+ );
+ });
+});
+
describe("cancellationActorLabel", () => {
it("names the member that cancelled a run", () => {
expect(cancellationActorLabel({
diff --git a/packages/views/agents/components/tabs/task-failure.ts b/packages/views/agents/components/tabs/task-failure.ts
index 8b17e6b0e3..4418f6d361 100644
--- a/packages/views/agents/components/tabs/task-failure.ts
+++ b/packages/views/agents/components/tabs/task-failure.ts
@@ -14,6 +14,8 @@ export const FAILURE_REASON_I18N_KEYS = {
runtime_reconnect_timeout: "runtime_reconnect_timeout",
runtime_recovery: "runtime_recovery",
timeout: "timeout",
+ cleanup_unconfirmed: "cleanup_unconfirmed",
+ cleanup_blocked: "cleanup_blocked",
iteration_limit: "iteration_limit",
agent_blocked: "agent_blocked",
api_invalid_request: "api_invalid_request",
diff --git a/packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json b/packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json
new file mode 100644
index 0000000000..79feb0d555
--- /dev/null
+++ b/packages/views/agents/components/tabs/test-fixtures/server-failure-reasons.json
@@ -0,0 +1,33 @@
+[
+ "queued_expired",
+ "runtime_offline",
+ "runtime_access_revoked",
+ "runtime_reconnect_timeout",
+ "runtime_recovery",
+ "timeout",
+ "cleanup_unconfirmed",
+ "cleanup_blocked",
+ "iteration_limit",
+ "agent_blocked",
+ "api_invalid_request",
+ "skill_bundle_unavailable",
+ "runtime_cli_timeout",
+ "environment_prepare_failed",
+ "local_directory_missing",
+ "invalid_task_identity",
+ "runtime_access_denied",
+ "agent_error.provider_auth_or_access",
+ "agent_error.provider_quota_limit",
+ "agent_error.provider_capacity_or_rate_limit",
+ "agent_error.provider_server_error",
+ "agent_error.provider_network",
+ "agent_error.process_failure",
+ "agent_error.empty_or_unparseable_output",
+ "agent_error.agent_timeout",
+ "agent_error.context_overflow",
+ "agent_error.missing_config",
+ "agent_error.model_not_found_or_unavailable",
+ "agent_error.runtime_version_unsupported",
+ "agent_error.runtime_missing_executable",
+ "agent_error.unknown"
+]
diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.json
index 884622a7cf..193a33568a 100644
--- a/packages/views/locales/en/agents.json
+++ b/packages/views/locales/en/agents.json
@@ -1036,6 +1036,8 @@
"runtime_recovery": "Daemon restarted",
"runtime_access_revoked": "Runtime access revoked",
"timeout": "Run timed out",
+ "cleanup_unconfirmed": "Couldn't confirm the agent process stopped",
+ "cleanup_blocked": "Previous run may be active; rerun manually",
"iteration_limit": "Hit the iteration limit",
"agent_blocked": "Waiting on human input",
"api_invalid_request": "Rejected by the model API",
diff --git a/packages/views/locales/es/agents.json b/packages/views/locales/es/agents.json
index 59c6bc2a40..c755a2781a 100644
--- a/packages/views/locales/es/agents.json
+++ b/packages/views/locales/es/agents.json
@@ -1011,6 +1011,8 @@
"runtime_recovery": "El daemon se reinició",
"runtime_access_revoked": "Acceso al runtime revocado",
"timeout": "La ejecución agotó el tiempo",
+ "cleanup_unconfirmed": "No se pudo confirmar que el proceso del agente se detuvo",
+ "cleanup_blocked": "Una ejecución previa puede seguir activa; reinicia a mano",
"iteration_limit": "Se alcanzó el límite de iteraciones",
"agent_blocked": "Esperando entrada humana",
"api_invalid_request": "Rechazada por la API del modelo",
diff --git a/packages/views/locales/fr/agents.json b/packages/views/locales/fr/agents.json
index 3c95273dd3..7c154d8603 100644
--- a/packages/views/locales/fr/agents.json
+++ b/packages/views/locales/fr/agents.json
@@ -1036,6 +1036,8 @@
"runtime_recovery": "Daemon redémarré",
"runtime_access_revoked": "Accès au runtime révoqué",
"timeout": "Délai d'exécution dépassé",
+ "cleanup_unconfirmed": "Impossible de confirmer l'arrêt du processus de l'agent",
+ "cleanup_blocked": "Exécution précédente peut-être en cours ; relancez",
"iteration_limit": "Limite d'itérations atteinte",
"agent_blocked": "En attente d'une réponse humaine",
"api_invalid_request": "Rejetée par l'API du modèle",
diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.json
index 6a3376603d..b99bf5932c 100644
--- a/packages/views/locales/ja/agents.json
+++ b/packages/views/locales/ja/agents.json
@@ -865,6 +865,8 @@
"runtime_recovery": "デーモンが再起動しました",
"runtime_access_revoked": "ランタイムへのアクセスが取り消されました",
"timeout": "実行がタイムアウトしました",
+ "cleanup_unconfirmed": "エージェントプロセスの終了を確認できませんでした",
+ "cleanup_blocked": "前回の実行が未終了の可能性。手動で再実行",
"iteration_limit": "反復回数の上限に達しました",
"agent_blocked": "人による入力を待機中",
"api_invalid_request": "モデル API に拒否されました",
diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.json
index 75b01ea455..7742fd5dcd 100644
--- a/packages/views/locales/ko/agents.json
+++ b/packages/views/locales/ko/agents.json
@@ -865,6 +865,8 @@
"runtime_recovery": "데몬 재시작됨",
"runtime_access_revoked": "런타임 접근이 취소됨",
"timeout": "실행 시간 초과",
+ "cleanup_unconfirmed": "에이전트 프로세스 종료를 확인하지 못함",
+ "cleanup_blocked": "이전 실행이 남아 있을 수 있음. 수동 재실행",
"iteration_limit": "반복 횟수 제한에 도달함",
"agent_blocked": "사용자 입력 대기 중",
"api_invalid_request": "모델 API에서 요청을 거부함",
diff --git a/packages/views/locales/ru/agents.json b/packages/views/locales/ru/agents.json
index 1cadb9542a..5dfbdd1c42 100644
--- a/packages/views/locales/ru/agents.json
+++ b/packages/views/locales/ru/agents.json
@@ -1096,6 +1096,8 @@
"runtime_recovery": "Демон перезапущен",
"runtime_access_revoked": "Доступ к среде выполнения отозван",
"timeout": "Истекло время выполнения запуска",
+ "cleanup_unconfirmed": "Не удалось подтвердить остановку процесса агента",
+ "cleanup_blocked": "Прошлый запуск может идти; перезапустите вручную",
"iteration_limit": "Достигнут лимит итераций",
"agent_blocked": "Ожидание ввода от человека",
"api_invalid_request": "Отклонено API модели",
diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.json
index 18b7006c53..beed855857 100644
--- a/packages/views/locales/zh-Hans/agents.json
+++ b/packages/views/locales/zh-Hans/agents.json
@@ -1006,6 +1006,8 @@
"runtime_recovery": "守护进程已重启",
"runtime_access_revoked": "运行时访问已撤销",
"timeout": "运行超时",
+ "cleanup_unconfirmed": "未能确认智能体进程已退出",
+ "cleanup_blocked": "上次运行可能未结束,需手动重跑",
"iteration_limit": "达到迭代次数上限",
"agent_blocked": "等待人工输入",
"api_invalid_request": "模型 API 拒绝了请求",
diff --git a/packages/views/locales/zh-Hant/agents.json b/packages/views/locales/zh-Hant/agents.json
index 137bcdea4d..c6fbe00704 100644
--- a/packages/views/locales/zh-Hant/agents.json
+++ b/packages/views/locales/zh-Hant/agents.json
@@ -1006,6 +1006,8 @@
"runtime_recovery": "守護程序已重啟",
"runtime_access_revoked": "執行時訪問已撤銷",
"timeout": "執行超時",
+ "cleanup_unconfirmed": "未能確認 AI 代理行程已結束",
+ "cleanup_blocked": "上次執行可能未結束,需手動重新執行",
"iteration_limit": "達到迭代次數上限",
"agent_blocked": "等待人工輸入",
"api_invalid_request": "模型 API 拒絕了請求",
diff --git a/server/pkg/taskfailure/client_fixture_test.go b/server/pkg/taskfailure/client_fixture_test.go
new file mode 100644
index 0000000000..74b56165dc
--- /dev/null
+++ b/server/pkg/taskfailure/client_fixture_test.go
@@ -0,0 +1,49 @@
+package taskfailure
+
+import (
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "runtime"
+ "slices"
+ "testing"
+)
+
+// The web and mobile clients each keep their own label table for
+// failure_reason, so a new reason here can ship with no label and show up as
+// the raw code (web) or a bare "Failed" (mobile). The clients' tests read
+// this fixture and fail when a reason in it has no label, so it must keep
+// matching AllReasons. Regenerate it with
+// UPDATE_FAILURE_REASON_FIXTURE=1 go test ./pkg/taskfailure/ -run TestClientFailureReasonFixture
+func TestClientFailureReasonFixture(t *testing.T) {
+ _, here, _, _ := runtime.Caller(0)
+ path := filepath.Join(filepath.Dir(here), "..", "..", "..", "packages", "views", "agents", "components", "tabs", "test-fixtures", "server-failure-reasons.json")
+
+ want := make([]string, 0, len(allReasons))
+ for _, r := range AllReasons() {
+ want = append(want, r.String())
+ }
+
+ if os.Getenv("UPDATE_FAILURE_REASON_FIXTURE") == "1" {
+ b, err := json.MarshalIndent(want, "", " ")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(path, append(b, '\n'), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ return
+ }
+
+ raw, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("fixture not readable: %v", err)
+ }
+ var got []string
+ if err := json.Unmarshal(raw, &got); err != nil {
+ t.Fatalf("fixture not JSON: %v", err)
+ }
+ if !slices.Equal(got, want) {
+ t.Fatalf("fixture %v\nAllReasons %v\n(regenerate the fixture, then add web/mobile labels for any new reason)", got, want)
+ }
+}