Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(daemon): say when a project's linked folder no longer exists (MUL-9665) (#10996)
Jiayuan Zhang81d88d86b0b6
diff --git a/apps/docs/content/docs/tasks.fr.mdx b/apps/docs/content/docs/tasks.fr.mdxindex 2ef576f878..3f35c7f039 100644--- a/apps/docs/content/docs/tasks.fr.mdx+++ b/apps/docs/content/docs/tasks.fr.mdx@@ -105,6 +105,7 @@ Les motifs d'échec affichés dans le journal d'exécution et dans les [Statisti| `queued_expired` | Le runtime a cessé d'envoyer des signaux de vie pendant plus longtemps que le délai de grâce de reconnexion, et l'exécution était aussi en file d'attente depuis aussi longtemps | Vérifiez que le runtime est en ligne, puis relancez || `runtime_recovery` | Le daemon a récupéré une exécution interrompue après son redémarrage | Relancez directement || `environment_prepare_failed` | Le daemon n'a pas pu préparer l'environnement d'exécution — son répertoire de travail, ou la configuration locale du runtime qui y est écrite | Lisez l'erreur brute pour savoir quelle étape a échoué, puis vérifiez cette machine : espace disque, permissions, répertoire encore utilisé, ou configuration locale de l'outil de codage IA |+| `local_directory_missing` | Le dossier local lié au projet n'existe plus sur l'ordinateur qui exécute l'agent — il a été supprimé ou déplacé après avoir été lié | Restaurez le dossier au même chemin, puis réessayez. Pour utiliser un nouvel emplacement, retirez l'ancien dossier dans **Ressources → Dossiers locaux** et liez le nouveau depuis l'application de bureau sur cet ordinateur — les navigateurs ne peuvent pas sélectionner de dossiers ; voir [Ressources du projet](/project-resources) || `cancelled` | Arrêtée manuellement, ou annulée avec un archivage ou une suppression | Rien à faire || `timeout` | Dépassement de la limite de durée d'exécution configurée pour le daemon | Réduisez le périmètre de la tâche, ou ajustez `agent_timeout` du daemon || `iteration_limit` | Plafond d'itérations d'une exécution atteint | Réduisez le périmètre de la tâche |diff --git a/apps/docs/content/docs/tasks.ja.mdx b/apps/docs/content/docs/tasks.ja.mdxindex e11484b3fd..376beb89c7 100644--- a/apps/docs/content/docs/tasks.ja.mdx+++ b/apps/docs/content/docs/tasks.ja.mdx@@ -105,6 +105,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";| `queued_expired` | ランタイムが再接続猶予を超えてハートビートを停止し、かつその作業も同じ時間キューで待っていた | ランタイムがオンラインであることを確認してからリトライ || `runtime_recovery` | デーモンが再起動後、中断された実行を回収した | そのままリトライ || `environment_prepare_failed` | デーモンがこの実行に必要な環境(作業ディレクトリ、およびそこに書き込むローカルランタイム設定)を準備できなかった | 生のエラーでどの段階が失敗したかを確認し、そのマシンのディスク空き容量・権限・ディレクトリの使用状況、AI コーディングツールのローカル設定を点検 |+| `local_directory_missing` | プロジェクトに関連付けたローカルフォルダが、エージェントを実行するコンピュータ上にもう存在しない(関連付けた後に削除または移動された) | フォルダを元のパスに戻してから再試行。新しい場所を使う場合は、**リソース → ローカルフォルダ** で古いフォルダを削除し、そのコンピュータの Desktop から新しい場所を関連付ける(ブラウザではフォルダを選択できない)。[プロジェクトリソース](/project-resources) を参照 || `cancelled` | 手動で停止されたか、アーカイブ・削除に伴ってキャンセルされた | 対処不要 || `timeout` | デーモンに設定された実行時間の上限を超えた | タスクの範囲を狭めるか、デーモンの `agent_timeout` を調整する || `iteration_limit` | 実行の反復回数の上限に達した | タスクの範囲を狭める |diff --git a/apps/docs/content/docs/tasks.ko.mdx b/apps/docs/content/docs/tasks.ko.mdxindex 759b9db3fc..2880019ded 100644--- a/apps/docs/content/docs/tasks.ko.mdx+++ b/apps/docs/content/docs/tasks.ko.mdx@@ -105,6 +105,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";| `queued_expired` | 런타임이 재연결 유예를 넘겨 하트비트를 멈췄고, 실행 자체도 그만큼 큐에서 기다림 | 런타임이 온라인인지 확인한 뒤 재시도 || `runtime_recovery` | 데몬 재시작 후 중단된 실행을 회수함 | 바로 재시도 || `environment_prepare_failed` | 데몬이 이번 실행에 필요한 환경(작업 디렉터리, 그리고 거기에 기록되는 로컬 런타임 설정)을 준비하지 못함 | 원본 오류로 어느 단계가 실패했는지 확인한 뒤 해당 머신의 디스크 여유 공간, 권한, 디렉터리 사용 여부, AI 코딩 도구의 로컬 설정을 점검 |+| `local_directory_missing` | 프로젝트에 연결된 로컬 폴더가 에이전트를 실행하는 컴퓨터에 더 이상 없음 — 연결한 뒤 삭제되거나 이동됨 | 폴더를 원래 경로로 복원한 뒤 재시도. 새 위치를 쓰려면 **리소스 → 로컬 폴더**에서 기존 폴더를 제거하고 해당 컴퓨터의 Desktop에서 새 위치를 연결(브라우저에서는 폴더를 선택할 수 없음). [프로젝트 리소스](/project-resources) 참고 || `cancelled` | 수동으로 중지되었거나 보관 또는 삭제와 함께 취소됨 | 별도 처리 불필요 || `timeout` | 데몬에 설정된 실행 시간 상한을 초과함 | 태스크 범위를 줄이거나 데몬의 `agent_timeout` 조정 || `iteration_limit` | 실행 반복 횟수 상한에 도달함 | 태스크 범위 축소 |diff --git a/apps/docs/content/docs/tasks.mdx b/apps/docs/content/docs/tasks.mdxindex eb48001184..b39852d019 100644--- a/apps/docs/content/docs/tasks.mdx+++ b/apps/docs/content/docs/tasks.mdx@@ -105,6 +105,7 @@ The failure reasons shown in the execution log and [Analytics](/analytics#errors| `queued_expired` | The runtime stopped heartbeating for longer than the reconnect grace, and the run had also been queued that long | Confirm the runtime is online, then retry || `runtime_recovery` | The daemon reclaimed an interrupted run after restarting | Retry directly || `environment_prepare_failed` | The daemon could not set up the execution environment for this run — its working directory, or the local runtime config written into it | Read the raw error to see which step failed, then check that machine: disk space, permissions, a directory still in use, or the AI coding tool's local config |+| `local_directory_missing` | The local folder linked to the project no longer exists on the computer running the agent — it was deleted or moved after it was linked | Restore the folder at the same path, then retry. To use a new location, remove the old folder under **Resources → Local folders** and link the new one from Desktop on that computer — browsers cannot pick folders; see [Project resources](/project-resources) || `cancelled` | Stopped manually, or cancelled along with an archive or delete | Nothing to do || `timeout` | Exceeded the daemon's configured execution time limit | Narrow the issue scope, or adjust the daemon's `agent_timeout` || `iteration_limit` | Hit the iteration cap for a run | Narrow the issue scope |diff --git a/apps/docs/content/docs/tasks.zh-Hant.mdx b/apps/docs/content/docs/tasks.zh-Hant.mdxindex a34f6a1c82..fd535ae028 100644--- a/apps/docs/content/docs/tasks.zh-Hant.mdx+++ b/apps/docs/content/docs/tasks.zh-Hant.mdx@@ -105,6 +105,7 @@ AI 代理自身返回的錯誤通常不會自動重試。鑑權失效、額度| `queued_expired` | 執行時心跳缺席超過重連寬限期,且該執行也已排隊滿這麼久 | 確認執行時線上後重試 || `runtime_recovery` | 守護程序重啟後回收了中斷的執行 | 直接重試 || `environment_prepare_failed` | 守護程序沒能準備好本次執行的執行環境——工作目錄,或寫入其中的本地執行時配置 | 先看原始錯誤定位是哪一步失敗,再檢查那臺機器:磁碟空間、權限、目錄是否仍被佔用,或 AI 程式設計工具的本地配置 |+| `local_directory_missing` | 專案關聯的本地資料夾在執行 AI 代理的那臺電腦上已不存在——關聯之後被刪除或移走了 | 把資料夾恢復到原路徑後重試。要換到新位置,在 **資源 → 本地資料夾** 裡移除舊資料夾,再在那臺電腦的 Desktop 中關聯新位置(瀏覽器無法選擇資料夾);參見 [專案資源](/project-resources) || `cancelled` | 被手動停止,或隨歸檔、刪除一併取消 | 無需處理 || `timeout` | 超過守護程序配置的執行時長上限 | 縮小任務範圍,或調整守護程序的 `agent_timeout` || `iteration_limit` | 達到執行輪次上限 | 縮小任務範圍 |diff --git a/apps/docs/content/docs/tasks.zh.mdx b/apps/docs/content/docs/tasks.zh.mdxindex 98acd687bd..ce76b15ea9 100644--- a/apps/docs/content/docs/tasks.zh.mdx+++ b/apps/docs/content/docs/tasks.zh.mdx@@ -105,6 +105,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";| `queued_expired` | 运行时心跳缺席超过重连宽限期,且该运行也已排队满这么久 | 确认运行时在线后重试 || `runtime_recovery` | 守护进程重启后回收了中断的执行 | 直接重试 || `environment_prepare_failed` | 守护进程没能准备好本次执行的运行环境——工作目录,或写入其中的本地运行时配置 | 先看原始错误定位是哪一步失败,再检查那台机器:磁盘空间、权限、目录是否仍被占用,或 AI 编程工具的本地配置 |+| `local_directory_missing` | 项目关联的本地文件夹在运行智能体的那台电脑上已不存在——关联之后被删除或移走了 | 把文件夹恢复到原路径后重试。要换到新位置,在 **资源 → 本地文件夹** 里移除旧文件夹,再在那台电脑的 Desktop 中关联新位置(浏览器无法选择文件夹);参见 [项目资源](/project-resources) || `cancelled` | 被手动停止,或随归档、删除一并取消 | 无需处理 || `timeout` | 超过守护进程配置的执行时长上限 | 缩小任务范围,或调整守护进程的 `agent_timeout` || `iteration_limit` | 达到执行轮次上限 | 缩小任务范围 |diff --git a/apps/mobile/components/issue/run-row.tsx b/apps/mobile/components/issue/run-row.tsxindex 23ecfd0e2c..9d32ef6b54 100644--- a/apps/mobile/components/issue/run-row.tsx+++ b/apps/mobile/components/issue/run-row.tsx@@ -102,7 +102,7 @@ function StatusBadge({ task }: { task: AgentTask }) {// For failed tasks, surface the failure_reason inline so users don't have// to drill in. Missing / empty / unrecognised stays as just "Failed".if (task.status === "failed") {- const reasonLabel = runFailureBadgeLabel(task.failure_reason);+ const reasonLabel = runFailureBadgeLabel(task.failure_reason, t);if (reasonLabel) {return (<Text className={`text-xs ${cls}`}>diff --git a/apps/mobile/data/agent-task-schema.test.ts b/apps/mobile/data/agent-task-schema.test.tsindex f8f4c0677b..bf7ba031d0 100644--- a/apps/mobile/data/agent-task-schema.test.ts+++ b/apps/mobile/data/agent-task-schema.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from "vitest";+import { i18n } from "@/lib/i18n/singleton";import { runFailureBadgeLabel } from "@/lib/run-failure-badge";import { AgentTaskSchema } from "./schemas";@@ -47,7 +48,7 @@ describe("AgentTaskSchema failure_reason (#7913 regression)", () => {// The end-to-end shape of the bug: parse, then look up. Either half alone// passed while the run row still rendered a bare "Failed".const task = parseFailedTask("environment_prepare_failed");- expect(runFailureBadgeLabel(task.failure_reason)).toBe(+ expect(runFailureBadgeLabel(task.failure_reason, i18n.getFixedT("en", "issues"))).toBe("Environment setup failed",);});diff --git a/apps/mobile/lib/failure-reason-label.test.ts b/apps/mobile/lib/failure-reason-label.test.tsindex e1c3cf4880..9e3d8aa2e1 100644--- a/apps/mobile/lib/failure-reason-label.test.ts+++ b/apps/mobile/lib/failure-reason-label.test.ts@@ -4,8 +4,11 @@ import { describe, expect, it } from "vitest";import chatEn from "../locales/en/chat.json";import chatZh from "../locales/zh-Hans/chat.json";import { failureReasonKey, REASONS } from "./failure-reason-label";+import { i18n } from "./i18n/singleton";import { runFailureBadgeLabel } from "./run-failure-badge";+const tEn = i18n.getFixedT("en", "issues");+describe("failureReasonKey", () => {it("maps known reasons to i18n keys", () => {expect(failureReasonKey("runtime_access_denied")).toBe(@@ -23,7 +26,7 @@ describe("failureReasonKey", () => {expect(chatEn.failure_reason.runtime_access_revoked).toBe("Runtime access was revoked. Bind the agent to an accessible runtime before starting another run.",);- expect(runFailureBadgeLabel("runtime_access_revoked")).toBe("Access revoked");+ expect(runFailureBadgeLabel("runtime_access_revoked", tEn)).toBe("Access revoked");});it("falls back to a user-friendly unknown reason", () => {@@ -31,7 +34,7 @@ describe("failureReasonKey", () => {"failure_reason.default",);expect(failureReasonKey(null)).toBe("failure_reason.default");- expect(runFailureBadgeLabel("not_known_yet")).toBeUndefined();+ expect(runFailureBadgeLabel("not_known_yet", tEn)).toBeUndefined();});// The REASONS set and the locale bundles drifted once before: keys existeddiff --git a/apps/mobile/lib/failure-reason-label.ts b/apps/mobile/lib/failure-reason-label.tsindex 9affee3a58..5d3c8b5c3c 100644--- a/apps/mobile/lib/failure-reason-label.ts+++ b/apps/mobile/lib/failure-reason-label.ts@@ -62,6 +62,7 @@ export const REASONS = new Set(["codex_resume_oversized","idle_watchdog","local_directory_error",+ "local_directory_missing","cancelled",// Coarse values, still present on historical rows.diff --git a/apps/mobile/lib/run-failure-badge.test.ts b/apps/mobile/lib/run-failure-badge.test.tsindex 196e5e69c1..5f592f9cef 100644--- a/apps/mobile/lib/run-failure-badge.test.ts+++ b/apps/mobile/lib/run-failure-badge.test.ts@@ -1,37 +1,58 @@import { describe, expect, it } from "vitest";+import { i18n } from "./i18n/singleton";import { runFailureBadgeLabel } from "./run-failure-badge";+const tEn = i18n.getFixedT("en", "issues");+describe("runFailureBadgeLabel", () => {it("names the reasons the backend classifies today", () => {- expect(runFailureBadgeLabel("agent_error.provider_network")).toBe(+ expect(runFailureBadgeLabel("agent_error.provider_network", tEn)).toBe("Network error",);- expect(runFailureBadgeLabel("skill_bundle_unavailable")).toBe(+ expect(runFailureBadgeLabel("skill_bundle_unavailable", tEn)).toBe("Skill download failed",);// #7913: the run died setting up its environment on the executing// machine. The badge has to say so — "Failed" alone is what sent the// original report's diagnosis at a model provider.- expect(runFailureBadgeLabel("environment_prepare_failed")).toBe(+ expect(runFailureBadgeLabel("environment_prepare_failed", tEn)).toBe("Environment setup failed",);- expect(runFailureBadgeLabel("runtime_access_denied")).toBe(+ expect(runFailureBadgeLabel("runtime_access_denied", tEn)).toBe("No runtime access",);});+ it("names a deleted project folder in the reader's language", () => {+ expect(runFailureBadgeLabel("local_directory_missing", tEn)).toBe(+ "Folder missing",+ );+ expect(+ runFailureBadgeLabel(+ "local_directory_missing",+ i18n.getFixedT("zh-Hans", "issues"),+ ),+ ).toBe("文件夹不存在");+ expect(+ runFailureBadgeLabel(+ "local_directory_missing",+ i18n.getFixedT("zh-Hant", "issues"),+ ),+ ).toBe("資料夾不存在");+ });+it("keeps the pre-MUL-1949 coarse values readable", () => {- expect(runFailureBadgeLabel("agent_error")).toBe("Agent error");- expect(runFailureBadgeLabel("manual")).toBe("Manual");+ expect(runFailureBadgeLabel("agent_error", tEn)).toBe("Agent error");+ expect(runFailureBadgeLabel("manual", tEn)).toBe("Manual");});it("degrades to no badge for a reason newer than this build", () => {// The row renders a bare status word instead. Unlike web, a compact badge// has no room for the raw wire value, so silence is the fallback — but it// must be a miss on THIS map, not a value the parser threw away upstream.- expect(runFailureBadgeLabel("some_future_reason")).toBeUndefined();- expect(runFailureBadgeLabel(undefined)).toBeUndefined();- expect(runFailureBadgeLabel("")).toBeUndefined();+ expect(runFailureBadgeLabel("some_future_reason", tEn)).toBeUndefined();+ expect(runFailureBadgeLabel(undefined, tEn)).toBeUndefined();+ expect(runFailureBadgeLabel("", tEn)).toBeUndefined();});});diff --git a/apps/mobile/lib/run-failure-badge.ts b/apps/mobile/lib/run-failure-badge.tsindex 4ff2a94fcc..4838b20d83 100644--- a/apps/mobile/lib/run-failure-badge.ts+++ b/apps/mobile/lib/run-failure-badge.ts@@ -53,9 +53,19 @@ const FAILURE_REASON_BADGE: Record<string, string> = {manual: "Manual",};+/**+ * Reasons whose badge copy lives in the `issues` namespace+ * (`runs.failure_badge.*`) rather than in the English-only map above.+ */+const LOCALIZED_FAILURE_REASON_BADGE = new Set(["local_directory_missing"]);+export function runFailureBadgeLabel(reason: string | null | undefined,+ t: (key: string) => string,): string | undefined {if (!reason) return undefined;+ if (LOCALIZED_FAILURE_REASON_BADGE.has(reason)) {+ return t(`runs.failure_badge.${reason}`);+ }return FAILURE_REASON_BADGE[reason];}diff --git a/apps/mobile/locales/en/chat.json b/apps/mobile/locales/en/chat.jsonindex bc92155d44..cbee6876bf 100644--- a/apps/mobile/locales/en/chat.json+++ b/apps/mobile/locales/en/chat.json@@ -141,6 +141,7 @@"codex_resume_oversized": "Session too large to resume","idle_watchdog": "Agent stopped after inactivity","local_directory_error": "Local directory error",+ "local_directory_missing": "Project's local folder no longer exists","cancelled": "Cancelled by the system","agent_error": "Agent execution error","codex_semantic_inactivity": "Codex semantic inactivity timeout",diff --git a/apps/mobile/locales/en/issues.json b/apps/mobile/locales/en/issues.jsonindex f56c85827e..f0543568e8 100644--- a/apps/mobile/locales/en/issues.json+++ b/apps/mobile/locales/en/issues.json@@ -275,6 +275,9 @@"completed": "Run succeeded","failed": "Run failed","cancelled": "Cancelled"+ },+ "failure_badge": {+ "local_directory_missing": "Folder missing"}},"header_filter": "Filter",diff --git a/apps/mobile/locales/zh-Hans/chat.json b/apps/mobile/locales/zh-Hans/chat.jsonindex 5d570a420a..ed1d5abf3f 100644--- a/apps/mobile/locales/zh-Hans/chat.json+++ b/apps/mobile/locales/zh-Hans/chat.json@@ -141,6 +141,7 @@"codex_resume_oversized": "会话过大,无法恢复","idle_watchdog": "智能体长时间无活动,运行已停止","local_directory_error": "本地目录出错",+ "local_directory_missing": "项目的本地文件夹已不存在","cancelled": "系统已取消","agent_error": "智能体执行出错","codex_semantic_inactivity": "Codex 长时间没有语义进展",diff --git a/apps/mobile/locales/zh-Hans/issues.json b/apps/mobile/locales/zh-Hans/issues.jsonindex e6dcd8cc5b..50d7939dee 100644--- a/apps/mobile/locales/zh-Hans/issues.json+++ b/apps/mobile/locales/zh-Hans/issues.json@@ -271,6 +271,9 @@"completed": "运行成功","failed": "运行失败","cancelled": "已取消"+ },+ "failure_badge": {+ "local_directory_missing": "文件夹不存在"}},"header_filter": "筛选",diff --git a/apps/mobile/locales/zh-Hant/chat.json b/apps/mobile/locales/zh-Hant/chat.jsonindex 34ee868193..5ac7bcd013 100644--- a/apps/mobile/locales/zh-Hant/chat.json+++ b/apps/mobile/locales/zh-Hant/chat.json@@ -141,6 +141,7 @@"codex_resume_oversized": "會話過大,無法恢復","idle_watchdog": "AI 代理長時間無活動,執行已停止","local_directory_error": "本地目錄出錯",+ "local_directory_missing": "專案的本地資料夾已不存在","cancelled": "系統已取消","agent_error": "AI 代理執行出錯","codex_semantic_inactivity": "Codex 長時間沒有語義進展",diff --git a/apps/mobile/locales/zh-Hant/issues.json b/apps/mobile/locales/zh-Hant/issues.jsonindex 09fe3cfe37..35e59387bf 100644--- a/apps/mobile/locales/zh-Hant/issues.json+++ b/apps/mobile/locales/zh-Hant/issues.json@@ -271,6 +271,9 @@"completed": "執行成功","failed": "執行失敗","cancelled": "已取消"+ },+ "failure_badge": {+ "local_directory_missing": "資料夾不存在"}},"header_filter": "篩選",diff --git a/packages/views/agents/components/tabs/task-failure.test.ts b/packages/views/agents/components/tabs/task-failure.test.tsindex 9d11f6b1aa..b5d32046d1 100644--- a/packages/views/agents/components/tabs/task-failure.test.ts+++ b/packages/views/agents/components/tabs/task-failure.test.ts@@ -193,6 +193,17 @@ describe("failureReasonLabel", () => {);});+ // MUL-9665: a project's linked folder that was deleted used to read as the+ // generic "Local directory error", which never said the folder was gone.+ it("names a deleted project folder instead of a generic local directory error", () => {+ expect(failureReasonLabel("local_directory_missing", enT)).toBe(+ "Project's local folder no longer exists",+ );+ expect(failureReasonLabel("local_directory_missing", fixedT("zh-Hans"))).toBe(+ "项目的本地文件夹已不存在",+ );+ });+it("localizes the legacy user cancellation value retained by the service", () => {expect(failureReasonLabel("user_cancelled", enT)).toBe("Cancelled by user",diff --git a/packages/views/agents/components/tabs/task-failure.ts b/packages/views/agents/components/tabs/task-failure.tsindex 50a83f0f91..8b17e6b0e3 100644--- a/packages/views/agents/components/tabs/task-failure.ts+++ b/packages/views/agents/components/tabs/task-failure.ts@@ -53,6 +53,7 @@ export const FAILURE_REASON_I18N_KEYS = {codex_resume_oversized: "codex_resume_oversized",idle_watchdog: "idle_watchdog",local_directory_error: "local_directory_error",+ local_directory_missing: "local_directory_missing",cancelled: "cancelled",// Pre-MUL-1949 coarse values, still present on historical rows.diff --git a/packages/views/chat/components/chat-message-list.test.tsx b/packages/views/chat/components/chat-message-list.test.tsxindex c457d9d593..51c115528d 100644--- a/packages/views/chat/components/chat-message-list.test.tsx+++ b/packages/views/chat/components/chat-message-list.test.tsx@@ -995,6 +995,17 @@ describe("ChatMessageList failure copy (MUL-5370 regression)", () => {expect(screen.queryByText(FALLBACK)).not.toBeInTheDocument();});+ it("tells the reader to restore or relink a deleted project folder", async () => {+ // MUL-9665. The reason has no agent_error family to degrade into, so+ // without an entry it would land on the generic fallback, which cannot+ // say the folder is gone or where to fix it.+ renderFailure("local_directory_missing");+ expect(+ await screen.findByText(enChat.message_list.failure.local_directory_missing),+ ).toBeInTheDocument();+ expect(screen.queryByText(FALLBACK)).not.toBeInTheDocument();+ });+it("renders dedicated recovery copy for persisted runtime access denial", async () => {renderFailure("runtime_access_denied");expect(diff --git a/packages/views/chat/components/chat-message-list.tsx b/packages/views/chat/components/chat-message-list.tsxindex 4324d92fd1..0e7288d668 100644--- a/packages/views/chat/components/chat-message-list.tsx+++ b/packages/views/chat/components/chat-message-list.tsx@@ -1105,6 +1105,7 @@ function FailureBubble({skill_bundle_unavailable: t(($) => $.message_list.failure.skill_bundle_unavailable),runtime_cli_timeout: t(($) => $.message_list.failure.runtime_cli_timeout),environment_prepare_failed: t(($) => $.message_list.failure.environment_prepare_failed),+ local_directory_missing: t(($) => $.message_list.failure.local_directory_missing),"agent_error.provider_network": t(($) => $.message_list.failure.provider_network),"agent_error.provider_auth_or_access": t(($) => $.message_list.failure.provider_auth_or_access),"agent_error.provider_quota_limit": t(($) => $.message_list.failure.provider_quota_limit),diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.jsonindex 36cd22a55e..393ddea7e5 100644--- a/packages/views/locales/en/agents.json+++ b/packages/views/locales/en/agents.json@@ -1053,6 +1053,7 @@"codex_resume_oversized": "Session too large to resume","idle_watchdog": "Agent stopped after inactivity","local_directory_error": "Local directory error",+ "local_directory_missing": "Project's local folder no longer exists","cancelled": "Cancelled by the system","agent_error": "Agent execution error","codex_semantic_inactivity": "Codex semantic inactivity timeout",diff --git a/packages/views/locales/en/chat.json b/packages/views/locales/en/chat.jsonindex 2b507cd9f6..370dd025e5 100644--- a/packages/views/locales/en/chat.json+++ b/packages/views/locales/en/chat.json@@ -85,6 +85,7 @@"skill_bundle_unavailable": "The agent's skills couldn't be downloaded, so it never got started. This is usually a connection problem — please try again.","runtime_cli_timeout": "The local OpenClaw CLI didn't answer in time, so this run never started. It's a local startup timeout, not a network problem — retrying won't help until the CLI gets faster or the timeout is raised (MULTICA_OPENCLAW_CLI_TIMEOUT).","environment_prepare_failed": "The machine running the agent couldn't set this run up, so it never started. The error below says what failed there — often disk space, a permission, a folder still in use, or a local config that couldn't be read. It isn't the agent or the model provider.",+ "local_directory_missing": "The local folder linked to this project no longer exists on the machine running the agent, so the run never started. Restore the folder, then try again. To use a different folder, open Resources → Local folders in the project with the desktop app on that machine and link it there — a browser can't choose folders.","provider_network": "The connection to the model provider dropped before the reply finished. Check your network and try again.","provider_auth_or_access": "The agent's model account isn't signed in any more. Sign in again, then retry.","provider_quota_limit": "The agent's model account has run out of credit. Top it up or switch accounts, then retry.",diff --git a/packages/views/locales/es/agents.json b/packages/views/locales/es/agents.jsonindex b8bf1d93b5..56c95449e9 100644--- a/packages/views/locales/es/agents.json+++ b/packages/views/locales/es/agents.json@@ -1035,6 +1035,7 @@"codex_resume_oversized": "Sesión demasiado grande para reanudar","idle_watchdog": "El agente se detuvo por inactividad","local_directory_error": "Error de directorio local",+ "local_directory_missing": "La carpeta local del proyecto ya no existe","cancelled": "Cancelada por el sistema","agent_error": "Error de ejecución del agente","codex_semantic_inactivity": "Tiempo de inactividad semántica de Codex agotado",diff --git a/packages/views/locales/es/chat.json b/packages/views/locales/es/chat.jsonindex b8268044a8..cd1af73561 100644--- a/packages/views/locales/es/chat.json+++ b/packages/views/locales/es/chat.json@@ -84,6 +84,7 @@"skill_bundle_unavailable": "No se han podido descargar las skills del agente, así que nunca se puso en marcha. Suele ser un problema de conexión: inténtalo de nuevo.","runtime_cli_timeout": "La CLI local de OpenClaw no respondió a tiempo, así que esta ejecución nunca arrancó. Es un timeout de arranque local, no un problema de red: reintentar no ayudará hasta que la CLI sea más rápida o se aumente el timeout (MULTICA_OPENCLAW_CLI_TIMEOUT).","environment_prepare_failed": "La máquina que ejecuta el agente no pudo preparar esta ejecución, así que nunca arrancó. El error de abajo indica qué falló allí: a menudo espacio en disco, un permiso, una carpeta aún en uso, o una configuración local ilegible. No es el agente ni el proveedor del modelo.",+ "local_directory_missing": "La carpeta local vinculada a este proyecto ya no existe en la máquina que ejecuta el agente, así que la ejecución nunca arrancó. Restaura la carpeta y vuelve a intentarlo. Para usar otra carpeta, abre Recursos → Carpetas locales del proyecto en la app de escritorio de esa máquina y vincúlala de nuevo: el navegador no puede elegir carpetas.","provider_network": "La conexión con el proveedor del modelo se perdió antes de que terminara la respuesta. Comprueba tu red e inténtalo de nuevo.","provider_auth_or_access": "La cuenta de modelo del agente ya no tiene la sesión iniciada. Inicia sesión de nuevo y reintenta.","provider_quota_limit": "La cuenta de modelo del agente se ha quedado sin crédito. Recárgala o cambia de cuenta, y reintenta.",diff --git a/packages/views/locales/fr/agents.json b/packages/views/locales/fr/agents.jsonindex 07a0919096..4cc39bb213 100644--- a/packages/views/locales/fr/agents.json+++ b/packages/views/locales/fr/agents.json@@ -1053,6 +1053,7 @@"codex_resume_oversized": "Session trop volumineuse pour être reprise","idle_watchdog": "Agent arrêté après une période d'inactivité","local_directory_error": "Erreur de répertoire local",+ "local_directory_missing": "Le dossier local du projet n'existe plus","cancelled": "Annulée par le système","agent_error": "Erreur d'exécution de l'agent","codex_semantic_inactivity": "Délai d'inactivité sémantique de Codex dépassé",diff --git a/packages/views/locales/fr/chat.json b/packages/views/locales/fr/chat.jsonindex 97a25ccb1a..0d224fe670 100644--- a/packages/views/locales/fr/chat.json+++ b/packages/views/locales/fr/chat.json@@ -85,6 +85,7 @@"skill_bundle_unavailable": "Les skills de l'agent n'ont pas pu être téléchargés : il n'a donc jamais démarré. C'est généralement un problème de connexion — veuillez réessayer.","runtime_cli_timeout": "L'outil OpenClaw local n'a pas répondu à temps, l'exécution n'a donc jamais démarré. C'est un délai de démarrage local, pas un problème de réseau — réessayer ne servira à rien tant que l'outil ne démarrera pas plus vite ou que le délai ne sera pas allongé (MULTICA_OPENCLAW_CLI_TIMEOUT).","environment_prepare_failed": "La machine de l'agent n'a pas pu préparer cette exécution, qui n'a donc jamais démarré. L'erreur ci-dessous indique la cause locale : souvent un manque d'espace disque, une permission, un dossier encore utilisé ou une configuration illisible. Le problème ne vient ni de l'agent ni du fournisseur du modèle.",+ "local_directory_missing": "Le dossier local lié à ce projet n'existe plus sur la machine de l'agent, donc l'exécution n'a jamais démarré. Restaurez le dossier, puis réessayez. Pour utiliser un autre dossier, ouvrez Ressources → Dossiers locaux du projet dans l'application de bureau de cette machine et liez-le à nouveau : un navigateur ne peut pas choisir de dossier.","provider_network": "La connexion au fournisseur du modèle a été perdue avant la fin de la réponse. Vérifiez votre réseau et réessayez.","provider_auth_or_access": "Le compte de modèle de l'agent n'est plus connecté. Reconnectez-vous, puis réessayez.","provider_quota_limit": "Le compte de modèle de l'agent n'a plus de crédit. Rechargez-le ou changez de compte, puis réessayez.",diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.jsonindex 0c07bbf74e..71d6a15066 100644--- a/packages/views/locales/ja/agents.json+++ b/packages/views/locales/ja/agents.json@@ -887,6 +887,7 @@"codex_resume_oversized": "セッションが大きすぎて再開できません","idle_watchdog": "エージェントが長時間応答しなかったため停止しました","local_directory_error": "ローカルディレクトリエラー",+ "local_directory_missing": "プロジェクトのローカルフォルダが見つかりません","cancelled": "システムによってキャンセルされました","agent_error": "エージェント実行エラー","codex_semantic_inactivity": "Codex に進行がないままタイムアウトしました",diff --git a/packages/views/locales/ja/chat.json b/packages/views/locales/ja/chat.jsonindex d36deb51e9..f16565f4d4 100644--- a/packages/views/locales/ja/chat.json+++ b/packages/views/locales/ja/chat.json@@ -82,6 +82,7 @@"skill_bundle_unavailable": "エージェントの skill をダウンロードできず、返信を開始できませんでした。多くの場合はネットワークの問題です。もう一度お試しください。","runtime_cli_timeout": "ローカルの OpenClaw CLI が時間内に応答せず、この実行は開始されませんでした。ネットワークではなくローカルの起動タイムアウトです。CLI が速くなるか、タイムアウト(MULTICA_OPENCLAW_CLI_TIMEOUT)を延ばすまで再試行しても成功しません。","environment_prepare_failed": "エージェントを実行しているマシンでこの実行を準備できず、開始されませんでした。何が失敗したかは下のエラーに出ています——ディスクの空き容量、権限、使用中のフォルダー、読み取れないローカル設定などが多いです。エージェントやモデルプロバイダーの問題ではありません。",+ "local_directory_missing": "このプロジェクトに関連付けたローカルフォルダが、エージェントを実行しているマシン上にもう存在しないため、実行は開始されませんでした。フォルダを元に戻してから、もう一度お試しください。別のフォルダを使う場合は、そのマシンのデスクトップアプリでプロジェクトの「リソース → ローカルフォルダ」を開いて関連付け直してください。ブラウザではフォルダを選択できません。","provider_network": "モデルサービスとの接続が切断され、返信を完了できませんでした。ネットワークを確認してから再度お試しください。","provider_auth_or_access": "エージェントのモデルアカウントのログインが無効になりました。再度ログインしてからお試しください。","provider_quota_limit": "エージェントのモデルアカウントの残高が不足しています。チャージするかアカウントを切り替えてからお試しください。",diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.jsonindex 25ce23c926..e1332e7d13 100644--- a/packages/views/locales/ko/agents.json+++ b/packages/views/locales/ko/agents.json@@ -887,6 +887,7 @@"codex_resume_oversized": "세션이 너무 커서 재개할 수 없음","idle_watchdog": "에이전트가 장시간 응답하지 않아 중지됨","local_directory_error": "로컬 디렉터리 오류",+ "local_directory_missing": "프로젝트의 로컬 폴더가 더 이상 없음","cancelled": "시스템에서 취소함","agent_error": "에이전트 실행 오류","codex_semantic_inactivity": "Codex 의미 진행 없음 시간 초과",diff --git a/packages/views/locales/ko/chat.json b/packages/views/locales/ko/chat.jsonindex 64a3f15f6c..378de4ce9c 100644--- a/packages/views/locales/ko/chat.json+++ b/packages/views/locales/ko/chat.json@@ -82,6 +82,7 @@"skill_bundle_unavailable": "에이전트의 skill을 내려받지 못해 답변을 시작하지 못했습니다. 대개 네트워크 연결 문제입니다. 다시 시도해 주세요.","runtime_cli_timeout": "로컬 OpenClaw CLI가 제한 시간 안에 응답하지 않아 이번 실행이 시작되지 못했습니다. 네트워크 문제가 아니라 로컬 실행 지연입니다. CLI가 빨라지거나 제한 시간(MULTICA_OPENCLAW_CLI_TIMEOUT)을 늘리기 전에는 다시 시도해도 실패합니다.","environment_prepare_failed": "에이전트를 실행하는 머신에서 이번 실행을 준비하지 못해 시작되지 못했습니다. 무엇이 실패했는지는 아래 오류에 나옵니다 — 디스크 공간, 권한, 사용 중인 폴더, 읽을 수 없는 로컬 설정 등이 흔합니다. 에이전트나 모델 제공자의 문제가 아닙니다.",+ "local_directory_missing": "이 프로젝트에 연결된 로컬 폴더가 에이전트를 실행하는 머신에 더 이상 없어 실행이 시작되지 않았습니다. 폴더를 복원한 뒤 다시 시도하세요. 다른 폴더를 쓰려면 그 머신의 데스크톱 앱에서 프로젝트의 \"리소스 → 로컬 폴더\"를 열어 다시 연결하세요. 브라우저에서는 폴더를 선택할 수 없습니다.","provider_network": "모델 서비스와의 연결이 끊겨 답변을 완료하지 못했습니다. 네트워크를 확인한 뒤 다시 시도해 주세요.","provider_auth_or_access": "에이전트의 모델 계정 로그인이 만료되었습니다. 다시 로그인한 뒤 시도해 주세요.","provider_quota_limit": "에이전트의 모델 계정 잔액이 부족합니다. 충전하거나 계정을 변경한 뒤 시도해 주세요.",diff --git a/packages/views/locales/ru/agents.json b/packages/views/locales/ru/agents.jsonindex 159e6bfcce..ba49f52535 100644--- a/packages/views/locales/ru/agents.json+++ b/packages/views/locales/ru/agents.json@@ -1103,6 +1103,7 @@"codex_resume_oversized": "Сессия слишком велика для возобновления","idle_watchdog": "Агент остановлен после простоя","local_directory_error": "Ошибка локального каталога",+ "local_directory_missing": "Локальная папка проекта больше не существует","cancelled": "Отменено системой","agent_error": "Ошибка выполнения агента","codex_semantic_inactivity": "Тайм-аут семантического простоя Codex",diff --git a/packages/views/locales/ru/chat.json b/packages/views/locales/ru/chat.jsonindex 24590d7925..d186bd638b 100644--- a/packages/views/locales/ru/chat.json+++ b/packages/views/locales/ru/chat.json@@ -91,6 +91,7 @@"skill_bundle_unavailable": "Не удалось загрузить навыки агента, поэтому запуск не состоялся. Обычно это проблема с подключением — попробуйте ещё раз.","runtime_cli_timeout": "Локальный CLI OpenClaw не ответил вовремя, поэтому запуск так и не начался. Это тайм-аут локального запуска, а не проблема сети — повтор не поможет, пока CLI не станет быстрее или не будет увеличен тайм-аут (MULTICA_OPENCLAW_CLI_TIMEOUT).","environment_prepare_failed": "Машина, на которой работает агент, не смогла подготовить этот запуск, поэтому он так и не начался. Ошибка ниже описывает, что там пошло не так — часто это нехватка места на диске, права доступа, занятая папка или локальная конфигурация, которую не удалось прочитать. Проблема не в агенте и не в провайдере модели.",+ "local_directory_missing": "Локальной папки, привязанной к этому проекту, больше нет на машине, где работает агент, поэтому запуск так и не начался. Восстановите папку и повторите попытку. Чтобы использовать другую папку, откройте «Ресурсы → Локальные папки» проекта в десктоп-приложении на этой машине и привяжите её заново: в браузере выбрать папку нельзя.","provider_network": "Соединение с провайдером модели прервалось до завершения ответа. Проверьте сеть и попробуйте ещё раз.","provider_auth_or_access": "Учётная запись модели агента больше не авторизована. Войдите заново и повторите попытку.","provider_quota_limit": "На учётной записи модели агента закончились средства. Пополните баланс или переключите учётную запись, затем повторите попытку.",diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.jsonindex 209b961b3a..b3758707be 100644--- a/packages/views/locales/zh-Hans/agents.json+++ b/packages/views/locales/zh-Hans/agents.json@@ -1028,6 +1028,7 @@"codex_resume_oversized": "会话过大,无法恢复","idle_watchdog": "智能体长时间无活动,运行已停止","local_directory_error": "本地目录出错",+ "local_directory_missing": "项目的本地文件夹已不存在","cancelled": "系统已取消","agent_error": "智能体执行出错","codex_semantic_inactivity": "Codex 长时间没有语义进展",diff --git a/packages/views/locales/zh-Hans/chat.json b/packages/views/locales/zh-Hans/chat.jsonindex 2337c78a9f..980d5fcc1f 100644--- a/packages/views/locales/zh-Hans/chat.json+++ b/packages/views/locales/zh-Hans/chat.json@@ -82,6 +82,7 @@"skill_bundle_unavailable": "没能下载到智能体的 skill,这次回复没有启动。通常是网络连接问题,请重试。","runtime_cli_timeout": "本机 OpenClaw CLI 没能在超时时间内响应,这次运行没有启动。这是本地启动超时,不是网络问题——除非 CLI 变快或调大超时(MULTICA_OPENCLAW_CLI_TIMEOUT),否则重试也不会成功。","environment_prepare_failed": "运行智能体的那台机器没能把这次运行准备好,任务没有启动。下方的原始错误会说明是哪一步失败——常见的是磁盘空间、权限、目录仍被占用,或本地配置读不出来。与智能体和模型厂商无关。",+ "local_directory_missing": "这个项目关联的本地文件夹在运行智能体的那台机器上已不存在,任务没有启动。恢复这个文件夹后再试;如果要换一个文件夹,需要在那台机器的桌面端打开项目的「资源 → 本地文件夹」重新关联,浏览器里无法选择文件夹。","provider_network": "与模型服务的连接中断,回复没能完成。检查网络后重试。","provider_auth_or_access": "智能体的模型账号登录已失效。重新登录后再试。","provider_quota_limit": "智能体的模型账号额度已用尽。充值或更换账号后再试。",diff --git a/packages/views/locales/zh-Hant/agents.json b/packages/views/locales/zh-Hant/agents.jsonindex a4c7e4caf7..4cd5eba4fd 100644--- a/packages/views/locales/zh-Hant/agents.json+++ b/packages/views/locales/zh-Hant/agents.json@@ -1028,6 +1028,7 @@"codex_resume_oversized": "會話過大,無法恢復","idle_watchdog": "AI 代理長時間無活動,執行已停止","local_directory_error": "本地目錄出錯",+ "local_directory_missing": "專案的本地資料夾已不存在","cancelled": "系統已取消","agent_error": "AI 代理執行出錯","codex_semantic_inactivity": "Codex 長時間沒有語義進展",diff --git a/packages/views/locales/zh-Hant/chat.json b/packages/views/locales/zh-Hant/chat.jsonindex 00c7e72261..44b7815f82 100644--- a/packages/views/locales/zh-Hant/chat.json+++ b/packages/views/locales/zh-Hant/chat.json@@ -82,6 +82,7 @@"skill_bundle_unavailable": "沒能下載到 AI 代理的 skill,這次回覆沒有啟動。通常是網路連線問題,請重試。","runtime_cli_timeout": "本機 OpenClaw CLI 沒能在超時時間內響應,這次執行沒有啟動。這是本地啟動超時,不是網路問題——除非 CLI 變快或調大超時(MULTICA_OPENCLAW_CLI_TIMEOUT),否則重試也不會成功。","environment_prepare_failed": "執行 AI 代理的那臺機器沒能把這次執行準備好,任務沒有啟動。下方的原始錯誤會說明是哪一步失敗——常見的是磁碟空間、權限、目錄仍被佔用,或本地配置讀不出來。與 AI 代理和模型廠商無關。",+ "local_directory_missing": "這個專案關聯的本地資料夾在執行 AI 代理的那臺機器上已不存在,任務沒有啟動。恢復這個資料夾後再試;如果要換一個資料夾,需要在那臺機器的桌面端開啟專案的「資源 → 本地資料夾」重新關聯,瀏覽器裡無法選擇資料夾。","provider_network": "與模型服務的連線中斷,回覆沒能完成。檢查網路後重試。","provider_auth_or_access": "AI 代理的模型帳號登入已失效。重新登入後再試。","provider_quota_limit": "AI 代理的模型帳號額度已用盡。充值或更換帳號後再試。",diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 6a592104ac..23ce9a465a 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -6430,7 +6430,8 @@ func withoutWorktreePreserved(err error) error {//// 1. The project_resource JSON is structurally broken — fail the task fast.// 2. The path fails validation (missing, not a directory, no R/W, system-// blacklist) — fail the task fast with a user-facing reason.+// blacklist) — fail the task fast with a user-facing reason; a missing+// directory gets its own local_directory_missing reason.// 3. The mutex is held by another task — call MarkTaskWaitingLocalDirectory// so the row flips to waiting_local_directory while we block on the// lock, returning execution capacity during the wait. Reacquire capacity@@ -6475,11 +6476,15 @@ func (d *Daemon) acquireLocalDirectoryLockIfNeeded(ctx context.Context, task Tas}if err := validateLocalPath(assignment.AbsPath); err != nil {taskLog.Error("local_directory: path validation failed", "error", err)+ failureReason := "local_directory_error"+ if errors.Is(err, errLocalDirectoryMissing) {+ failureReason = taskfailure.ReasonLocalDirectoryMissing.String()+ }if failErr := d.reportTerminalTask(ctx, terminalTaskReport{kind: terminalTaskReportFail,taskID: task.ID,errorMessage: err.Error(),- failureReason: "local_directory_error",+ failureReason: failureReason,}); failErr != nil {taskLog.Error("fail task after local_directory validation error", "error", failErr)}diff --git a/server/internal/daemon/local_directory.go b/server/internal/daemon/local_directory.goindex bdfbd68a20..db07479b62 100644--- a/server/internal/daemon/local_directory.go+++ b/server/internal/daemon/local_directory.go@@ -243,6 +243,14 @@ func resolveRealPath(absPath string) (string, error) {return real, nil}+// errLocalDirectoryMissing marks a linked directory that no longer exists on+// this machine — the user deleted or moved it after linking it to the project.+// acquireLocalDirectoryLockIfNeeded reports it as local_directory_missing+// rather than the generic local_directory_error, so the run says what to fix.+// The message text is also the server's witness for upgrading older daemons'+// reports (taskfailure.NormalizeDaemonReason); keep its prefix stable.+var errLocalDirectoryMissing = errors.New("local_directory: path does not exist")+// validateLocalPath enforces the daemon-side preconditions for running an// agent against a user-supplied directory://@@ -273,7 +281,7 @@ func validateLocalPath(absPath string) error {info, err := os.Stat(absPath)if err != nil {if os.IsNotExist(err) {- return fmt.Errorf("local_directory: path does not exist: %q", absPath)+ return fmt.Errorf("%w: %q", errLocalDirectoryMissing, absPath)}return fmt.Errorf("local_directory: stat %q: %w", absPath, err)}diff --git a/server/internal/daemon/local_directory_test.go b/server/internal/daemon/local_directory_test.goindex 91c73bde06..31d868daae 100644--- a/server/internal/daemon/local_directory_test.go+++ b/server/internal/daemon/local_directory_test.go@@ -10,11 +10,14 @@ import ("os""path/filepath""runtime"+ "strconv""strings""sync""sync/atomic""testing""time"++ "github.com/multica-ai/multica/server/pkg/taskfailure")func TestFindLocalDirectoryAssignment(t *testing.T) {@@ -795,6 +798,107 @@ func TestAcquireLocalDirectoryLock_EarlyFailureReportsWithCancelledParent(t *tes}}+// MUL-9665: a project's linked folder deleted after it was linked must fail the+// run as local_directory_missing — the generic local_directory_error gave the+// user no hint that the folder itself was gone. Every other validation failure+// keeps the generic reason.+func TestAcquireLocalDirectoryLock_ReportsDeletedDirectoryAsMissing(t *testing.T) {+ t.Parallel()++ type failReport struct {+ Error string `json:"error"`+ FailureReason string `json:"failure_reason"`+ }+ reports := make(chan failReport, 1)+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {+ if !strings.HasSuffix(req.URL.Path, "/fail") {+ t.Errorf("unexpected daemon call: %s %s", req.Method, req.URL.Path)+ w.WriteHeader(http.StatusOK)+ return+ }+ var body failReport+ if err := json.NewDecoder(req.Body).Decode(&body); err != nil {+ t.Errorf("decode fail body: %v", err)+ }+ reports <- body+ w.WriteHeader(http.StatusOK)+ }))+ t.Cleanup(srv.Close)++ const daemonID = "d-test"+ d := &Daemon{+ client: NewClient(srv.URL),+ logger: slog.Default(),+ localPathLocks: NewLocalPathLocker(),+ cfg: Config{DaemonID: daemonID},+ }++ notADirectory := filepath.Join(t.TempDir(), "file.txt")+ if err := os.WriteFile(notADirectory, []byte("x"), 0o600); err != nil {+ t.Fatalf("write file: %v", err)+ }+ tests := []struct {+ name string+ path func(t *testing.T) string+ wantReason string+ }{+ {+ name: "linked folder deleted",+ path: func(t *testing.T) string {+ dir := filepath.Join(t.TempDir(), "project")+ if err := os.Mkdir(dir, 0o755); err != nil {+ t.Fatalf("mkdir: %v", err)+ }+ if err := os.RemoveAll(dir); err != nil {+ t.Fatalf("remove linked folder: %v", err)+ }+ return dir+ },+ wantReason: taskfailure.ReasonLocalDirectoryMissing.String(),+ },+ {+ name: "path is a file",+ path: func(*testing.T) string { return notADirectory },+ wantReason: "local_directory_error",+ },+ }++ for _, tc := range tests {+ t.Run(tc.name, func(t *testing.T) {+ path := tc.path(t)+ ref, err := json.Marshal(localDirectoryRef{LocalPath: path, DaemonID: daemonID})+ if err != nil {+ t.Fatalf("marshal ref: %v", err)+ }+ task := Task{+ ID: "task-" + strings.ReplaceAll(tc.name, " ", "-"),+ ProjectResources: []ProjectResourceData{+ {ID: "r1", ResourceType: localDirectoryResourceType, ResourceRef: ref},+ },+ }++ release, abort := d.acquireLocalDirectoryLockIfNeeded(context.Background(), task, slog.Default(), newTestTaskSlot(0))+ if !abort || release != nil {+ t.Fatalf("acquire = (release != nil: %v, abort: %v), want the task aborted without a lock", release != nil, abort)+ }+ got := <-reports+ if got.FailureReason != tc.wantReason {+ t.Errorf("failure_reason = %q, want %q (error %q)", got.FailureReason, tc.wantReason, got.Error)+ }+ // validateLocalPath formats the path with %q, which escapes Windows+ // backslashes.+ if quoted := strconv.Quote(path); !strings.Contains(got.Error, quoted) {+ t.Errorf("error %q does not name the linked path %s", got.Error, quoted)+ }+ // The server upgrades older daemons' reports by this text, so the+ // two must agree on the reason.+ if normalized := taskfailure.NormalizeDaemonReason("local_directory_error", got.Error).String(); normalized != tc.wantReason {+ t.Errorf("server normalization of an older daemon's report = %q, want %q", normalized, tc.wantReason)+ }+ })+ }+}+// Worktree mode exists to let sibling tasks on one directory run at the same// time, so the per-path mutex must not be taken at all. If it were, the mode// would look implemented while still serialising every task.diff --git a/server/pkg/taskfailure/classify.go b/server/pkg/taskfailure/classify.goindex 5c60217ce0..8ab75f8a85 100644--- a/server/pkg/taskfailure/classify.go+++ b/server/pkg/taskfailure/classify.go@@ -769,9 +769,24 @@ func NormalizeDaemonReason(reason, rawError string) Reason {if isAgentSideReason(reason) && hasAnyPrefix(lowerError, legacyEnvironmentPrepareWitnesses...) {return ReasonEnvironmentPrepareFailed}+ // MUL-9665: a daemon predating ReasonLocalDirectoryMissing reports a+ // deleted or moved project folder as the generic local_directory_error,+ // which tells the user nothing about what to fix.+ if reason == legacyLocalDirectoryReason && strings.HasPrefix(lowerError, legacyLocalDirectoryMissingPrefix) {+ return ReasonLocalDirectoryMissing+ }return Reason(reason)}+// legacyLocalDirectoryReason is the daemon's catchall for local_directory+// failures. It sits outside the canonical taxonomy, so it has no constant.+const legacyLocalDirectoryReason = "local_directory_error"++// legacyLocalDirectoryMissingPrefix opens the error an older daemon's+// validateLocalPath returns when the linked directory is gone. Compared+// lowercased, like every witness here.+const legacyLocalDirectoryMissingPrefix = "local_directory: path does not exist:"+// containsAll reports whether s contains every one of the supplied substrings.// Used where a single phrase would be ambiguous and only the combination// identifies the failure. Caller pre-lowercases s, same contract asdiff --git a/server/pkg/taskfailure/failure.go b/server/pkg/taskfailure/failure.goindex 09399eae46..2edaca253f 100644--- a/server/pkg/taskfailure/failure.go+++ b/server/pkg/taskfailure/failure.go@@ -27,7 +27,8 @@// runtime_recovery, timeout, iteration_limit, agent_blocked,// api_invalid_request, skill_bundle_unavailable,// runtime_cli_timeout, environment_prepare_failed,-// invalid_task_identity, runtime_access_denied+// local_directory_missing, invalid_task_identity,+// runtime_access_denied//// - 14 agent-side values (with `agent_error.` prefix) produced by// Classify(rawError) when the agent process surfaced an error string.@@ -179,6 +180,23 @@ const (// session was touched.ReasonEnvironmentPrepareFailed Reason = "environment_prepare_failed"+ // ReasonLocalDirectoryMissing: the project links a local_directory to+ // the daemon that claimed the task, and that directory no longer exists+ // on the machine — the user deleted or moved it after linking it. The+ // agent process is never launched.+ //+ // Split out of the daemon's generic local_directory_error because it is+ // the one local-directory failure whose fix the user can name from the+ // label alone: restore the folder, or link a new one (or remove the stale+ // one) in the project's resources. "Local directory error" hid that, and+ // retrying reproduces it identically.+ //+ // Deliberately NOT retryable: nothing changes until the user acts.+ // Resume-safe, because no session was touched. Written by+ // acquireLocalDirectoryLockIfNeeded in daemon/daemon.go; older daemons'+ // reports are upgraded by NormalizeDaemonReason.+ ReasonLocalDirectoryMissing Reason = "local_directory_missing"+// ReasonInvalidTaskIdentity: the daemon refused a claimed task because// the task row's authoritative agent_id was absent or disagreed with the// nested agent payload. The agent process is never launched. This is@@ -277,7 +295,7 @@ const (ReasonAgentUnknown Reason = "agent_error.unknown")-// allReasons is the canonical ordered list of the 27 reasons. Order is+// allReasons is the canonical ordered list of reasons. Order is// stable so callers (e.g. Prometheus collectors that pre-warm series via// AllReasons) can build deterministic label sets across restarts.//@@ -302,6 +320,7 @@ var allReasons = []Reason{ReasonSkillBundleUnavailable,ReasonRuntimeCLITimeout,ReasonEnvironmentPrepareFailed,+ ReasonLocalDirectoryMissing,ReasonInvalidTaskIdentity,ReasonRuntimeAccessDenied,diff --git a/server/pkg/taskfailure/local_directory_test.go b/server/pkg/taskfailure/local_directory_test.gonew file mode 100644index 0000000000..82a83f492c--- /dev/null+++ b/server/pkg/taskfailure/local_directory_test.go@@ -0,0 +1,33 @@+package taskfailure++import "testing"++// TestNormalizeDaemonReasonUpgradesLocalDirectoryMissing covers MUL-9665's+// mixed-version window. A daemon predating ReasonLocalDirectoryMissing reports+// a deleted project folder as the generic local_directory_error; the error+// text it has always written identifies the case, so the label is upgraded+// the moment the server deploys.+func TestNormalizeDaemonReasonUpgradesLocalDirectoryMissing(t *testing.T) {+ t.Parallel()++ missing := `local_directory: path does not exist: "/Users/u/code/game"`+ if got := NormalizeDaemonReason("local_directory_error", missing); got != ReasonLocalDirectoryMissing {+ t.Errorf("NormalizeDaemonReason(local_directory_error, missing path) = %q, want %q", got, ReasonLocalDirectoryMissing)+ }+ if got := NormalizeDaemonReason(ReasonLocalDirectoryMissing.String(), missing); got != ReasonLocalDirectoryMissing {+ t.Errorf("NormalizeDaemonReason(local_directory_missing) = %q, want it preserved", got)+ }++ // Every other local_directory failure has a different fix and keeps the+ // generic reason.+ for _, rawError := range []string{+ `local_directory: path is not a directory: "/Users/u/code/game"`,+ `local_directory: stat "/Users/u/code/game": permission denied`,+ `local_directory: path is the user's home directory ("/Users/u")`,+ "local_directory wait cancelled: context canceled",+ } {+ if got := NormalizeDaemonReason("local_directory_error", rawError); got != "local_directory_error" {+ t.Errorf("NormalizeDaemonReason(local_directory_error, %q) = %q, want it preserved", rawError, got)+ }+ }+}