fix: distinguish read-only evidence from file delivery requirements
This commit is contained in:
@@ -47,7 +47,9 @@ test('an isolated three-module Python Task repairs, checks and delivers a source
|
||||
const latestResults = feedback ?? results, latest = latestResults.at(-1);
|
||||
// Follow actual returned states: archived older groups change the number of
|
||||
// visible tool messages and must not make this fixture repeat a call ID.
|
||||
if (!latest) return completion([call('python-plan-' + mode, 'plan_checks', { names: ['python:test', 'python:compile'] })]);
|
||||
// Review is now a system action, so the original user turn and completed
|
||||
// tools remain visible. The applied batch starts a fresh check plan.
|
||||
if (!latest || mode === 'delivery' && latest.change_set_id) return completion([call('python-plan-' + mode, 'plan_checks', { names: ['python:test', 'python:compile'] })]);
|
||||
if (latest.id && Array.isArray(latest.checks)) return completion([call('python-check-' + mode, 'run_checks', { plan_id: latest.id })]);
|
||||
if (latest.check_status === 'failed' && mode === 'repair') return completion(Object.entries(pythonFixes).map(([relative, content], index) => call('python-fix-' + index, 'propose_file', { path: relative, content, reason: 'Repair the actual sealed Python failure' })));
|
||||
if (latest.change_id && mode === 'repair') return completion([call('python-batch', 'prepare_change_set', { change_ids: latestResults.filter(value => value.change_id).map(value => value.change_id) })]);
|
||||
@@ -63,9 +65,17 @@ test('an isolated three-module Python Task repairs, checks and delivers a source
|
||||
const opened = await host.api(parent + '/workspaces/' + workspace.id + '/open', {}), route = '/sessions/' + opened.session.id;
|
||||
await host.api(route + '/messages', { content: 'Repair only the three Python workflow modules, preserve tests and declarations, execute Python tests and compilation and prepare a reviewed Git delivery.' });
|
||||
let session;
|
||||
const wait = async predicate => {
|
||||
const wait = async (predicate, { allowAppliedPause = false } = {}) => {
|
||||
try {
|
||||
await until(async () => { session = await host.api(route); if (['failed', 'paused'].includes(session.status)) throw new Error('Unexpected Python Task state: ' + session.status + '/' + session.execution.run.stopReason); return predicate(session); }, 30000);
|
||||
await until(async () => {
|
||||
session = await host.api(route);
|
||||
const appliedPause = allowAppliedPause && session.status === 'paused'
|
||||
&& session.execution.changeSets.at(-1)?.status === 'completed'
|
||||
&& session.execution.task.delivery?.status === 'files_applied'
|
||||
&& session.execution.task.verification?.status === 'failed';
|
||||
if (session.status === 'failed' || session.status === 'paused' && !appliedPause) throw new Error('Unexpected Python Task state: ' + session.status + '/' + session.execution.run.stopReason);
|
||||
return predicate(session);
|
||||
}, 30000);
|
||||
} catch (error) {
|
||||
fs.writeFileSync(path.resolve('.qa', 'python-api-state-failure.json'), JSON.stringify({ error: error.message, session,
|
||||
requests: model.requests.map(request => request.input) }, null, 2) + '\n');
|
||||
@@ -79,7 +89,9 @@ test('an isolated three-module Python Task repairs, checks and delivers a source
|
||||
assert.equal(session.execution.checks[0].results[0].tests.failed, 5);
|
||||
const taskId = session.execution.task.id, batch = session.execution.changeSets.at(-1);
|
||||
await host.api(route + '/change-sets/' + batch.id + '/apply', { fingerprint: batch.fingerprint });
|
||||
await wait(value => value.execution.changeSets.at(-1).status === 'completed');
|
||||
await wait(value => value.execution.changeSets.at(-1).status === 'completed', { allowAppliedPause: true });
|
||||
assert.equal(session.status, 'paused'); assert.equal(session.execution.task.verification.status, 'failed');
|
||||
assert.equal(session.execution.task.delivery.status, 'files_applied');
|
||||
mode = 'delivery'; await host.api(route + '/continue-reviewed', {});
|
||||
await wait(value => value.status === 'awaiting_approval');
|
||||
await host.api(route + '/approvals/' + session.approvals.at(-1).id, { allow: true });
|
||||
|
||||
Reference in New Issue
Block a user