《猫猫钓游记》可爱+收集+钓鱼游戏试玩
2026-06-30
2026-07-03 0
本项目的验收门控(Acceptance Gating)机制是一套多层次的质量保障系统,确保任务交付前满足预定义的验收标准。系统包含两大核心门控:

文件位置: src/harness/task-acceptance-tracker.ts
核心类: TaskAcceptanceTracker
// 从 goal 解析验收命令
const parsed = parseAcceptanceCommandsFromGoal(goal);
// 仅当 ≥2 条命令且为长跑 benchmark/goal 时激活
this.active = parsed.length >= 2 && isLongRunningImplementationGoal(goal);
多步骤验收链: 从 goal 文本中自动识别 npm ci → npm test → npm run build → npm run test:e2e 等链式命令
归一化匹配:
npx vitest / npx vitest run --reporter=verbose → npm test
npx playwright test / npx cypress run → npm run test:e2e
剥离 cd /d X &&、2>&1、管道重定向等噪声
保留 npm run test:e2e 等带命名空间的命令
type AcceptanceCommandStatus = 'pending' | 'passed' | 'failed';interface AcceptanceCommandEntry {
key: string; // 归一化键
label: string; // 原文展示
status: AcceptanceCommandStatus;
lastRunAt?: number;
}
状态更新流程:
background_start / background_running → 保持 pending
background_completed(exitCode: 0) → passed
background_failed / exitCode ≠ 0 → failed
isComplete(): boolean {
if (!this.isActive()) return true;
return this.commands.every(c => c.status === 'passed');
}
关键特性:
文件位置: src/harness/harness-tool-round.ts
函数: buildAcceptanceSuccessFeedbackMessage
// 单条通过(未完成)
[System / Acceptance ] npm test — 8 files / 22 tests passed (1/4 passed)// 全部通过(完成信号)
[System / Acceptance ] npm run test:e2e — 5 e2e tests passed in 4.4s (4/4 passed)
[System / Acceptance ] All 4 acceptance commands passed.
Output ≤10 delivery bullets now and STOP calling tools.
文件位置: src/harness/task-state.ts, src/harness/document-deliverable.ts
type VerificationStatus = 'not_required' | 'required' | 'passed' | 'failed';
type TaskPhase = 'intent' | 'context' | 'editing' | 'verification';
状态流转:
无变更 → verificationStatus = 'not_required'
写工程源码 → verificationStatus = 'required', phase = 'editing' → 'verification'
跑单元测试成功 → verificationStatus = 'passed'
跑单元测试失败 → verificationStatus = 'failed'
Acceptance 全通过 → markVerificationPassed() → 'passed'
type DeliverableKind = 'engineering' | 'file_deliverable' | 'none';// 工程源码(需单元测试)
ENGINEERING_EXTENSIONS = ['ts', 'tsx', 'js', 'jsx', 'vue', 'py', 'go', ...];// 文件交付物(需 file_info/read_file 确认)
其余扩展名(json, yaml, md, sql, ...)
// 写操作递增版本
bumpFileDeliverableWriteVersion(path): void;// 读/file_info 确认版本匹配
tryConfirmFileDeliverable(toolName, path, result): void;// 未确认路径统计
verificationConfirmationStats(filesChanged, writeVersions, confirmVersions): {
required: number; // 需确认的总数
pending: number; // 待确认数
exempt: number; // 豁免数(临时文件/草稿)
}
豁免路径规则:
文件位置: src/harness/document-deliverable.ts, src/harness/verification-digest.ts
shouldPromptEngineeringUnitTest(filesChanged, verificationStatus): boolean {
if (!hasEngineeringTestTargets(filesChanged)) return false;
return verificationStatus === 'required'; // 未跑过单测
}shouldInjectFailedUnitTestReminder(filesChanged, verificationStatus): boolean {
if (!hasEngineeringTestTargets(filesChanged)) return false;
return verificationStatus === 'failed'; // 已跑但失败
}
engineeringTestTargetPaths(filesChanged): string[] {
return filesChanged.filter(
path => isEngineeringUnitTestTargetPath(path) && !isVerificationExemptPath(path)
);
}
成功提示(未跑单测):
[System] You changed source code but have not run unit tests yet.Run unit tests covered these changed files (pick the command for this project):
- src/foo.ts
- src/bar.tsUse run_command, then fix failures before claiming the task is complete.
失败加强提示:
[System] Unit tests failed for your recent changes.Please complete unit tests: fix the failures, re-run tests via run_command, and only then finish.Changed source files:
- src/foo.ts
- src/bar.ts
文件位置: src/harness/harness-verification-gate.ts
shouldResetVerificationGateCounter(
pendingBefore, pendingAfter, blockingAfter,
acceptancePendingBefore, acceptancePendingAfter
): boolean {
if (!blockingAfter) return true; // blocking 解除
if (pendingAfter < pendingBefore) return true; // file pending 净减少
if (acceptancePendingAfter < acceptancePendingBefore) return true; // acceptance 净减少
return false;
}
用途: 防止 LLM 在验证未完成时过早停止,计数器累积到阈值后强制 block。
文件位置: src/harness/harness-tool-round.ts
// run_command 结果分类
const classified = classifyRunCommandResult(args, rawOutput, result.success);// 更新 Acceptance Tracker
tracker.recordRunCommandToolResult(classified);// 生成反馈消息
const feedback = buildAcceptanceSuccessFeedbackMessage({
newlyPassed: [...],
completedAll: tracker.isComplete(),
passedCount: tracker.getPassedCount(),
totalCount: tracker.commands.length
});// 注入到 LLM 上下文
if (feedback) msgs.push({ role: 'system', content: feedback });
// 工具结果记录
taskState.recordToolResult(toolCall, result);// 同步 Acceptance Gate 状态
syncTaskVerificationFromAcceptance(taskState, tracker);// 检查阻塞
const acceptanceIncomplete = tracker.hasPendingAcceptanceWork();
const isBlocking = taskState.isVerificationBlockingFinal(acceptanceIncomplete);// 生成 prompt
if (isBlocking) {
const prompt = taskState.buildVerificationPrompt();
msgs.push({ role: 'system', content: prompt });
}
文件位置: src/harness/incomplete-completion.ts
hasPendingWork(task, acceptance, workspaceRoot): boolean {
if (hasPendingAcceptanceWork(acceptance)) return true;
if (hasUnfulfilledFileDeliverableGoal(task.goal, task.filesChanged, task.intent)) return true;
return false;
}
未完成时注入:
buildIncompleteContinuationPrompt(task, repo, acceptance): string {
const lines = [
'[System] The task is NOT complete. Do not stop without calling tools.',
'',
'Evidence:'
]; if (hasPendingAcceptanceWork(acceptance)) {
lines.push(acceptance.buildAcceptancePrompt());
}
if (task.verificationStatus === 'failed') {
lines.push('- Unit tests failed; fix and re-run before stopping.');
}
if (shouldPromptEngineeringUnitTest(...)) {
lines.push('- Source code changed but unit tests have not passed yet.');
} return lines.join('n');
}
文件位置: src/harness/supervisor/mode-decision-engine.ts
type ModeSignal = 'task_graph_active' | 'pending_steps' | 'multi_write'
| 'branch_switched' | 'checkpoint_resumed' | 'tool_failure'
| 'large_diff' | 'explicit_impl';// 进入 forced 模式
shouldEnterForcedMode(state, config, signals): ModeSignal[] {
if (state.pendingStepCount >= config.pendingStepsEnterThreshold) reasons.push('pending_steps');
if (state.writeTargetsThisRound > config.writeTargetsEnterThreshold) reasons.push('multi_write');
if (!state.lastToolSuccess) reasons.push('tool_failure');
// ...
}
文件: test/harness/task-acceptance-tracker.test.ts
核心用例:
文件: test/harness/harness-verification-gate.test.ts
核心用例:
文件: test/harness/execution-mode-acceptance.test.ts
核心用例:
{
"executionMode": {
"pendingStepsEnterThreshold": 2,
"writeTargetsEnterThreshold": 1,
"diffLinesEnterThreshold": 200,
"stableRoundsExitThreshold": 2,
"modeLockRounds": 2,
"forcedMinDwellRounds": 1,
"readonlyToolNames": ["read_file", "glob", "grep", "list_dir"]
}
}
{
"verificationExemptDirs": [
".scratch",
".temp",
"tmp/"
]
}
Goal:
从零实现 survivors roguelike。
只有 **`npm ci` → `npm test` → `npm run build` → `npm run test:e2e` 全部成功** 后,才输出交付 bullet 并结束
流程:
场景: 修改 src/foo.ts 后未跑单测
流程:
场景: npm run test:e2e 需 5 分钟
流程:
生成时间: 2026-06-12 分析范围: 验收门控机制(Acceptance Gate + Verification Gate)