LoopForge icon indicating copy to clipboard operation
LoopForge copied to clipboard

[Feature]: 平台运维诊断页:数据库 schema/迁移状态、产物上限、Agent 浏览器镜像状态与预构建

Open linus-liu-web opened this issue 1 week ago • 2 comments

Problem

本月两次现场都卡在「运维信息只能进容器翻日志 / 连 MySQL 排查」上,页面本身没有任何「当前部署是否健康」的视图:

  1. 产物超过 64KB:一个 SOP clarify 节点产出 84,741 字节的 requirement.md,run_artifacts.content 是 TEXT,写库报 Error 1406 (22001): Data too long for column 'content',节点永久停在 running;页面没有任何错误提示,平台日志里只有一行 put run ...(见 #1092 下补充的复现)。
  2. Agent 浏览器 sidecar 镜像:首次使用时在请求内构建镜像,被 4 分钟 ensure 超时打断,界面误报「Chromium 不可用」;没有任何页面能看镜像是否存在/多大,也无法触发预构建(见 #1160,文档见 #1172)。
  3. 手工迁移不可见:migrations/ 由运维手工执行,但安装/升级后无法从页面判断哪些对象缺失(生成列、列宽、回填),缺了就直接在页面抛原始 MySQL 错误。这与 #201 描述的是同一类缝隙,#896 也提到运行时缺少统一的状态/设置入口。

现在定位这些问题必须同时会 docker exec + 连 MySQL 查 information_schema,普通 operator 做不到。

Proposed behavior

新增「平台管理 → 运维诊断」只读页(仅管理员可见),每项检查显示 状态(正常 / 警告 / 错误)+ 实测值 + 建议动作,并提供一个只读 API(如 GET /api/platform/diagnostics)供脚本和 CI 复用:

  • 数据库:连接状态、MySQL 版本;关键对象检查 —— run_telemetry.adapter / run_logs.level 生成列是否存在、run_artifacts.content 是否已是 MEDIUMTEXT、runs.input / runs.human_context 的列容量;缺失时列出应执行的 migrations/xxx.sql 文件名和命令。只提示,不自动执行,保持仓库「代码不做迁移、不做 seed」的约定。
  • 产物上限:引擎 maxArtifactBytes(1 MiB)与实际列容量的对比,超限风险提示。
  • Agent 浏览器 sidecar:镜像是否存在、镜像名与大小;提供「预构建」按钮(等价于 agentflow -browser-image)和 npm registry 提示。
  • 执行环境:Docker socket 可用性、AGENTFLOW_ISOLATED_IMAGE 是否存在。
  • 前端遵循现有管理页结构和中英 i18n;检查本身只读,不写库、不改状态。

Scope

Platform — runtime / deployment

Alternatives considered

  • 只在安装/升级时检查并打印(#201 的方向):能覆盖安装路径,但运行期 DB 被外部改动、镜像被清理、遗留库列宽不够等情况看不到;页面可以持续自检。
  • 继续靠日志和文档:每次现场都要 docker exec + MySQL,普通 operator 做不到。
  • 在启动路径自动执行 migrations/:与 AGENTS.md 的「代码不做迁移、不做 seed」冲突,不在本提案范围内。
  • 与 #896(运行时管理页)合并:两者互补——#896 关注 CLI 运行时的版本/安装,本提案关注部署与数据完整性;实现上可以共用「平台管理」下的同一入口。

Checks

  • [x] This proposal does not require organization-specific infrastructure or credentials.
  • [x] I searched existing issues and discussions for similar proposals.

linus-liu-web avatar Nov 21 '26 11:11 linus-liu-web

Implemented as #1186 (15 files, +675, mergeable): a read-only 平台管理 → 运维诊断 / Deployment diagnostics page backed by GET /api/platform/diagnostics (platform admins only). It reports:

  • database connectivity + MySQL version;
  • run_telemetry.adapter / run_logs.level generated columns, with scripts/install-schema-extensions.sh as the copyable remediation command;
  • run_artifacts.content capacity vs the engine's 1 MiB artifact limit (TEXT/TINYTEXT warns about the MEDIUMTEXT remedy);
  • Agent browser sidecar image presence with the agentflow -browser-image prebuild command;
  • Docker availability and the configured AGENTFLOW_ISOLATED_IMAGE.

It only reports and suggests commands; it never runs migrations, matching the repo policy. zh/en copy uses the existing lfT helper and the platform admin tab layout. Tests: go vet on the touched packages, admin/member API test, runtime/browser accessors, engine limit, and a node test for the panel markup — all pass locally; check-public.py passes.

linus-liu-web avatar Nov 21 '26 11:11 linus-liu-web

感谢提出这个需求。我的理解是:希望在「平台管理」下增加仅管理员可见的只读运维诊断页和对应只读接口,用来查看数据库关键结构与列容量、产物大小上限、Agent 浏览器镜像以及执行环境是否就绪,并给出建议动作,而不是自动执行迁移。

已经看到这条 Issue,也看到你在下面补充了与 #1186 相关的说明,会按现有 Issue 排期查看。

cocofhu00 avatar Nov 21 '26 12:11 cocofhu00