Skip to content

Commit d3bed1b

Browse files
Coly010FrozenPandaz
authored andcommitted
feat(core): handle agentic sandboxing (#34402)
## Current Behavior Running ai agents in sandbox mode causes issues with Nx's daemon and plugin isolation ## Expected Behavior Running ai agents in sandbox mode should work ## Related Issue(s) CLOSES NXA-828 (cherry picked from commit 6bf8c46)
1 parent 8bc5188 commit d3bed1b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

packages/nx/bin/nx.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@ import { performance } from 'perf_hooks';
2121
import { setupWorkspaceContext } from '../src/utils/workspace-context';
2222
import { daemonClient } from '../src/daemon/client/client';
2323
import { removeDbConnections } from '../src/utils/db-connection';
24+
import { isAiAgent } from '../src/native';
25+
26+
function handleAgenticSandbox() {
27+
const sandboxEnvVars = [
28+
'SANDBOX_RUNTIME',
29+
'CODEX_SANDBOX',
30+
'GEMINI_SANDBOX',
31+
'CURSOR_SANDBOX',
32+
];
33+
if (isAiAgent() && sandboxEnvVars.some((e) => process.env[e] !== undefined)) {
34+
process.env['NX_DAEMON'] = 'false';
35+
process.env['NX_ISOLATE_PLUGINS'] = 'false';
36+
}
37+
}
2438

2539
async function main() {
40+
handleAgenticSandbox();
2641
if (
2742
process.argv[2] !== 'report' &&
2843
process.argv[2] !== '--version' &&

0 commit comments

Comments
 (0)