AGC 项目状态一次抖动后被永久钉成「检查失败」,且不会自愈(首页最近项目同时变空) #490
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
现象
AGC「卡住」一次之后,项目列表的全部行显示「检查失败 + 待识别」,首页「最近项目」变成「暂无最近项目」。后端完全恢复也不会自愈,只有重启客户端才恢复。
根因
前端把一次性失败当成了终态,且没有任何重试入口:
useRecentProjects.ts:19每个最近项目的目录检查只有 5s 预算;失败在inspectRecentWorkspace里被catch吞成null。useRecentProjects.ts:83-97增量投影next[workspace] = current[workspace] ?? null原样保留上一次的null,失败结果跨刷新存活。model.ts:270-272directoryStatus === null→ 「检查失败」;projectKind落成unknown→ 「待识别」。useRecentProjects.ts:208-210首页只收canOpen为真的行,canOpen依赖Boolean(directoryStatus)→ 同一批null让首页变空态。[recentWorkspaces, recentWorkspaceRefreshKey](:115);refreshKey只有rememberRecentWorkspace会 +1,refreshRecentWorkspace只在重命名项目时调用。没有自动重试,也没有窗口 focus / visibility 重查。⇒ 一次 5s 量级的抖动,就能让整个会话的列表与首页保持错误状态,与后端真实状态彻底脱钩。
现场证据(2026-09-23 本机 dev 客户端)
11:19:41客户端启动;11:24:12两个平台接口 15s 超时(/api/runtime/frontend-config、/api/llm/models,错误池里source=api);11:24:26最后一条 Rust 日志project_snapshot.sync.completed … trigger=project-close(正好是关闭项目、回启动页那一刻),此后application.log静默 32 分钟。11:56在同一进程里逐条复跑inspect_local_project_directory(8 个最近项目):全部 OK、0ms,返回完整 status 对象;而界面仍是全「检查失败」。打算怎么改
focus/visibilitychange时,若存在失败或缺失项则重跑检查(复用ErrorReportNotice已有的监听模式)。验证
tests/recentProjectsHook.test.tsx,新增「一次失败后能自愈」「失败结果不跨刷新保留」用例。npm run agc:typecheck、npm run check:encoding、git diff --check。已提 PR:#492(分支
fix/agc-recent-project-status-retry)。改动口径(前后对照):
验证:
仍未定位:「卡住」本身的停顿层(远端网络 / Rust IPC 回传 / WebView 主线程)。本 PR 只保证一次抖动不再永久污染界面;采证探针(invoke 拦截 + IPC 心跳 + 界面状态计数 + 错误池捕获)继续用在本 issue 里。