Skip to content

cli-args integration tests write fixture settings.json into the real global config dir when LLXPRT_CONFIG_HOME is set #3581

Description

@acoliver

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci/cdIssues with github and the workflow scripts and CI CD environment.configurationllxprt system configurationdevelopmenttools and features that make it easier to test/develop LLxprt Code itself

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions