fix: isolate compiled release QA projects from deep extraction paths

This commit is contained in:
Agent Workbench Dev
2026-10-31 07:20:30 +08:00
parent 6056f2843c
commit 57d075ef5b
18 changed files with 1573 additions and 5 deletions
+5 -1
View File
@@ -1,5 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import http from 'node:http';
import assert from 'node:assert/strict';
import { spawn, execFileSync } from 'node:child_process';
@@ -151,7 +152,10 @@ export async function verifyControlledApi({ api, url, token, directory, appRoot,
export async function verifyControlledRelease(appRoot = process.cwd()) {
appRoot = fs.realpathSync.native(appRoot);
const directory = path.resolve('.qa', 'compiled-controlled-' + randomUUID()); fs.mkdirSync(directory, { recursive: true });
// Keep the synthetic Git project independent of the installation/extraction
// depth. The production workspace path guard remains responsible for users'
// actual project roots. Retain this exclusive directory as original evidence.
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'awb-controlled-'));
const node = fs.existsSync(path.join(appRoot, 'runtime/node.exe')) ? path.join(appRoot, 'runtime/node.exe') : process.execPath;
const env = { ...gitEnvironment(), ...Object.fromEntries(['AGENT_WORKBENCH_DEEPSEEK_ROOT', 'AGENT_WORKBENCH_PURGE_ROOT'].filter(name => process.env[name]).map(name => [name, process.env[name]])),
AGENT_WORKBENCH_APP_DIR: appRoot, AGENT_WORKBENCH_DATA_DIR: path.join(directory, 'data'), AGENT_WORKBENCH_PORT: '0' };