fix: advance offline demo from original conversation

This commit is contained in:
Agent Workbench Dev
2026-11-06 06:55:29 +08:00
parent c9c77c7ee6
commit b8a5f95018
11 changed files with 112 additions and 8 deletions
+2
View File
@@ -1,5 +1,7 @@
# Agent Workbench项目执行规范
发行候选c9c77c7e已做三归档原字节/CRC、710源码ZIP输入离线重建22/22及随包开放原生SDK4组/6本机请求,均通过;便携完整验收与隔离安装先后暴露同一离线demo循环:规划尾部user-role工程状态被误认新目标,反复list_files。正式未升级。现demo只用原session.providerMessages推进,真实wire计划与核验保持;新回归及权限/发行相关20/20、并行复制2/2通过,build-17后另冻新候选重验,旧候选/两失败及数据不变卸载收据保留。Windows新发行目录采用并行复制,仍完整SHA/归档核对,不省历史证据。不委派/推送/触Key;下一完成新候选/实际安装,再正式升级/full/open/真实重启。
1.25.5最终补漏已合回并验证:build-16、相关72/72、worker停止/未发请求/超额四边界4/4、网页10组与实际Electron11组均通过;新等待0不限及长时限、开放目录122选择/121自动成员、4MB以上原目录、完整网络历史/DNS、20 Chat工具/129 Messages块已核对。976项完整源码原轮958通过18失败保持,低负载精确补验与失败根因见QA,不冒称原轮全绿。现在冻结实现准备独立不可变发行/ZIP重建/实际安装,随后正式升级、保存full/open并实际重启;正式仍1.25.4,不能称已部署。真实供应商请求0;旧网络/重复读取/真实自主交付/预留边界/Purge未知保持。不委派/推送/触真实Key、不续跑用户项目。
当前接续1.25.5默认透传/三操作权限/自动Git与回滚。用户最新要求覆盖下方历史固定额度、每项审查和不重启默认:新安装不设本地上下文/输出/累计/轮数/等待额度,首次ask,用户选择持久保存;正式用户偏好full,已授权实际重启。权限45/45、网页7组/实际Electron8组与扩大回归补验已过;最新实际原生SDK4组/6本机模型请求、33文件大于2MB无检查worker自动父合并、多图9张及同Task续接第10张补验通过,首失败/中断全部保留。当前完成新UI复核后冻结本地实现,完整源码/不可变发行/安装/正式升级重启仍待完成,不能称已部署。正式仍1.25.4;不委派/推送,不读取/复制/解密/重存真实Key。重启会丢失未持久保存的内存Key,只公开核对hasKey。自主交付/网络间歇/普遍重复读取/真实预留边界/Purge收益未知保持,不续跑历史或用户原项目。见docs/QA-OPEN-PERMISSIONS-1.25.5.md。
+10
View File
@@ -87,3 +87,13 @@ worker补充诊断`open-worker-accounting-diagnostic.json`证实2个子任务均
主源码最终实际Electron11组全部通过(`open-electron-e7cb1fe9-2c1e-4b36-a0d4-b7b7211f1073`),含完整长DOM/133控件、密码/select输入及跨来源导航,不需要手动批准;原生回看第二来源及390目录122已选截图。网页7/Electron13次均为自有本机HTTP模型夹具请求,未使用真实Key。worker停止后迟到用量、请求中断未知、发送前超时0用量及真实超额响应记账四边界4/4通过,`open-final-worker-boundaries-1.log`。
本阶段回顾:第三遍行为复核揭示0值在定时器/诊断/前端的跨层含义未完全同步,已按实际调用链修复并验证。旧测试只有在仍检验原有事实时才更正默认/文案与容量;worker补充必须真实派发的断言,避免将发送前停止误作记账证明。未改写976项原失败或历史16K/2048数据。下一不可变发行与真实安装,不继续扩大功能范围。
## 首完整候选的实际发现与修正
c9c77c7e候选`20261105222201789`:三归档SHA/CRC/完整清单通过;源码ZIP710输入独立离线重建22/22通过;随包真实原生SDK开放流程4组/6本机模型请求通过,186份5137986字节原件已复制封存到`.qa/unrestricted-1.25.5/packaged-native-1`。这些均不证明真实供应商自主交付。
完整便携验收`open-portable-release-1.log`在首命令批准等待超时。原fixture数据库只读封存在`open-portable-first-session.json`:0批准/0提案、反复list_files。根因为默认完整历史规划将当前工程状态放在尾部user消息,离线demo脚本以最后user为新目标,永远重置计数。隔离安装b7b0a0cd在完成实际干净安装、开放窗口拒绝、在途请求拒绝3组后,也在相同demo的原批准等待失败;两处原期限均未放宽。原结果与候选保留,正式未改动。
修正由Runtime为离线模式提供原session.providerMessages,Provider在原wire核验之后只将其用于demo推进,真实模型请求和证据完全不变。新用例确认默认无限额度下单次list/read/自动写入/ask命令/完成共5步,并保留原用户目标;权限及发行相关20/20通过。旧隔离样本所属宿主已正常停止,唯一卸载其QA程序、全部用户数据快照exact,原安装器/程序候选/指针和失败保留(`open-first-install-cleanup-1.log`)。
首打包的大量历史单文件复制耗时明显。仅新发行树改Windows16路复制,预先拒绝链接,再照旧生成全量SHA并逐字节核对资料与三归档;既有输出保留原普通复制语义。中文/BOM/二进制/空目录和junction拒绝2/2通过,原资料核对用例保持。新候选仍须独立ZIP重建、三归档与真实安装,不用首候选的通过代签新产物。
+2
View File
@@ -1270,6 +1270,8 @@ V调用前检查:新增11文件SHA断言首语法检查发现多一个右括
## 开放权限:跨层null语义与真实完成状态
首完整候选默认demo反复列文件的原因是RequestPlanner完整历史末尾追加user-role当前状态,而Provider.demo基于最后user截断原工具结果。真实供应商不走demo分支,不能把此复现当成真实模型重复读取已解释。现在在完成原wire核验后,离线脚本使用所属原session.providerMessages;1/1新回归、权限及发行20/20通过。旧便携与实际安装失败保持,无正式升级;源码ZIP710/22与三归档首轮通过保持各自含义。
最终976项回归原轮958通过18失败,完整终态保留。低负载补验HTTP evaluations在16.7秒通过,原20秒等待未放宽。worker原10,000/子额度在发送前token_limit、0个context_plan、两个worker0请求0用量,明确不是漏记计费;测试改为20,000/子且响应20,001,保留超额1 token、无工具/改动、续接不重置等断言,新增必须真的发出2请求,独立副本通过。此调整只涉及显式restricted历史测试,不恢复默认额度。
主源码网页10组全部通过(open-web-f34d2c8c):实际回看1440权限与390连接诊断截图。权限位于输入框上方并自动保存,三栏原工作台品牌保持;窄屏诊断表按列换行、无页面横向溢出,0期限显示不限、IPv6缺失明确未检查。目录122选项/自动适配及真实TCP无模型检查、原错误下载、自动文件落地与回滚、多图流程均有原收据;本轮网页7个本机模型夹具请求、2目录GET、0真实供应商请求。
+2
View File
@@ -1909,3 +1909,5 @@ Y阶段结束:预检110tokens通过;Node8请求64500tokens全部matched,
低负载精确诊断97770已结束:HTTP evaluations通过;worker累计预算测试仍失败。新增不改主源码的只读诊断确认两个worker均0请求/0用量,不能记作账本漏记,继续定位发送前停止原因。原失败、旧不完整候选和主动取消收据均保留;正式仍1.25.4,尚无升级/重启或真实供应商请求。
最终主源码build-16、相关72/72、worker四边界4/4、网页10组和实际Electron11组全部通过并回看。worker旧10,000/子不足发送,改20,000/子、20,001实际回执继续检验超额1 token且无副作用,新增实际两请求断言。27修复文件按before SHA合回、diff逐项回顾;准备本地提交冻结,另制不可变候选。上一次工具只读工作目录少字被拒绝,已用真实目录更正,没有产品或正式写入。
c9c77c7e首完整候选完成三归档、710输入ZIP离线重建22/22和实际SDK4组;完整便携与隔离安装都在demo批准处失败,现场确认工程状态尾部user重置离线演示,非真实模型重复读取。原失败保留,修正demo用原历史,权限/发行20/20及Windows新树并行复制2/2通过。旧隔离程序唯一卸载且原数据exact。首正式before已封存85项目103全部会话/PID55352/hasKey=true;无正式升级。下一build-17、本地提交新来源和重制候选,保留原976轮与所有未知。
+3 -2
View File
@@ -1,6 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';
import { createHash } from 'node:crypto';
import { copyReleaseTree } from './release-copy.mjs';
export const REQUIRED_REPORTS = Object.freeze(['docs/RESEARCH.md', 'docs/research/CURSOR-MECHANISMS.md', 'docs/research/CONTEXT-RECOVERY.md', 'docs/research/TOOL-LOOP.md']);
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
@@ -29,9 +30,9 @@ export function createDocumentationBundle({ root, portableRoot, evidenceRoot, ar
const selected = new Set(entries.filter(row => /^docs\/[^/]+\.md$/.test(row.path) || /^docs\/research\/[^/]+\.(?:md|json)$/.test(row.path)).map(row => row.path));
const references = [], shipped = [];
fs.mkdirSync(evidenceRoot, { recursive: true });
copyReleaseTree(path.join(root, 'docs'), path.join(evidenceRoot, 'docs'));
for (const row of entries) {
const target = path.join(evidenceRoot, row.path); fs.mkdirSync(path.dirname(target), { recursive: true });
fs.copyFileSync(path.join(root, row.path), target);
const target = path.join(evidenceRoot, row.path);
if (hash(fs.readFileSync(target)) !== row.sha256) throw new Error('Original evidence copy differs: ' + row.path);
}
const evidenceManifest = { schema: 1, app: 'agent-workbench-evidence', sourceCommit, scope: 'Original docs tree, including all successful/failed historical evidence. No runtime execution dependency.', files: entries };
+2 -4
View File
@@ -8,6 +8,7 @@ import { planDesktopBundle, buildNativeLauncher, copyDesktopBundle } from './bun
import { buildWindowsInstaller } from './build-installer.mjs';
import { createDocumentationBundle } from './documentation-bundle.mjs';
import { archiveWindowsDirectory } from './release-archive.mjs';
import { copyReleaseTree } from './release-copy.mjs';
const args = process.argv.slice(2);
if (args.some(value => !['--help', '--immutable'].includes(value))) throw new Error('Unsupported argument; use --help.');
@@ -33,10 +34,7 @@ for (const target of [portableRoot, sourceRoot]) {
const portableFiles = ['dist-client', 'dist-server', 'dist-desktop', 'public', 'examples', 'benchmarks', 'research', 'CHANGELOG.md', 'DESIGN.md', 'AGENTS.md', 'Start-Workbench.cmd', 'Stop-Workbench.cmd', 'Start-Desktop.cmd'];
const sourceFiles = ['src', 'public', 'scripts', 'tests', 'docs', 'examples', 'benchmarks', 'research', 'package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', 'mobile.html', '.gitignore', '.gitattributes', 'README.md', 'CHANGELOG.md', 'DESIGN.md', 'AGENTS.md', 'task_plan.md', 'findings.md', 'progress.md', 'Start-Workbench.cmd', 'Stop-Workbench.cmd', 'Start-Desktop.cmd'];
const copyTree = (source, destination) => fs.cpSync(source, destination, { recursive: true, filter: (from, to) => {
if (!fs.statSync(from).isFile() || !fs.existsSync(to)) return true;
return !fs.readFileSync(from).equals(fs.readFileSync(to));
} });
const copyTree = copyReleaseTree;
for (const name of portableFiles) copyTree(path.join(root, name), path.join(portableRoot, name));
fs.mkdirSync(path.join(portableRoot, 'scripts'), { recursive: true });
for (const name of ['Start-Workbench.ps1', 'Stop-Workbench.ps1', 'Start-Desktop.ps1', 'upgrade-running.mjs', 'python-check-runner.py']) fs.copyFileSync(path.join(root, 'scripts', name), path.join(portableRoot, 'scripts', name));
+27
View File
@@ -0,0 +1,27 @@
import fs from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
// Fresh immutable trees can use Windows' parallel copier. Hash manifests and
// archive verification remain authoritative; existing outputs are never reused.
export function copyReleaseTree(source, destination) {
if (process.platform !== 'win32' || !fs.statSync(source).isDirectory() || fs.existsSync(destination)) {
fs.cpSync(source, destination, { recursive: true }); return;
}
const inspect = directory => {
if (fs.lstatSync(directory).isSymbolicLink()) throw new Error('Release source cannot contain links: ' + directory);
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const file = path.join(directory, entry.name);
if (entry.isSymbolicLink() || !entry.isDirectory() && !entry.isFile()) throw new Error('Release source must contain regular files: ' + file);
if (entry.isDirectory()) inspect(file);
}
};
inspect(source); fs.mkdirSync(path.dirname(destination), { recursive: true });
try {
execFileSync('robocopy.exe', [path.resolve(source), path.resolve(destination), '/E', '/COPY:DAT', '/DCOPY:DAT', '/R:0', '/W:0', '/MT:16', '/XJ', '/NFL', '/NDL', '/NJH', '/NJS', '/NP'],
{ windowsHide: true, stdio: 'pipe', maxBuffer: 8 * 1024 * 1024 });
} catch (error) {
// Robocopy uses 1..7 for successful copies with differences, 8+ for errors.
if (!Number.isInteger(error.status) || error.status < 0 || error.status >= 8) throw error;
}
}
+3 -1
View File
@@ -352,7 +352,9 @@ export class Provider {
const body = completionBody(config, messages, tools);
assertPlannedRequest(body, requestPlan);
if (config.executionMode !== 'unrestricted' && config.inputImages?.length && (!config.modelRouting || !this.hub || config.mode==='demo')) throw new Error('图片请求必须通过模型中心的视觉能力选路,尚未发送。');
if (config.mode === 'demo') return this.demo(messages, project, config);
// Planned requests may end with a synthetic user-role state note. The
// offline script follows the original conversation after wire verification.
if (config.mode === 'demo') return this.demo(requestPolicy.demoHistory ?? messages, project, config);
this.validate(config);
const execute = async (selected, key, input, progress) => {
return this.request(selected, protocolRoute(selected), input, signal, key, progress, { ...(config.modelRouting ? { attempts: 1 } : {}), ...requestPolicy,
+1 -1
View File
@@ -484,7 +484,7 @@ export class Runtime {
response = externalEngine
? await this.engineRunner().complete(session, run, planned.messages, progressHandler, planned.record, tools)
: await this.provider.complete(requestConfig, planned.messages, run.project, signal, progressHandler, planned.record, tools,
{maxBudgetAttempts:planned.record.maxBudgetAttempts,beforeDispatch:({previousFailure}={})=>checkModelDispatchBudget(this.store,session,run.record,requestConfig,planned.body,0,previousFailure)});
{ ...(config.mode === 'demo' ? { demoHistory: session.providerMessages } : {}), maxBudgetAttempts:planned.record.maxBudgetAttempts,beforeDispatch:({previousFailure}={})=>checkModelDispatchBudget(this.store,session,run.record,requestConfig,planned.body,0,previousFailure)});
if (response.compatibility?.length && requestEvent) { requestEvent.compatibility = response.compatibility; this.store.save(session); }
this.requestPlanner().finish(session, planned.record, { response, attempts: planned.record.requestAttempts });
if (run.worker && !externalEngine && !responseAccounted) {
+26
View File
@@ -0,0 +1,26 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { randomBytes } from 'node:crypto';
import { fixture } from './helpers.mjs';
import { copyReleaseTree } from '../scripts/release-copy.mjs';
test('fresh parallel release copies preserve all binary and Unicode bytes and empty directories', t => {
const f = fixture(t), source = path.join(f.root, 'source'), target = path.join(f.root, 'copied');
fs.mkdirSync(path.join(source, '中文', 'empty'), { recursive: true });
const files = { 'original.bin': randomBytes(8193), '中文/原件.txt': Buffer.from('\ufeff原始失败\r\n原始成功\r\n') };
for (const [relative, bytes] of Object.entries(files)) fs.writeFileSync(path.join(source, relative), bytes);
copyReleaseTree(source, target);
for (const [relative, bytes] of Object.entries(files)) assert.deepEqual(fs.readFileSync(path.join(target, relative)), bytes);
assert.deepEqual(fs.readdirSync(path.join(target, '中文', 'empty')), []);
fs.writeFileSync(path.join(source, 'original.bin'), 'changed'); copyReleaseTree(source, target);
assert.equal(fs.readFileSync(path.join(target, 'original.bin'), 'utf8'), 'changed');
});
test('Windows parallel release copy rejects junctions before creating a candidate', { skip: process.platform !== 'win32' }, t => {
const f = fixture(t), source = path.join(f.root, 'source'), target = path.join(f.root, 'copied');
fs.mkdirSync(source); fs.symlinkSync(f.projectRoot, path.join(source, 'external'), 'junction');
assert.throws(() => copyReleaseTree(source, target), /regular files|links/);
assert.equal(fs.existsSync(target), false);
});
+34
View File
@@ -0,0 +1,34 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fixture, until } from './helpers.mjs';
import { Provider } from '../src/server/provider.mjs';
import { Runtime } from '../src/server/runtime.mjs';
test('unrestricted offline demo uses original history rather than the appended state as a new user goal', async t => {
const f = fixture(t, { modernDefaults: true }), provider = new Provider(), runtime = new Runtime(f.store, provider);
f.onCleanup(() => runtime.stopAll());
const complete = provider.complete.bind(provider); let requests = 0;
provider.complete = async (...args) => {
assert.ok(++requests <= 5, 'The offline demo must advance without an artificial step limit.');
assert.ok(args[1].some(message => message.role === 'user' && String(message.content).startsWith('工作台当前工程状态')));
assert.equal(args[7].demoHistory, f.session.providerMessages);
return complete(...args);
};
const goal = 'Use the original offline user goal in the saved notes.';
runtime.start(f.session.id, goal);
await until(() => f.session.status === 'awaiting_approval' || !runtime.hasActivity(), 45000);
assert.equal(f.session.status, 'awaiting_approval', JSON.stringify(f.session.failure));
assert.equal(requests, 4);
const approval = f.session.approvals.find(value => value.status === 'pending'); assert.equal(approval.command, 'node --version');
assert.equal(f.session.events.filter(value => value.tool === 'list_files').length, 1);
assert.equal(f.session.events.filter(value => value.tool === 'read_file').length, 1);
assert.ok(fs.readFileSync(path.join(f.projectRoot, 'WORKBENCH-NOTES.md'), 'utf8').includes(goal));
assert.equal(f.session.changes[0].status, 'applied');
const finished = runtime.active.get(f.session.id).promise;
runtime.decide(f.session.id, approval.id, true); await finished;
assert.equal(f.session.status, 'completed'); assert.equal(requests, 5);
assert.equal(f.session.approvals.filter(value => value.status === 'pending').length, 0);
assert.equal(provider.demo([{ role: 'user', content: 'A new goal after the previous task.' }], f.project, f.store.config).message.tool_calls[0].function.name, 'list_files');
});