fix(ci): observe reminder progress and capture painted desktop views

This commit is contained in:
Agent Workbench Dev
2026-11-08 00:08:31 +08:00
parent 87ca075175
commit 4a03ec528a
7 changed files with 75 additions and 10 deletions
+19 -2
View File
@@ -2,7 +2,7 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import { fixture, launchWorkbench, compatibleFixture, until, completion, call } from './helpers.mjs';
test('HTTP settings persist independently of model credentials and inspected advice remains bound to the original session', async t => {
test('HTTP settings persist independently of model credentials and inspected advice remains bound to the original session', { timeout: 120000 }, async t => {
const f = fixture(t, { modernDefaults: true }); let n = 0;
const model = await compatibleFixture(t, () => ({ body: ++n < 5 ? completion([call('read-' + n, 'read_file', { path: 'README.md', offset: n === 4 ? 10 : 0, limit: 10 })]) : completion([], '本机固定流程完成。') }));
const foreign = f.store.createSession(f.project.id);
@@ -18,7 +18,24 @@ test('HTTP settings persist independently of model credentials and inspected adv
const { configRevision: afterRevision, progressRemindersEnabled: afterEnabled, ...actual } = after.config;
assert.deepEqual(actual, original); assert.equal(afterEnabled, true); assert.equal(afterRevision, beforeRevision + 1);
await host.api('/sessions/' + f.session.id + '/messages', { content: '修改README.md,先读取核对内容;无需测试。' });
await until(async () => !['running', 'stopping', 'awaiting_approval'].includes((await host.api('/sessions/' + f.session.id)).status), 20000);
// Observe every physical request, then finalization. Five complete turns
// must not share a single 20-second wall-clock allowance under CI load.
// A stalled phase still fails and reports the actual last run state.
const phases = [], waitFor = async predicate => {
let current; const started = Date.now();
try {
await until(async () => {
current = await host.api('/sessions/' + f.session.id);
return predicate(current);
}, 20000);
phases.push({ requests: n, status: current.status, elapsedMs: Date.now() - started });
} catch (cause) {
throw new Error('Reminder fixture phase failed: ' + JSON.stringify({ requests: n, status: current?.status, run: current?.execution.run, phases }), { cause });
}
};
for (let request = 1; request <= 5; request++) await waitFor(() => n >= request);
await waitFor(current => !['running', 'stopping', 'awaiting_approval'].includes(current.status));
t.diagnostic(JSON.stringify({ reminderRequests: n, phases }));
const state = await host.api('/sessions/' + f.session.id), run = state.execution.run;
const view = await host.api('/sessions/' + f.session.id + '/progress-reminders?run=' + run.id);
assert.equal(n, 5); assert.equal(view.evidenceVerified, true); assert.equal(view.items[0].status, 'resolved');