Skip to content

Commit 2e14bde

Browse files
committed
feat(core): acceptance 自动核验 + 一轮自动返工(默认开)
写了 acceptance 的步骤产出后,用同一 provider 逐条核对验收标准——未过则把 「上一版产出 + 未满足条目」交回同一专家针对性返工一轮再复核。验收从"注入 prompt 的嘱咐"升级为"跑完真的有人对着查"的机制。 设计底线: - 验收不过是质量信号而非执行错误:步骤不会因此 failed,最坏得到带 ⚠️ 的 返工版照常流向下游 - 核验器自身故障(网络/解析失败)跳过核验不拦产线;返工生成失败保留第一版 - 核验/返工 token 如实累进该步成本(max_tokens 500 的小额调用) 三级开关:CLI --verify/--no-verify > YAML 顶层 verify: > 步骤级 verify: false (默认开,仅影响写了 acceptance 的步骤);库级直调 executeDAG 不传 = 不核验。 - 新增 src/core/verify.ts(核验器 + 返工块,复用 --compare 盲评解析套路) - executor 抽出 callLLM 局部函数,返工二次生成走同一套 retry/timeout 策略 - 核验状态进 CLI 结果行、summary.md 徽章、metadata.json、步骤文件头 - test/verify.ts 29 项单测;validate 校验 verify 必须为布尔
1 parent 207b937 commit 2e14bde

11 files changed

Lines changed: 515 additions & 59 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
## [Unreleased]
66

7+
### Added(本次新增)
8+
- **acceptance 自动核验 + 一轮自动返工(默认开)**:写了 `acceptance:` 的步骤产出后,用同一 provider 逐条核对验收标准——未过则把「上一版产出 + 未满足条目」交回同一专家针对性返工一轮再复核。验收从"注入 prompt 的嘱咐"升级为"跑完真的有人对着查"的机制。验收不过是质量信号而非执行错误:步骤不会因此失败,最坏得到带 ⚠️ 标记的返工版照常流向下游;核验器自身故障(网络/解析失败)自动跳过核验不拦产线。核验状态(通过/返工后通过/仍有 N 条未满足)进 CLI 结果行、summary.md、metadata.json 与步骤文件头。三级开关:CLI `--verify`/`--no-verify` > YAML 顶层 `verify:` > 步骤级 `verify: false`(默认开,仅影响写了 acceptance 的步骤);核验/返工消耗如实计入该步 token 成本。
9+
710
## [0.10.0] - 2026-07-12
811

912
### Added(本次新增)

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ steps:
105105
- id: step_id
106106
role: "category/role-name" # from agency-agents-zh
107107
task: "Task with {{variables}}"
108-
acceptance: "1. checkable condition…" # optional: injected at prompt tail, shown with output, judge anchor in --compare
108+
acceptance: "1. checkable condition…" # optional: injected at prompt tail; output auto-verified against it after the step runs (fail → one auto-rework round); judge anchor in --compare
109+
verify: false # optional: opt this step out of acceptance auto-verify (top-level `verify: false` disables whole workflow; CLI --verify/--no-verify overrides; default on)
109110
output: output_variable
110111
skill: "test-driven-development" # optional: inject a methodology playbook (see `ao skills`)
111112
depends_on: [other_step] # DAG dependency

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"eval:baseline": "npx tsx eval/run-eval.ts --save-baseline",
7171
"build:studio": "npm --prefix website install && npm --prefix website run build",
7272
"verify:release": "node scripts/verify-cli.mjs && node scripts/verify-frontend.mjs",
73-
"test": "npx tsx test/run.ts && npx tsx test/condition.ts && npx tsx test/cli.ts && npx tsx test/cli-base.ts && npx tsx test/parse-inputs.ts && npx tsx test/compose.ts && npx tsx test/demo.ts && npx tsx test/factory-custom.ts && npx tsx test/azure-compat.ts && npx tsx test/connector-continuation.ts && npx tsx test/connector-stall.ts && npx tsx test/compare-lib.ts && npx tsx test/install.ts && npx tsx test/materialize.ts && npx tsx test/paths.ts && npx tsx test/skills.ts && npx tsx test/acceptance.ts && npx tsx test/step-llm.ts && npx tsx test/step-llm-yaml.ts && npx tsx test/stdin-limit.ts && npx tsx test/compose-name.ts && npx tsx test/team.ts && npx tsx test/prompt.ts && npx tsx test/upgrade.ts && npx tsx test/resume.ts && npx tsx test/feedback.ts && npx tsx test/human-input.ts && npx tsx test/init.ts && npx tsx test/roles.ts && npx tsx test/eval-gate.ts && npx tsx test/validate-report.ts && npx tsx test/workflows.ts && npx tsx test/timeout.ts && npx tsx test/inputs.ts && npx tsx test/e2e.ts && npx tsx test/e2e-condition.ts && npx tsx test/e2e-loop.ts && npx tsx test/detect-providers.ts && npx tsx test/canvas-graph.ts && npx tsx test/creative-prompts.ts && npx tsx test/export-convert.ts && npx tsx test/web-server.ts && npx tsx test/custom-providers.ts && npx tsx test/mcp.ts",
73+
"test": "npx tsx test/run.ts && npx tsx test/condition.ts && npx tsx test/cli.ts && npx tsx test/cli-base.ts && npx tsx test/parse-inputs.ts && npx tsx test/compose.ts && npx tsx test/demo.ts && npx tsx test/factory-custom.ts && npx tsx test/azure-compat.ts && npx tsx test/connector-continuation.ts && npx tsx test/connector-stall.ts && npx tsx test/compare-lib.ts && npx tsx test/install.ts && npx tsx test/materialize.ts && npx tsx test/paths.ts && npx tsx test/skills.ts && npx tsx test/acceptance.ts && npx tsx test/verify.ts && npx tsx test/step-llm.ts && npx tsx test/step-llm-yaml.ts && npx tsx test/stdin-limit.ts && npx tsx test/compose-name.ts && npx tsx test/team.ts && npx tsx test/prompt.ts && npx tsx test/upgrade.ts && npx tsx test/resume.ts && npx tsx test/feedback.ts && npx tsx test/human-input.ts && npx tsx test/init.ts && npx tsx test/roles.ts && npx tsx test/eval-gate.ts && npx tsx test/validate-report.ts && npx tsx test/workflows.ts && npx tsx test/timeout.ts && npx tsx test/inputs.ts && npx tsx test/e2e.ts && npx tsx test/e2e-condition.ts && npx tsx test/e2e-loop.ts && npx tsx test/detect-providers.ts && npx tsx test/canvas-graph.ts && npx tsx test/creative-prompts.ts && npx tsx test/export-convert.ts && npx tsx test/web-server.ts && npx tsx test/custom-providers.ts && npx tsx test/mcp.ts",
7474
"prepublishOnly": "npm run build && npm run build:studio && npm run verify:release"
7575
},
7676
"files": [

src/cli.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ async function handleRun(): Promise<void> {
138138
console.error(' 或: ao run --team <名字> "你的任务" # 用已保存的团队跑新任务');
139139
console.error(' --materialize <目录> 把开发步产出的「### 路径 + 代码围栏」文件块落盘成真实项目脚手架');
140140
console.error(' --export <格式> 把本次产出导出:docx/pdf/xlsx(给人)或 skill/plan(给编码 agent 执行)');
141+
console.error(' --no-verify 关闭 acceptance 自动核验(默认:写了 acceptance 的步骤产出后自动核验,未过自动返工一轮)');
141142
console.error(' --compare 跑完后再跑单次基线 + 盲评,并排对比多智能体 vs 单次');
142143
console.error(' --judge-provider/--judge-model --compare 时指定评审模型(默认用生成模型)');
143144
process.exit(1);
@@ -224,6 +225,7 @@ async function handleRun(): Promise<void> {
224225
resumeDir: resumeDir ? resolve(resumeDir) : undefined,
225226
fromStep,
226227
feedback,
228+
verify: parseVerifyFlag(),
227229
llmOverride,
228230
signalFlush: true,
229231
});
@@ -519,6 +521,7 @@ async function handleCompose(): Promise<void> {
519521
const result = await run(resolve(savedPath), inputs, {
520522
quiet: false,
521523
signalFlush: true,
524+
verify: parseVerifyFlag(),
522525
// 用 compose 时同样的 provider 执行,避免 YAML 里写的 provider 和用户实际可用的不一致
523526
// CLI provider 单步调用可能很慢(1-20 分钟),给足超时;用户显式 --timeout 优先
524527
llmOverride: {
@@ -674,6 +677,13 @@ function parseTemperatureArg(): number | undefined {
674677
return temp;
675678
}
676679

680+
/** 解析 --verify/--no-verify 三态:true 强制开 / false 强制关 / undefined 按 YAML 顶层 verify(默认开)。 */
681+
function parseVerifyFlag(): boolean | undefined {
682+
if (args.includes('--no-verify')) return false;
683+
if (args.includes('--verify')) return true;
684+
return undefined;
685+
}
686+
677687
const COMPOSE_CLI_PROVIDERS = ['claude-code', 'gemini-cli', 'copilot-cli', 'codex-cli', 'openclaw-cli', 'hermes-cli'];
678688

679689
/** R2.1:判断 compose 要用的 provider 是否已有可用凭证。保守——不确定时返回 true(不拦已能跑的配置)。 */
@@ -804,6 +814,7 @@ async function runWithTeam(teamRef: string): Promise<void> {
804814
quiet: args.includes('--quiet') || args.includes('-q'),
805815
signalFlush: true,
806816
watch: args.includes('--watch'),
817+
verify: parseVerifyFlag(),
807818
outputDir: getArgValue('--output') || defaultOutputDir(),
808819
llmOverride: {
809820
provider,

0 commit comments

Comments
 (0)