fix: bind observed models and calibrate every model dispatch budget

This commit is contained in:
Agent Workbench Dev
2026-11-02 20:50:42 +08:00
parent 30c318bf20
commit bb45dabac4
23 changed files with 526 additions and 29 deletions
+14 -4
View File
@@ -10,6 +10,7 @@ import { createPythonDeliveryProject, pythonProtected } from '../tests/fixtures/
import { deliveryGit, writeDeliveryFile } from '../tests/fixtures/delivery-project.mjs';
import { captureWorkspaceSource, assertWorkspaceSource } from '../tests/fixtures/workspace-project.mjs';
import { verifyLiveReactClient } from './live-react-client.mjs';
import { observedTaskModels } from './live-model-observation.mjs';
if (process.argv.includes('--help')) {
console.log('node scripts/verify-live-engineering.mjs --case react|python [--url http://127.0.0.1:4318] — fresh owned Git source/workspace, configured model and bounded review/check/delivery acceptance'); process.exit(0);
@@ -149,7 +150,7 @@ try {
fs.writeFileSync(path.join(root, 'delivery-report.json'), reportText); fs.writeFileSync(path.join(root, 'delivery-report.md'), markdown);
const browser = kind === 'react' ? await verifyLiveReactClient(childProject.root, path.join(root, 'screenshots')) : null;
fs.writeFileSync(path.join(root, 'session.json'), JSON.stringify(await api(route + '/export'), null, 2) + '\n');
result = { success: true, version: bootstrap.version, testedAt: new Date().toISOString(), kind, model: bootstrap.config.model, root,
result = { success: true, version: bootstrap.version, testedAt: new Date().toISOString(), kind, root,
taskId, sessionId: childSession.id, projectId: childProject.id, sourceProjectId: parentProject.id, workspaceId: workspace.id, workspaceRoot: childProject.root,
sourceCommit: workspace.source.head, commit: completedDelivery.commit, tests, checks: passing.results, usage: state.execution.task.usage,
elapsedSeconds: Math.round((Date.now() - startedAt) / 1000), applications, decisions, continuations, browser,
@@ -158,11 +159,20 @@ try {
credentialsHandling: 'The original Provider executes requests in its own process; no model key is read, copied or written.' };
succeeded = true;
} catch (error) {
result = { success: false, version: bootstrap.version, kind, testedAt: new Date().toISOString(), root, model: bootstrap.config.model,
result = { success: false, version: bootstrap.version, kind, testedAt: new Date().toISOString(), root,
taskId, sessionId: childSession?.id, projectId: childProject?.id, workspaceId: workspace?.id, error: error.stack,
elapsedSeconds: Math.round((Date.now() - startedAt) / 1000), usage: state?.execution?.task?.usage, state: state?.status,
stopReason: state?.execution?.run?.stopReason, applications, decisions, continuations, checks: state?.execution?.checks }; process.exitCode = 1;
} finally { if (!succeeded && route) await api(route + '/stop', {}).catch(() => {}); }
} finally {
if (!succeeded && route) await api(route + '/stop', {}).catch(() => {});
let refreshError=null;
if(route){try{state=await api(route);taskId??=state.execution?.task?.id;}catch(error){refreshError=error.message;}}
const observation=observedTaskModels(state,taskId);
if(refreshError){observation.status='incomplete';observation.model=null;observation.issues.push({kind:'final_state_refresh_failed',message:refreshError});}
result.model=observation.model;result.modelObservation=observation;result.plannedModel=bootstrap.config.model;
if(state?.execution?.task?.id===taskId)result.usage=state.execution.task.usage;
}
fs.writeFileSync(path.join(root, 'result.json'), JSON.stringify(result, null, 2) + '\n');
fs.writeFileSync(path.resolve('docs', 'live-' + kind + '-engineering-validation.json'), JSON.stringify(result, null, 2) + '\n');
console.log(JSON.stringify({ success: result.success, kind, root, taskId, commit: result.commit, tests: result.tests, usage: result.usage, error: result.error }));
console.log(JSON.stringify({ success: result.success, kind, root, taskId, model:result.model,modelObservation:result.modelObservation.status,
commit: result.commit, tests: result.tests, usage: result.usage, error: result.error }));