mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-19 09:52:01 +00:00
第三波前两批:六个「看着成功其实没干活」的平台漏洞堵上,记录页能回放,管理页与画布收尾
起因是一次探索运行: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:
@@ -11,7 +11,8 @@ import type { RunEvent } from '../types'
|
||||
import fixtures from '../run/__tests__/fixtures.json'
|
||||
import mdSamples from '../run/__tests__/markdown-samples.json'
|
||||
import {
|
||||
COPILOT_STUCK, MIXED_OUTPUT, cancelledRun, longLoop, mixedRun, pipelineRun, teamRun,
|
||||
COPILOT_STUCK, COPILOT_TOOLS_DROPPED, MIXED_OUTPUT, abandonedRun, cancelledRun, exhaustedTeam, longLoop,
|
||||
markupRun, mixedRun, pipelineRun, repairRun, teamRun, timeoutRun,
|
||||
} from '../run/__tests__/synthetic'
|
||||
import '../index.css'
|
||||
|
||||
@@ -285,6 +286,53 @@ function synthetic(name: string): StreamTurn[] {
|
||||
return [{ id: 'schema', question: '看看有哪些人事表', phase: 'done', status: '已完成',
|
||||
steps: decodeRun(ev, { status: 'succeeded' }) }]
|
||||
}
|
||||
// ---- 平台问题的几种结局(NI-3/4/5):失败的轮次把 run.failed 的原话交给流,和运行页、画布右栏一样
|
||||
case 'exhausted':
|
||||
case 'markup':
|
||||
case 'repair': {
|
||||
const ev = name === 'exhausted' ? exhaustedTeam('fail') : name === 'markup' ? markupRun() : repairRun()
|
||||
const end = ev[ev.length - 1].data
|
||||
return [{ id: name, question: '上月各区域订单额', phase: 'error', steps: decodeRun(ev), runId: `syn-${name}`,
|
||||
error: { error: String(end.error), ...(end.detail ? { detail: end.detail } : {}) } }]
|
||||
}
|
||||
case 'exhausted-degrade': {
|
||||
const ev = exhaustedTeam('degrade')
|
||||
return [{ id: 'exhausted-degrade', question: '上月各区域订单额', phase: 'done', steps: decodeRun(ev),
|
||||
output: { 结论: ev[ev.length - 1].data.output.结论, _issuance: {
|
||||
tier: 'degraded', calibers: [], metrics_checked: 0, matched_numbers: 0, unmatched_numbers: [],
|
||||
missing_required: [], missing_expected: [],
|
||||
gaps: ['协作团队「销售分析团队」用完 2 轮仍未完成,交来的是成员最后的原话'] } },
|
||||
runId: 'syn-exhausted-degrade', runClass: 'exploratory' }]
|
||||
}
|
||||
case 'exhausted-closing': {
|
||||
const ev = rebase(exhaustedTeam('closing'))
|
||||
return [{ id: 'exhausted-closing', question: '上月各区域订单额', phase: 'running', steps: decodeRun(ev),
|
||||
runId: 'syn-exhausted-closing' }]
|
||||
}
|
||||
case 'timeout-live': {
|
||||
// 查询已经走了 34 秒,时限是 30 秒:秒表要说破「已超出上限」
|
||||
const ev = rebase(timeoutRun('live'), 34000)
|
||||
return [{ id: 'timeout-live', question: '把订单明细全拉出来', phase: 'running', steps: decodeRun(ev),
|
||||
runId: 'syn-timeout-live' }]
|
||||
}
|
||||
case 'timeout':
|
||||
return [{ id: 'timeout', question: '把订单明细全拉出来', phase: 'error', steps: decodeRun(timeoutRun('done')),
|
||||
runId: 'syn-timeout', error: { error: '查询超过 30s 没有返回,已放弃等待(数据库那边可能还在跑,连接会在后台收回)。加上 WHERE 条件或 LIMIT 缩小范围再查' } }]
|
||||
case 'abandoned':
|
||||
return [{ id: 'abandoned', question: '把这份报表发出去', phase: 'done', statusCode: 'cancelled',
|
||||
steps: decodeRun(abandonedRun()), runId: 'syn-abandoned' }]
|
||||
case 'structured':
|
||||
// 页面已经把报错拆好了(问数据页的 Failure):照原样画,不再翻译一遍
|
||||
return [{ id: 'structured', question: '上周各区域订单数', phase: 'error', steps: [],
|
||||
error: { title: '操作超时', reason: '查询超时:数据库 90 秒没有返回', hint: '缩小时间范围后点「重试这一轮」',
|
||||
detail: 'OperationalError: (3024) maximum statement execution time exceeded' } }]
|
||||
case 'restored':
|
||||
// 从库里恢复的一轮:没有事件,查询次数由页面从落库的 meta 带过来
|
||||
return [{ id: 'restored', question: '上周各区域订单数', phase: 'done', steps: [], queries: 3, elapsedMs: 8400,
|
||||
output: { answer: '华东 1,204 单,华南 986 单,华北 731 单。' }, runId: 'syn-restored' }]
|
||||
case 'tools-dropped':
|
||||
return [{ id: 'tools-dropped', question: '只查上月的数据', phase: 'done', status: '已更新画布(修改 1)',
|
||||
tone: 'warn', steps: decodeCopilot(COPILOT_TOOLS_DROPPED, { context: 'canvas' }) }]
|
||||
default:
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ import { useEffect, useState } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { Inbox, Plus, Trash2, RefreshCw } from 'lucide-react'
|
||||
import { Database, Inbox, Plus, Trash2, RefreshCw } from 'lucide-react'
|
||||
import {
|
||||
EmptyState, ErrorState, Field, IconButton, Kbd, Modal, OfflineBanner, Skeleton, StatusBadge,
|
||||
StatusPill, Tabs, TabPanel, ToastHost, confirmDialog, promptDialog, toast,
|
||||
DeleteButton, EmptyState, ErrorState, Field, HealthPill, IconButton, Kbd, Modal, OfflineBanner, PageHeader,
|
||||
SectionBar, Skeleton, StatusBadge, StatusPill, Tabs, TabPanel, ToastHost, confirmDialog, deferDelete,
|
||||
promptDialog, toast, useRadioGroup, withoutDeferred,
|
||||
} from '../components/ui'
|
||||
import { ApiError, api } from '../api/client'
|
||||
import { useCatalog, useOnReconnect } from '../store/catalog'
|
||||
@@ -16,6 +17,8 @@ import * as status from '../lib/status'
|
||||
import * as keys from '../lib/keys'
|
||||
import * as terms from '../lib/terms'
|
||||
import * as errors from '../lib/errors'
|
||||
import * as explain from '../lib/explain'
|
||||
import * as health from '../lib/health'
|
||||
import '../index.css'
|
||||
|
||||
/**
|
||||
@@ -101,6 +104,63 @@ function LocalListDemo() {
|
||||
)
|
||||
}
|
||||
|
||||
const DEMO_ROWS = [
|
||||
{ id: 'orders', name: 'orders' }, { id: 'sales_daily', name: 'sales_daily' }, { id: 'hr_attendance', name: 'hr_attendance' },
|
||||
]
|
||||
const RADIO = ['service_name', 'sid', 'dsn'] as const
|
||||
|
||||
/** 管理页共用件:页头、分节、连通胶囊、单选组、删除后可撤销 */
|
||||
function ManageKitDemo() {
|
||||
const [rows, setRows] = useState(DEMO_ROWS)
|
||||
const [mode, setMode] = useState<(typeof RADIO)[number]>('service_name')
|
||||
const radio = useRadioGroup(RADIO, mode, setMode)
|
||||
const [now] = useState(() => Date.now())
|
||||
const reload = () => setRows(withoutDeferred(DEMO_ROWS, '/api/__harness__/rows'))
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="overflow-hidden rounded-lg border" id="page-header-demo">
|
||||
<PageHeader icon={<Database size={13} />} title="数据" subtitle="接入的数据库和传上来的表格" actions={<button className="btn btn-sm">刷新</button>} />
|
||||
</div>
|
||||
<SectionBar title="数据库" hint="接入后助手编排时看得见这些库的结构">
|
||||
<button className="btn btn-sm btn-primary"><Plus size={12} /> 接入数据库</button>
|
||||
</SectionBar>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2" id="health-demo">
|
||||
<HealthPill />
|
||||
<HealthPill checkingSince={now - 1200} />
|
||||
<HealthPill record={{ ok: true, ms: 42, at: now - 3 * 60_000 }} />
|
||||
<HealthPill record={{ ok: false, at: now - 60 * 60_000, error: '连不上:端口没开' }} />
|
||||
<HealthPill record={{ ok: true, ms: 380, at: 0 }} stale />
|
||||
<HealthPill record={{ ok: false, at: 0, error: '连不上:认证没通过' }} />
|
||||
</div>
|
||||
<div role="radiogroup" aria-label="连接方式" className="flex gap-1" id="radio-demo">
|
||||
{RADIO.map((v) => (
|
||||
<button key={v} type="button" className={v === mode ? 'btn btn-sm btn-primary' : 'btn btn-sm'} {...radio(v)} onClick={() => setMode(v)}>
|
||||
{v}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<ul className="flex flex-col gap-1 text-xs" id="defer-demo">
|
||||
{rows.map((r) => (
|
||||
<li key={r.id} className="flex items-center gap-2" data-row={r.id}>
|
||||
<span className="mono flex-1">{r.name}</span>
|
||||
<DeleteButton
|
||||
label={`删除 ${r.name}`}
|
||||
onClick={() => deferDelete({
|
||||
what: `「${r.name}」`,
|
||||
url: `/api/__harness__/rows/${r.id}`,
|
||||
hide: () => setRows((l) => l.filter((x) => x.id !== r.id)),
|
||||
restore: reload,
|
||||
commit: () => Promise.resolve(),
|
||||
})}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<button className="btn btn-sm self-start" id="defer-reload" onClick={reload}>重拉列表</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function Harness() {
|
||||
const [theme, setTheme] = useState<'dark' | 'light'>(() => {
|
||||
// 没有显式主题时会跟随系统;预览要确定是哪一套,开场就钉住
|
||||
@@ -261,6 +321,14 @@ function Harness() {
|
||||
action={<button className="btn btn-sm btn-primary"><Plus size={12} /> 新建工作流</button>}
|
||||
/>
|
||||
<EmptyState title="没有匹配的工具" offline={false} className="py-4" />
|
||||
<div id="empty-source-demo" className="border-t">
|
||||
<EmptyState
|
||||
source="workflows"
|
||||
title="还没有工作流"
|
||||
className="py-4"
|
||||
action={<button className="btn btn-sm btn-primary" id="empty-source-action"><Plus size={12} /> 新建</button>}
|
||||
/>
|
||||
</div>
|
||||
</Block>
|
||||
<Block title="出错 ErrorState">
|
||||
<ErrorState
|
||||
@@ -313,6 +381,10 @@ function Harness() {
|
||||
</Block>
|
||||
</div>
|
||||
|
||||
<Block title="管理页共用件">
|
||||
<ManageKitDemo />
|
||||
</Block>
|
||||
|
||||
<Block title="标签页 Tabs · 表单字段 Field">
|
||||
<Tabs
|
||||
label="示例标签"
|
||||
@@ -339,7 +411,7 @@ function Harness() {
|
||||
;(window as any).__ui = {
|
||||
toast, confirmDialog, promptDialog, useCatalog, ApiError, api,
|
||||
// 检查脚本直接拿应用同一份模块实例测 lib:instanceof ApiError 才靠得住
|
||||
lib: { format, status, keys, terms, errors },
|
||||
lib: { format, status, keys, terms, errors, explain, health },
|
||||
}
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
|
||||
Reference in New Issue
Block a user