fix: retain verifiable task observations within context budgets

This commit is contained in:
Agent Workbench Dev
2026-10-30 01:28:23 +08:00
parent 04a74babc6
commit f12a12e12e
43 changed files with 933 additions and 46 deletions
+5 -4
View File
@@ -11,6 +11,7 @@ import { captureWorkspaceSource, assertWorkspaceSource } from '../tests/fixtures
// Every host/project is synthetic and independently owned. Never uses 4318.
const root = path.resolve('.qa', 'workspace-ui-' + randomUUID()), data = path.join(root, 'data');
const proofPrefix = JSON.parse(fs.readFileSync('package.json', 'utf8')).version === '1.6.0' ? 'workspaces' : 'working-context-workspaces';
fs.mkdirSync(root, { recursive: true }); fs.mkdirSync('.qa/screenshots', { recursive: true });
const store = new Store(data), cases = {}, passed = [], pageErrors = [], requestFailures = [], screenshots = [], createPosts = [];
for (const name of ['normal', 'mobile', 'recovery', 'late-success', 'late-failure']) {
@@ -66,7 +67,7 @@ async function fit(name) {
});
assert.ok(size.scrollWidth <= size.width + 1, name + ' page horizontal overflow');
if (size.top !== undefined) { assert.ok(size.top >= 0 && size.left >= 0 && size.right <= size.width + 1 && size.bottom <= size.height + 1, name + ' modal bounds'); assert.ok(size.closeBottom <= size.height); }
const file = '.qa/screenshots/1.6-workspace-' + name + '.png'; await page.screenshot({ path: file, scale: 'css' }); screenshots.push(file);
const file = '.qa/screenshots/' + proofPrefix + '-' + name + '.png'; await page.screenshot({ path: file, scale: 'css' }); screenshots.push(file);
}
try {
await page.goto(url); await page.waitForLoadState('networkidle');
@@ -138,10 +139,10 @@ try {
assert.equal(pageErrors.length, 0, pageErrors.join('\n')); assert.equal(requestFailures.length, 0, requestFailures.join('\n'));
const result = { success: true, version: bootstrap.version, at: new Date().toISOString(), browser: browser.version(), passed, pageErrors, requestFailures, screenshots, projectRoot: root,
scope: 'Independent synthetic Git projects and real browser flows. Desktop/390×844, actual worktree creation, source preservation, explicit external recovery, ownership navigation, delayed success/error/navigation. No production service or real model credential used.' };
fs.writeFileSync('docs/workspaces-ui-validation.json', JSON.stringify(result, null, 2) + '\n'); console.log(JSON.stringify(result, null, 2));
fs.writeFileSync('docs/' + proofPrefix + '-ui-validation.json', JSON.stringify(result, null, 2) + '\n'); console.log(JSON.stringify(result, null, 2));
} catch (error) {
await page.screenshot({ path: '.qa/screenshots/1.6-workspace-failure.png', scale: 'css' });
fs.writeFileSync('.qa/workspaces-ui-failure.json', JSON.stringify({ success: false, message: error.message, passed, pageErrors, requestFailures }, null, 2)); throw error;
await page.screenshot({ path: '.qa/screenshots/' + proofPrefix + '-failure.png', scale: 'css' });
fs.writeFileSync('.qa/' + proofPrefix + '-ui-failure.json', JSON.stringify({ success: false, message: error.message, passed, pageErrors, requestFailures }, null, 2)); throw error;
} finally {
await browser.close(); try { await api('/shutdown', {}); await wait(() => host.exitCode !== null); } catch { if (host.exitCode === null) host.kill(); }
}