fix: clarify readonly api status labels

This commit is contained in:
Yoilun
2026-05-25 20:35:35 +08:00
parent 5cbf4f8b3d
commit 10f1beb3c8
5 changed files with 44 additions and 5 deletions

View File

@@ -22,6 +22,7 @@
| 2026-05-25 | 4 | spec review | 规格审查未通过:状态徽标和部分视图直接展示 `local_sample``low` 等内部英文值 | 已修复为中文来源和置信度展示 |
| 2026-05-25 | 4 | coding agent | 创建 Vue 3 + Vite 中文只读前端工作台,包含五个 tabs、静态示例数据、来源/置信度和空状态 | 完成;未接入真实 API未提供写回入口 |
| 2026-05-25 | 5 | coding agent | TDD 接入前端只读 API client、normalizer 和项目/工作流/智能体真实数据视图 | 完成;提交前已通过测试、构建和本地接口 smoke 验证 |
| 2026-05-25 | 5 | spec review | 规格审查未通过valid agent 状态不明确,工作流和 agent 只读文案仍含内部英文 | coding agent 按 blocking 范围修复 |
## Test Results
@@ -119,6 +120,11 @@
| 2026-05-25 | `pnpm build` | PASS | Phase 5 修复后前端构建通过 |
| 2026-05-25 | `git diff --check` | PASS | Phase 5 whitespace 检查通过 |
| 2026-05-25 | `go test ./...` | PASS | Phase 5 未改 Go 行为;全量 Go 回归通过 |
| 2026-05-25 | `pnpm test` | FAIL | TDD 红灯valid agent 仍显示“已读取”workflow 空交接文案尚未由 normalizer 提供 |
| 2026-05-25 | `pnpm test` | PASS | valid agent 显示“TOML 有效”,角色设定和交接边中文文案测试通过;共 7 个前端单测通过 |
| 2026-05-25 | `pnpm build` | PASS | Phase 5 规格修复后前端构建通过 |
| 2026-05-25 | `go test ./...` | PASS | Phase 5 规格修复未改 Go 行为;全量 Go 回归通过 |
| 2026-05-25 | `git diff --check` | PASS | Phase 5 规格修复 whitespace 检查通过 |
## Bug Loop
@@ -140,3 +146,4 @@
| 3 | `workflow.Store` 未配置 Runtime 会 panic | nil Runtime 返回空 view 和 `runtime_missing`/`low` 证据 | `go test ./internal/workflow` PASS |
| 4 | UI 直接展示 `local_sample``api_missing``low``medium` 等内部英文值 | `StatusBadge` 增加中文映射,并将示例数据来源/置信度改为中文展示值 | `pnpm build` PASS |
| 5 | workflow phases 会把 `task_plan.md` 里错误记录表的 `Time/Phase` 行显示到 UI | normalizer 过滤非阶段状态,并把数字阶段名转为“阶段 N” | `pnpm test` PASS |
| 5 | valid agent 状态只显示“已读取”,且工作流/智能体可见文案残留内部英文 | normalizer 改为“TOML 有效”/“TOML 无效”角色设定字段改中文WorkflowView 改“交接边”和“主智能体” | `pnpm test` PASS |

View File

@@ -35,3 +35,4 @@
| 2026-05-25 | 2 | 规格审查发现重复键 TOML 被报告为 valid且 agent symlink 可读取 Codex home 内非 agent TOML | TDD 补充 duplicate key、invalid key、symlink-to-config 测试后修复 parser 和 agent store 边界 | 已通过最终验证 |
| 2026-05-25 | 2 | 复审发现 `agents -> .` 目录 symlink 可把 root `config.toml` 当作 agent 读取 | TDD 补充 symlinked agents directory 测试后在 `Store.List` 拒绝 symlinked `agents` 目录 | 已通过最终验证 |
| 2026-05-25 | 4 | 规格审查发现 UI 直接展示 `local_sample``low` 等内部英文值 | 将状态徽标、示例数据和硬编码来源/置信度改为中文展示 | 待复审 |
| 2026-05-25 | 5 | 规格审查发现 valid agent 未明确显示 TOML 状态,且 UI 仍有 `handoffEdges``主 agent``developer_instructions` 可见文案 | TDD 补 valid agent 状态和 workflow 空交接文案测试后修复 normalizer 与 WorkflowView 文案 | 待复审 |

View File

@@ -137,9 +137,9 @@ export function normalizeAgent(agent = {}) {
fileName,
name,
description,
role: agent.developerInstructions || '没有 developer_instructions 字段',
role: agent.developerInstructions || '没有角色设定字段',
status: isInvalid ? 'unknown' : 'complete',
statusLabel: isInvalid ? 'TOML 无效' : '已读取',
statusLabel: isInvalid ? 'TOML 无效' : 'TOML 有效',
parseStatus,
parseStatusLabel: formatParseStatus(parseStatus),
parseError: agent.parseError || '',
@@ -245,6 +245,7 @@ export function normalizeWorkflow(payload = {}) {
isEmpty: events.length === 0 && phases.length === 0 && handoffs.length === 0,
emptyTitle: '没有工作流事件',
emptyText: source.message || '后端返回了空的工作流事件流;这里不会回退到伪装真实的示例关系。',
emptyHandoffsText: '后端没有返回交接边;当前保持空状态。',
}
}
@@ -259,7 +260,7 @@ function synthesizeAgentPreview(agent, { isInvalid, description }) {
`description = ${quote(agent.description || '')}`,
]
if (agent.developerInstructions) {
lines.push(`developer_instructions = ${quote(agent.developerInstructions)}`)
lines.push(`角色设定 = ${quote(agent.developerInstructions)}`)
}
for (const [key, value] of Object.entries(agent.extraFields || {})) {
lines.push(`${key} = ${quote(value)}`)

View File

@@ -39,6 +39,25 @@ test('normalizes invalid agent TOML as readonly error display', () => {
assert.match(agent.toml, /只读展示/)
})
test('normalizes valid agent TOML with visible parse status', () => {
const agent = normalizeAgent({
id: 'frontend',
filePath: '/Users/yoilun/.codex/agents/frontend.toml',
fileName: 'frontend.toml',
name: '前端开发者',
description: '构建界面',
developerInstructions: '实现 UI',
parseStatus: 'valid',
draftStatus: 'clean',
})
assert.equal(agent.statusLabel, 'TOML 有效')
assert.equal(agent.parseStatusLabel, '解析通过')
assert.equal(agent.role, '实现 UI')
assert.doesNotMatch(agent.toml, /developer_instructions/)
assert.match(agent.toml, /角色设定/)
})
test('normalizes empty runtime without falling back to fake real data', () => {
const runtime = normalizeRuntime({
items: [],
@@ -73,6 +92,17 @@ test('normalizes empty workflow with source evidence and no sample edges', () =>
assert.deepEqual(workflow.edges, [])
})
test('normalizes workflow empty handoff copy in Chinese', () => {
const workflow = normalizeWorkflow({
items: [{ kind: 'thread', label: '线程' }],
handoffEdges: [],
phases: [],
source: { kind: 'sqlite_readonly', confidence: 'high' },
})
assert.equal(workflow.emptyHandoffsText, '后端没有返回交接边;当前保持空状态。')
})
test('filters non-phase rows from workflow phase display', () => {
const workflow = normalizeWorkflow({
items: [],

View File

@@ -79,7 +79,7 @@ async function loadWorkflow() {
<div v-if="loading" class="load-state">加载中</div>
<div v-else-if="!error && workflowState.handoffs.length === 0" class="empty-state compact">
<strong>没有交接边</strong>
<p>后端没有返回 handoffEdges当前保持空状态</p>
<p>{{ workflowState.emptyHandoffsText }}</p>
</div>
<HandoffTimeline v-else :items="error ? sampleWorkflow.handoffs.map((item) => ({ ...item, from: `示例:${item.from}` })) : workflowState.handoffs" />
</div>
@@ -100,7 +100,7 @@ async function loadWorkflow() {
<aside class="panel supervision-panel">
<div class="panel-heading">
<p class="eyebrow">监管</p>
<h2> agent 监管状态</h2>
<h2>智能体监管状态</h2>
</div>
<StatusBadge
:label="error ? '连接失败' : (workflowState.isEmpty ? '空数据' : '已读取')"