fix: retain diagnostic evidence readers and legacy proposal completion

This commit is contained in:
Agent Workbench Dev
2026-11-01 14:28:57 +08:00
parent b144d123a0
commit ce18608582
4 changed files with 28 additions and 5 deletions
+6 -1
View File
@@ -161,6 +161,7 @@ test('model argument validation and runtime activity do not grant external engin
test('a follow-up question receives the actual failed engine check from its original Task and keeps its report unchanged', async t => {
const f = setup(t, { mode: 'bad-ready' }), job = await f.manager.start(f.session, { root: f.root }).promise;
assert.equal(job.status, 'failed'); const originalReport = f.manager.originalReport(f.session, job), taskId = job.taskId;
const originalWireCount = f.audit().length, originalGoal = f.store.core.task.get(taskId).goal;
const provider = new Provider(); let requests = 0;
provider.complete = async (_config, messages, _project, _signal, _progress, _plan, tools) => {
requests++;
@@ -176,6 +177,10 @@ test('a follow-up question receives the actual failed engine check from its orig
const runtime = new Runtime(f.store, provider); runtime.engines = f.manager;
f.onCleanup(() => runtime.stopAll());
runtime.start(f.session.id, '刚才的引擎连接检查为什么报错?'); await runtime.active.get(f.session.id).promise;
assert.equal(f.session.taskId, taskId); assert.equal(f.session.status, 'completed'); assert.equal(requests, 2);
assert.equal(f.session.taskId, taskId); assert.equal(f.session.status, 'paused'); assert.equal(requests, 2);
const diagnostic = f.store.core.run.get(f.session.runId);
assert.equal(diagnostic.purpose, 'diagnostic'); assert.equal(diagnostic.status, 'completed'); assert.equal(diagnostic.stopReason, 'diagnostic_answered');
assert.equal(f.store.core.task.get(taskId).status, 'paused'); assert.equal(f.store.core.task.get(taskId).goal, originalGoal);
assert.equal(f.audit().length, originalWireCount, 'Reading the failed original report must not start or prompt the external engine again.');
assert.equal(f.manager.originalReport(f.session, job), originalReport); assert.match(f.session.messages.at(-1).content, /当前任务/);
});