fix: 消除会话列表解析阻塞并按需加载工具详情

This commit is contained in:
shiyue
2026-10-19 10:58:22 +08:00
parent fb2c3360c9
commit 99cc807f4b
35 changed files with 1468 additions and 214 deletions

View File

@@ -11,7 +11,7 @@
"creator": "shiyue",
"assignee": "shiyue",
"createdAt": "2026-10-14",
"completedAt": "2026-10-15",
"completedAt": "2026-10-19",
"branch": null,
"base_branch": "main",
"worktree_path": null,

View File

@@ -1,46 +1,76 @@
{
"browser": "Firefox 157.0.1",
"browserEvidence": "/tmp/cc-web-session-http-FcFyDq/browser-evidence.json",
"apiEvidence": "/tmp/cc-web-session-http-VTWGN4",
"verified": [
"WebSocket 假 OPEN 下首屏和完整运行输出",
"HTTP 读取途中断开 WebSocket 仍完成",
"拒绝 WebSocket 重连后仍可切换",
"HTTP 分页58条顺序正确且无重复",
"A 迟到响应不会覆盖 B",
"读取与订阅之间完成的任务通过修订对账补齐",
"损坏历史500立即结束加载并保留当前视图",
"浏览器不发送 WebSocket 历史读取请求",
"同会话代次、分页取消、完成交错、错误响应和渲染异常",
"HTTP 鉴权、非法ID/游标、损坏块/清单、修订变化与运行快照"
"checkedAt": "2026-10-19T02:57:49.386Z",
"status": "verified",
"rootCause": "WebSocket会话列表的尾部重复JSON解析阻塞服务主线程,HTTP进入处理函数前排队约79秒",
"fixes": [
"归档列表只读元数据、按修订缓存,不读取正文或重建快照",
"旧快照尾部反向单次扫描顶层字段",
"首屏和运行快照只传普通工具概要,展开后HTTP读取完整详情",
"折叠工具延迟构建详情DOM与切换取消"
],
"otherPassed": [
"activation": {
"status": "online",
"pid": 2886941,
"startedAt": "2026-10-19T02:41:10.051Z",
"servedFrontendMatchesSource": true
},
"productionBrowser": {
"browser": "158.0",
"evidence": "/tmp/ccweb-switch-live-AdoSFT/evidence.json",
"stages": [
{
"id": "0b768f2e-acc2-4faa-8cce-841531cf3643",
"durationMs": 352,
"count": 12,
"tools": 122,
"streaming": false,
"errors": []
},
{
"id": "ccc82825-4d91-4db7-96fe-315a2c30061f",
"durationMs": 430,
"count": 8,
"tools": 311,
"streaming": false,
"errors": []
},
{
"id": "e28cff1a-100e-4225-a33e-d7745017ab79",
"durationMs": 184,
"count": 12,
"tools": 227,
"streaming": true,
"errors": []
}
],
"toolDetailComplete": true
},
"productionConcurrentListStress": {
"evidence": "/tmp/ccweb-switch-live-3DL94a/evidence.json",
"switches": 9,
"minMs": 120,
"maxMs": 462,
"allDisplayedWithoutErrors": true,
"toolDetailComplete": true,
"readOnly": true
},
"passed": [
"session-metadata-unit",
"session-preview-metadata: 密集工具伪字段列表与HTTP并发",
"session-http-load: 首屏/分页/错误/运行恢复/工具详情",
"Firefox:32KB/s大工具首屏、折叠懒建、完整详情、断WS切换、迟到隔离、完成交错(/tmp/cc-web-session-http-xd0sGW)",
"session-switch-race",
"title-history-outline",
"frontend-asset-version",
"history-frontend-unit",
"history-runtime-unit",
"session-history-unit: 12项",
"history-runtime-completion-unit: 15项",
"JavaScript语法和git diff --check"
"history-runtime-completion-unit:15项",
"ccweb-display-image-unit",
"孤立归档列表不重建快照(完整历史套件第10项)",
"JS语法、git diff --check",
"Bun baseline打包与MCP初始化"
],
"incompleteAt60Seconds": [
"history-recall 大套件",
"session-history-store-unit 全套:前24项已显示通过"
"session-history-store-unit完整套件(60秒已输出24项通过)"
],
"activation": "verified",
"activationEvidence": {
"checkedAt": "2026-10-15T00:17:13.907+08:00",
"status": "online",
"pid": 2353800,
"restarts": 86,
"port": 8002,
"version": "953d5e1a0bbdcf56",
"httpStatus": 401,
"httpErrorCode": "not_authenticated",
"requestIdEchoed": true,
"servedFrontendMatchesSource": true,
"hasHttpQuery": true,
"hasRealtimeSubscription": true
"release": {
"path": "dist-exe/cc-web-bun-linux-x64-baseline.tar.gz",
"sha256": "ef5801d70fd04737c7c149335967a59b36f2039ab89b1e1bc5612ef997a15d6f"
}
}

View File

@@ -0,0 +1,2 @@
{"file":".trellis/spec/frontend/quality-guidelines.md","reason":"前端验证要求"}
{"file":".trellis/tasks/10-17-display-image-render-failure/prd.md","reason":"检查真实故障与业务边界"}

View File

@@ -0,0 +1,4 @@
{"file":".trellis/spec/frontend/index.md","reason":"前端开发规范"}
{"file":".trellis/spec/frontend/quality-guidelines.md","reason":"前端验证要求"}
{"file":".trellis/spec/frontend/component-guidelines.md","reason":"DOM 组件风格"}
{"file":".trellis/tasks/10-17-display-image-render-failure/prd.md","reason":"真实故障形状与修复边界"}

View File

@@ -0,0 +1,20 @@
# 修复 ccweb_display_image 图片展示失败
## 需求
用户截图中会话 0bb322b1-e9f8-47e7-9af1-970411bfec5a 连续八张图片均显示“图片渲染失败”。定位并修复现有显示链路,使已保存图片在刷新后正常显示,并给后续调用提供相同行为。
## 已确认原因
真实存档 tool.result 是 MCP CallToolResult 的 JSON:`{content:[{type:'text',text:'业务 JSON'}],structuredContent:{ok:true,image,attachment},_meta:null}`。当前前端只解析一层 JSON 后直接检查 payload.ok,因此把成功的 MCP 包装结果识别为失败。服务端业务结果确实 ready。
## 实现边界
- 在前端正确解析直接业务结果与 MCP structuredContent / content 文本形式。
- 保留明确的业务错误消息、等待状态和异常格式兜底。
- 使用实际历史结果形状补充行为回归,包括已有图片附件和直链图片。
- 不修改用户历史数据,不改协议,不重新生成图片。
- 保留工作区中已经存在的文件浏览器图片画廊改动;改动前核对 git diff。
## 验收
- 截图中八个已有成功结果可以解析得到正确 attachment。
- 渲染组件进入图片预览分支,不再显示误报失败。
- 错误响应与不合法结果不被误报成功。
- 必要测试通过;运行服务能提供新静态文件,若需要重启必须先查其他运行对话。

View File

@@ -0,0 +1,26 @@
{
"id": "display-image-render-failure",
"name": "display-image-render-failure",
"title": "修复图片展示失败",
"description": "",
"status": "completed",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "shiyue",
"assignee": "shiyue",
"createdAt": "2026-10-17",
"completedAt": "2026-10-17",
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}

View File

@@ -0,0 +1 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}

View File

@@ -0,0 +1,4 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
{"file": ".trellis/spec/frontend/index.md", "reason": "前端入口规范"}
{"file": ".trellis/spec/frontend/quality-guidelines.md", "reason": "保留既有前端加载行为"}
{"file": ".planning/file-browser-image-gallery/findings.md", "reason": "现有图片弹层与加载入口"}

View File

@@ -0,0 +1,25 @@
# 文件预览全屏与目录切图
## 用户需求
当前图片预览被容器缩放,需要点击放大全屏,并能左右切换当前文件夹图片;优先复用 cc-web 现成组件。
## 验收条件
- 点击文件预览中已加载的图片打开已有附件图片弹层的全屏模式,图片适应整个可用视口,保留加载、失败、关闭操作。
- 查看器提供前后按钮和左右方向键,在当前文件夹中按文件列表顺序切换支持的图片;跳过目录和文本。
- 显示文件名、当前位置;单图与首尾行为清晰。
- 移动端按钮可用,关闭全屏返回原文件浏览器,不误触关闭文件浏览器。
- 图片按需鉴权加载,SVG 延续现有安全路径;切换时处理加载、失败、过期请求和 Blob URL 释放。
- 文件夹变化或文件浏览器关闭时正确清理查看器状态。
- 原有消息图片查看体验保持可用。
## 已定位的复用入口
- public/app.js:openAttachmentPreviewModal / closeAttachmentPreviewModal;现有组件目前是居中大图弹层,没有缩放平移功能。
- public/app.js:openFileBrowserFile / renderFileBrowserDirectory / loadFileBrowserDirectory / showFileBrowser。
- 文件图片继续通过 fetchAuthImage 读取 /api/fs/image,SVG 用 data URL,其余用 Blob URL。
## 约束
复用现有组件,不新增图库依赖;不做额外代码审计;本轮不打包、不提交、不推送、不重启。
## 验证结果
- file-browser-image、file-preview-encoding、frontend-asset-version 专项回归通过。
- Chromium 149 桌面和手机视口 20 项交互验证通过,页面无未捕获异常。

View File

@@ -0,0 +1,26 @@
{
"id": "file-browser-image-gallery",
"name": "file-browser-image-gallery",
"title": "文件预览复用全屏图片查看器并支持目录切图",
"description": "",
"status": "completed",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "shiyue",
"assignee": "shiyue",
"createdAt": "2026-10-17",
"completedAt": "2026-10-17",
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "已复用附件图片弹层实现全视口图库;三项专项回归和 Chromium 桌面/手机 20 项交互验证通过;按用户要求跳过额外审计;未打包、提交、推送或重启。",
"meta": {}
}