Summary
packages/cli/src/integration-tests/cli-args.integration.test.ts writes a fixture settings.json into Storage.getGlobalConfigDir() as returned in the test process environment. When LLXPRT_CONFIG_HOME is set and points at a real config directory (as it is in the driver sandboxes on this machine: LLXPRT_CONFIG_HOME=/Users/acoliver/Library/Preferences/llxprt-code), the suite overwrites the real user-global settings.json instead of an isolated temp dir.
Evidence (2026-09-06, branch-5 sandbox)
-
During a full npm run test run, the real $LLXPRT_CONFIG_HOME/settings.json was replaced at 15:50:35 (mid CLI test phase) with exactly the fixture content:
{"telemetry":{"logConversations":true}}
This matches the literal write in the two tests should print help even with invalid settings.json (--help) and should show config error (not silently fail) with invalid settings.json and no args (packages/cli/src/integration-tests/cli-args.integration.test.ts around L609-L645), which do:
const settingsDir = Storage.getGlobalConfigDir();
await fs.mkdir(settingsDir, { recursive: true });
await fs.writeFile(
path.join(settingsDir, 'settings.json'),
JSON.stringify({ telemetry: { logConversations: true } }),
);
Storage.getGlobalConfigDir() resolves through the LLXPRT_CONFIG_HOME override, so passing HOME: tempDir to the spawned CLI does not isolate this write.
-
Consequences observed: every subsequent CLI start in that environment fails validation (exit 52) until the file is manually reset; the two tests themselves also fail in that environment (reproduced identically on a clean main worktree).
-
On ephemeral CI runners the write lands in the runner's throwaway home, so CI stays green and the bug is invisible there.
Suggested direction
The fixture write must target a directory that is provably isolated for the test process itself (override LLXPRT_CONFIG_HOME per test to a temp dir, or write beneath the existing tempDir), not rely on the spawned process's HOME. A test should never write into the config dir the ambient environment resolves to.
Summary
packages/cli/src/integration-tests/cli-args.integration.test.tswrites a fixturesettings.jsonintoStorage.getGlobalConfigDir()as returned in the test process environment. WhenLLXPRT_CONFIG_HOMEis set and points at a real config directory (as it is in the driver sandboxes on this machine:LLXPRT_CONFIG_HOME=/Users/acoliver/Library/Preferences/llxprt-code), the suite overwrites the real user-global settings.json instead of an isolated temp dir.Evidence (2026-09-06, branch-5 sandbox)
During a full
npm run testrun, the real$LLXPRT_CONFIG_HOME/settings.jsonwas replaced at 15:50:35 (mid CLI test phase) with exactly the fixture content:{"telemetry":{"logConversations":true}}This matches the literal write in the two tests
should print help even with invalid settings.json (--help)andshould show config error (not silently fail) with invalid settings.json and no args(packages/cli/src/integration-tests/cli-args.integration.test.ts around L609-L645), which do:Storage.getGlobalConfigDir()resolves through theLLXPRT_CONFIG_HOMEoverride, so passingHOME: tempDirto the spawned CLI does not isolate this write.Consequences observed: every subsequent CLI start in that environment fails validation (exit 52) until the file is manually reset; the two tests themselves also fail in that environment (reproduced identically on a clean
mainworktree).On ephemeral CI runners the write lands in the runner's throwaway home, so CI stays green and the bug is invisible there.
Suggested direction
The fixture write must target a directory that is provably isolated for the test process itself (override
LLXPRT_CONFIG_HOMEper test to a temp dir, or write beneath the existingtempDir), not rely on the spawned process'sHOME. A test should never write into the config dir the ambient environment resolves to.