refactor: unify sandbox configuration naming and improve telemetry config

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
pomelo-nwu 2026-02-11 11:08:15 +08:00
parent 66f754e203
commit 8b3aeb4550
24 changed files with 141 additions and 143 deletions

View file

@ -29,7 +29,7 @@
(allow network-inbound (local ip "localhost:9229"))
;; deny all outbound network traffic EXCEPT through proxy on localhost:8877
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
;; set `QWEN_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
(deny network-outbound)
(allow network-outbound (remote tcp "localhost:8877"))

View file

@ -93,6 +93,6 @@
(allow network-inbound (local ip "localhost:9229"))
;; allow outbound network traffic through proxy on localhost:8877
;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
;; set `QWEN_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
(allow network-outbound (remote tcp "localhost:8877"))

View file

@ -263,8 +263,8 @@ export async function start_sandbox(
...finalArgv.map((arg) => quote([arg])),
].join(' '),
);
// start and set up proxy if GEMINI_SANDBOX_PROXY_COMMAND is set
const proxyCommand = process.env['GEMINI_SANDBOX_PROXY_COMMAND'];
// start and set up proxy if QWEN_SANDBOX_PROXY_COMMAND is set
const proxyCommand = process.env['QWEN_SANDBOX_PROXY_COMMAND'];
let proxyProcess: ChildProcess | undefined = undefined;
let sandboxProcess: ChildProcess | undefined = undefined;
const sandboxEnv = { ...process.env };
@ -378,7 +378,7 @@ export async function start_sandbox(
stdio: 'inherit',
env: {
...process.env,
GEMINI_SANDBOX: config.command, // in case sandbox is enabled via flags (see config.ts under cli package)
QWEN_SANDBOX: config.command, // in case sandbox is enabled via flags (see config.ts under cli package)
},
},
);
@ -498,8 +498,8 @@ export async function start_sandbox(
// copy proxy environment variables, replacing localhost with SANDBOX_PROXY_NAME
// copy as both upper-case and lower-case as is required by some utilities
// GEMINI_SANDBOX_PROXY_COMMAND implies HTTPS_PROXY unless HTTP_PROXY is set
const proxyCommand = process.env['GEMINI_SANDBOX_PROXY_COMMAND'];
// QWEN_SANDBOX_PROXY_COMMAND implies HTTPS_PROXY unless HTTP_PROXY is set
const proxyCommand = process.env['QWEN_SANDBOX_PROXY_COMMAND'];
if (proxyCommand) {
let proxy =
@ -541,10 +541,10 @@ export async function start_sandbox(
// name container after image, plus random suffix to avoid conflicts
const imageName = parseImageName(image);
const isIntegrationTest =
process.env['GEMINI_CLI_INTEGRATION_TEST'] === 'true';
process.env['QWEN_CODE_INTEGRATION_TEST'] === 'true';
let containerName;
if (isIntegrationTest) {
containerName = `gemini-cli-integration-test-${randomBytes(4).toString(
containerName = `qwen-code-integration-test-${randomBytes(4).toString(
'hex',
)}`;
writeStderrLine(`ContainerName: ${containerName}`);
@ -563,11 +563,11 @@ export async function start_sandbox(
}
args.push('--name', containerName, '--hostname', containerName);
// copy GEMINI_CLI_TEST_VAR for integration tests
if (process.env['GEMINI_CLI_TEST_VAR']) {
// copy QWEN_CODE_TEST_VAR for integration tests
if (process.env['QWEN_CODE_TEST_VAR']) {
args.push(
'--env',
`GEMINI_CLI_TEST_VAR=${process.env['GEMINI_CLI_TEST_VAR']}`,
`QWEN_CODE_TEST_VAR=${process.env['QWEN_CODE_TEST_VAR']}`,
);
}
@ -716,7 +716,7 @@ export async function start_sandbox(
let userFlag = '';
const finalEntrypoint = entrypoint(workdir, cliArgs);
if (process.env['GEMINI_CLI_INTEGRATION_TEST'] === 'true') {
if (process.env['QWEN_CODE_INTEGRATION_TEST'] === 'true') {
args.push('--user', 'root');
userFlag = '--user root';
} else if (await shouldUseCurrentUserInSandbox()) {
@ -763,7 +763,7 @@ export async function start_sandbox(
// push container entrypoint (including args)
args.push(...finalEntrypoint);
// start and set up proxy if GEMINI_SANDBOX_PROXY_COMMAND is set
// start and set up proxy if QWEN_SANDBOX_PROXY_COMMAND is set
let proxyProcess: ChildProcess | undefined = undefined;
let sandboxProcess: ChildProcess | undefined = undefined;