fix(engines): preserve verified review pauses and always close native sessions
This commit is contained in:
@@ -163,7 +163,10 @@ async function runSample(kind, { sampleName = kind, strategy = null, comparison
|
||||
}
|
||||
if (failure) throw failure;
|
||||
const native = [...f.store.core.engine_run.values()].filter(job => job.taskId === child.taskId).at(-1);
|
||||
assert.equal(native.status, 'completed', native.error);
|
||||
if(session.status==='needs_review'&&native.reviewHandoff){
|
||||
assert.equal(native.status,'paused');assert.equal(native.verified,false);assert.equal(native.requiresVerification,false);
|
||||
assert.equal(native.reviewHandoff.kind,'change_set');assert.equal(native.native.cleanup.treeConfirmed,true);
|
||||
}else assert.equal(native.status, 'completed', native.error);
|
||||
}
|
||||
assert.equal(group.status, 'ready_to_collect', group.summary); assert.deepEqual(ownerBytes(f), original); verify(childRoot);
|
||||
const childChecks = [...f.store.core.check_job.values()].filter(job => job.taskId === child.taskId);
|
||||
@@ -171,13 +174,16 @@ async function runSample(kind, { sampleName = kind, strategy = null, comparison
|
||||
assert.equal(childChecks.at(-1).results[0].tests.passed, spec.tests); assert.equal(childChecks.at(-1).status, 'passed');
|
||||
const engineRuns = [...f.store.core.engine_run.values()].filter(job => job.taskId === child.taskId), childSession = f.store.session(child.sessionId);
|
||||
for (const job of engineRuns) {
|
||||
originalEngineRun(f.store, childSession, job); assert.equal(job.status, 'completed', job.error); assert.equal(job.native.cleanup.treeConfirmed, true);
|
||||
originalEngineRun(f.store, childSession, job);
|
||||
if(job.reviewHandoff){assert.equal(job.status,'paused');assert.equal(job.verified,false);}else assert.equal(job.status, 'completed', job.error);
|
||||
assert.equal(job.native.cleanup.treeConfirmed, true);
|
||||
if(originalPurgeMode){
|
||||
const warning='(node:'+job.native.process.pid+') [PERM0001] SecurityWarning: The flag --allow-addons must be used with extreme caution. It could invalidate the permission model.\n(Use `node --trace-warnings ...` to show where the warning was created)\n';
|
||||
const expected=warning+['package.json','lib/index.js'].map(file=>'AWB_MODULE_REFUSED '+path.join(installation.root,'packages/context/agent-instructions',file)+'\n').join('');
|
||||
assert.equal(job.native.stderr,expected);assert.equal(job.native.originalPurge.readiness.originalApplyCalled,true);
|
||||
assert.equal(job.native.originalPurge.nativeLoads.length,2);assert.ok(job.native.originalPurge.durabilityReceipts.length>0);
|
||||
}else assert.equal(job.native.stderr, ''); assert.equal(job.native.activity.endEvents[0].data.reason.kind, 'completed');
|
||||
}else assert.equal(job.native.stderr, '');
|
||||
if(!job.reviewHandoff)assert.equal(job.native.activity.endEvents[0].data.reason.kind, 'completed');
|
||||
for (const request of job.requests) {
|
||||
const saved = verifyEngineModelInput(f.store, childSession, job, request);
|
||||
if (strategy) { assertPurgeModelInput(saved.native, job.installation.strategy);
|
||||
@@ -186,6 +192,8 @@ async function runSample(kind, { sampleName = kind, strategy = null, comparison
|
||||
else assert.ok(nativeSystemTexts(saved.native).every(text => !text.includes('[Agent Workbench engineering prompt experiment]')));
|
||||
}
|
||||
}
|
||||
assert.equal(engineRuns.at(-1).status,'completed','The final native Run must complete after explicit review continuation.');
|
||||
assert.equal(engineRuns.at(-1).verified,true);
|
||||
assert.equal(f.store.core.task.get(child.taskId).usage.requests, modelRequests.length);
|
||||
assert.equal(f.store.core.task.get(child.taskId).usage.totalTokens, modelRequests.length * 168);
|
||||
if (responsesMode) {
|
||||
@@ -197,13 +205,13 @@ async function runSample(kind, { sampleName = kind, strategy = null, comparison
|
||||
mark(label + ': actual Harness uses owned model/tool bridges, retains failing tests, and completes reviewed repairs with one accounting entry per HTTP request');
|
||||
if(contextMode){
|
||||
const bounded=engineRuns.flatMap(job=>job.requests.map(request=>verifyEngineModelInput(f.store,childSession,job,request))).filter(input=>input.view.mode==='bounded');
|
||||
assert.ok(bounded.length>0,'The original long failure/log history must exercise the bounded bridge.');
|
||||
if(contextLimit===16000)assert.ok(bounded.length>0,'The tighter original context profile must exercise the bounded bridge.');
|
||||
assert.ok(bounded.every(input=>input.view.beforeInputTokens>input.view.inputBudget&&input.plan.estimatedInputTokens<=input.view.inputBudget));
|
||||
const sent=JSON.stringify(bounded.map(input=>input.body));assert.ok(sent.includes('logArtifactId'));assert.ok(sent.includes('failed'));
|
||||
const sent=JSON.stringify(engineRuns.flatMap(job=>job.requests.map(request=>verifyEngineModelInput(f.store,childSession,job,request).body)));assert.ok(sent.includes('logArtifactId'));assert.ok(sent.includes('failed'));
|
||||
const failed=childChecks.find(job=>job.status==='failed'),log=f.store.core.artifact.get(failed.results[0].logArtifactId);
|
||||
assert.ok(f.store.artifactStore.read(log).includes('fail 9'));assert.ok(engineRuns.some(job=>job.calls.some(call=>call.name==='read_artifact')));
|
||||
assert.ok(engineRuns.some(job=>job.calls.some(call=>call.name==='prepare_change_set')));assert.ok(engineRuns.every(job=>!job.inputRejections?.length));
|
||||
mark(contextLimit/1000+'K: original nine failures and paged log survive verified native compaction; all three proposals form one reviewed batch without replay');
|
||||
mark(contextLimit/1000+'K: original nine failures and paged log retained; '+bounded.length+' native requests used verified compaction; all three proposals form one reviewed batch without replay');
|
||||
}
|
||||
await (await manager.collect(f.session, group.id, group.fingerprint)).promise; assert.equal(group.status, 'collected', group.summary);
|
||||
const collection = await manager.readCollection(f.session, group); assert.deepEqual(collection.conflicts, []); assert.deepEqual(collection.paths, writable);
|
||||
|
||||
Reference in New Issue
Block a user