fix(runtime): preserve model capacity history and cache evidence with resumable file proposals

This commit is contained in:
Agent Workbench Dev
2026-11-06 01:18:37 +08:00
parent 2b17821138
commit 72115647d9
39 changed files with 699 additions and 75 deletions
+7 -2
View File
@@ -5,7 +5,7 @@ import path from 'node:path';
import { Runtime } from '../src/server/runtime.mjs';
import { Provider } from '../src/server/provider.mjs';
import { applyChange } from '../src/server/files.mjs';
import { isDiagnosticQuestion, taskContract } from '../src/shared/contracts/task-control.mjs';
import { isDiagnosticQuestion, taskContract, updateTaskContract, taskToolAllowed } from '../src/shared/contracts/task-control.mjs';
import { fixture, call, assertToolPairs } from './helpers.mjs';
const answer = content => ({ message: { role: 'assistant', content }, usage: { prompt_tokens: 11, completion_tokens: 3 } });
@@ -17,8 +17,13 @@ test('operational questions are diagnostic while explicit repair requests remain
test('an explicit prohibition on running engineering checks is not interpreted as a requirement to run them', () => {
for (const goal of ['只读核对指定文件范围,不修改文件,不运行工程检查。', '不执行工程检查,只解释原结果',
'不需要做任何测试', '无需工程检查', 'Read the evidence; do not run checks.', "Don't run tests; explain the original failure."]) {
'不需要做任何测试', '无需工程检查', 'Read the evidence; do not run checks.', "Don't run tests; explain the original failure.",
'Inspect the directory once and answer only. Do not modify files or run checks.']) {
assert.equal(taskContract({goal}).checks, 'skip', goal);
const task = { goal: 'Run checks.', instructions: [] };
updateTaskContract(task, goal); assert.equal(task.contract.checks, 'skip', goal);
assert.equal(taskToolAllowed(task, { purpose: 'execution' }, 'run_checks'), false);
updateTaskContract(task, 'Now run checks.'); assert.equal(task.contract.checks, 'required');
}
for (const goal of ['修复并运行工程检查', '运行并通过原测试', 'Fix the source and run checks.']) assert.equal(taskContract({goal}).checks, 'required', goal);
});