第三波前两批:六个「看着成功其实没干活」的平台漏洞堵上,记录页能回放,管理页与画布收尾

起因是一次探索运行:Copilot 改节点时把工具绑定整份抹掉,agent 没有工具只能写「假设调用」,
校验节点的自动修复编出 total_count=0 让 schema 通过,协作成员把工具调用标记当文字输出了四轮,
轮数用完后节点把原话当成功结果交出去——运行标成已完成,数据库一次都没查。

平台可信度(先写失败测试)
- Copilot 修改节点改为合并:没写的字段保留,null 才删除;协作成员按名字合并。前后端同一套规则,
  工具集合变小时自查报警、改图回执列出变化
- 新校验规则:提示词点名了某个工具而节点没有绑定它,判错误,Copilot 自查会交回去修
- 校验修复只许改格式:冒出原文没有的值就判修复无效;修复这次模型调用计入用量
- 识别模型把工具调用写成文字的情况(DSML、<tool_call> 等标记):纠正一次,仍然如此就判失败并说明原因
- 协作团队用完轮数不再按成功交付:默认失败,可选降档,点出一次都没派到的成员
- 审批恢复后,同一节点里已经执行过的工具调用复用结果,不再重复执行

后端
- 查询时限交给数据库执行(Oracle call_timeout、PG statement_timeout、MySQL max_execution_time、
  SQLite progress handler),可按数据源配置;超时报错与实际耗时一致
- 等审批的运行可以真正取消;会话列表带最后一轮状态;测连接结果持久化;探查结构可只看不存;
  自定义工具可草稿试跑、写坏的参数定义保存时拒绝;MCP 服务改动后作废旧工具缓存;
  检索命中带贡献分解;重建索引在后台跑并报进度;报错统一收进 core/errors

前端
- 公共层:管理页共用件、失败说明(lib/explain)、健康状态进公共库;目录按表各自加载并有超时,
  一张表卡住不再拖垮整站;上传显示真实字节进度;离线横幅只播报不变的句子
- 画布:卡片只说游标所在的那一次执行;等审批时可放弃运行;团队收尾判定与未完成说清楚;
  回放用量取那一刻的值
- 编排页:Copilot 合并语义与工具变化回执;「用完轮数时」选项;正式运行期间锁住所有改图入口
- 回答流 / 问数据:新失败类型说人话并给下一步;画布与右栏互相定位;数据源范围、回收站、重新核对
- 记录页:「航迹」页签复用画布时间轴,可拖动回放、列出关键时刻;列表行带执行 / 等人 / 失败缩略条
- 外壳:统一的离开前确认(data router),导航、⌘K、快捷键、后退都会先问

验证(沙箱):tsc 干净,pytest 838 passed(两遍),14 个检查脚本中 13 个全绿;
check-ui 余 1 项旧断言(按旧日期格式找运行行),3c 更新。
This commit is contained in:
ThearchyHelios
2026-09-27 10:16:32 +08:00
parent e10c4f23fc
commit 587bf7e27c
134 changed files with 20140 additions and 2709 deletions
+23 -6
View File
@@ -1,11 +1,11 @@
import { useEffect, useRef } from 'react'
import { AlertTriangle, CheckCircle2, CornerDownRight, RotateCw, Trash2, Unlink, Workflow, XCircle } from 'lucide-react'
import { AlertTriangle, CheckCircle2, CornerDownRight, Plus, RotateCw, Trash2, Unlink, Workflow, XCircle } from 'lucide-react'
import clsx from 'clsx'
import { NODE_DEFS } from './nodeDefs'
import type { FieldRef, Problem } from './issues'
import { unboundToolOf, withToolBound, type FieldRef, type Problem } from './issues'
import { formatShortcut } from '../lib/keys'
import { useCatalog } from '../store/catalog'
import { useStudio } from '../store/studio'
import { useEditLock, useStudio } from '../store/studio'
import { Spinner } from '../components/ui'
/**
@@ -129,10 +129,15 @@ function ProblemRow({ problem: p, active, onLocate, onDeleteEdge }: {
problem: Problem; active: boolean; onLocate: () => void; onDeleteEdge: (id: string) => void
}) {
const node = useStudio((s) => (p.nodeId ? s.nodes.find((n) => n.id === p.nodeId) : undefined))
const updateNode = useStudio((s) => s.updateNode)
const locked = useEditLock() != null
const err = p.level === 'error'
const Icon = err ? XCircle : AlertTriangle
const where = fieldLabel(p.field, node?.data.nodeType)
const where = fieldLabel(p.field, node?.data.nodeType, node?.data.config)
const locatable = p.scope === 'node' && !!node
// 提示词点了名的工具没绑:就地绑上,和检查器里那个按钮是同一个修法
const tool = unboundToolOf(p.message)
const bound = node && tool ? withToolBound(node.data.config ?? {}, p.field, tool) : null
return (
<div role="listitem" data-problem={p.id}
className={clsx('group flex items-start gap-2 pl-6 pr-2', active && 'bg-hover')}>
@@ -153,6 +158,13 @@ function ProblemRow({ problem: p, active, onLocate, onDeleteEdge }: {
</span>
)}
</button>
{bound && tool && (
<button type="button" className="btn btn-xs my-0.5 shrink-0" disabled={locked}
title={`把 ${tool} 加进${where || '这个节点的工具'}`}
onClick={() => updateNode(node!.id, { config: bound })}>
<Plus size={10} aria-hidden /> 绑定 {tool}
</button>
)}
{/* 悬空边(指向不存在的节点):React Flow 不画它,画布上看不见、点不到,只能在这儿删 */}
{p.scope === 'edge' && p.edgeId && (
<button type="button" className="btn btn-xs my-0.5 shrink-0" onClick={() => onDeleteEdge(p.edgeId!)}>
@@ -163,13 +175,18 @@ function ProblemRow({ problem: p, active, onLocate, onDeleteEdge }: {
)
}
function fieldLabel(field: FieldRef | null | undefined, type?: string): string {
const SUB_LABEL: Record<string, string> = { condition: '的条件', key: '的标识', tools: '的工具', system: '的角色设定' }
function fieldLabel(field: FieldRef | null | undefined, type?: string, config?: Record<string, any>): string {
if (!field) return ''
if (field.key === 'label') return '节点名称'
const def = type ? NODE_DEFS[type as keyof typeof NODE_DEFS] : undefined
const base = def?.fields.find((f) => f.key === field.key)?.label ?? field.key
if (field.index == null) return base
const sub = (field.sub && SUB_LABEL[field.sub]) || ''
// 成员有名字就叫名字:「第 2 个成员」还得数,「成员 writer」一眼就知道是谁
const name = field.key === 'agents' ? config?.agents?.[field.index]?.name : undefined
if (name) return `成员「${name}」${sub}`
const item = ({ cases: '分支', fields: '字段', metrics: '指标', agents: '成员' } as Record<string, string>)[field.key]
const sub = field.sub === 'condition' ? '的条件' : field.sub === 'key' ? '的标识' : ''
return item ? `第 ${field.index + 1} 个${item}${sub}` : `${base} · 第 ${field.index + 1} 项`
}