Files
Agent-Workbench/tests/fixtures/workspace-crash-worker.mjs
T
2026-10-30 00:13:52 +08:00

15 lines
1006 B
JavaScript

import { Store } from '../../src/server/store.mjs';
import { WorkspaceManager } from '../../src/core/workspaces/git-workspaces.mjs';
const [data, sessionId, workspaceId, cut] = process.argv.slice(2), store = new Store(data);
const manager = new WorkspaceManager(store, { initialize: false, faultInjector: (phase, record) => {
if (phase !== cut) return;
process.stdout.write(JSON.stringify({ phase, workspaceId: record.id, root: record.root, branch: record.branch, gitPid: record.gitPid }) + '\n');
process.exit(73);
} });
const record = store.owned('workspace', workspaceId, sessionId);
await (await manager.start(store.session(sessionId), record.id, record.fingerprint)).promise;
process.stderr.write('Workspace did not reach crash cut: ' + cut + ' / ' + record.status + ' / ' + record.summary
+ '\nGit result: ' + JSON.stringify(record.gitResult ?? null) + '\nObservation: ' + JSON.stringify(record.observation?.problems ?? []) + '\n');
await manager.stopAll(); store.close(); process.exit(74);