Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions cli/src/gemini/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,7 @@ export function buildGeminiEnv(opts: {
hookSettingsPath?: string;
cwd?: string;
}): NodeJS.ProcessEnv {
const env: NodeJS.ProcessEnv = {
return {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MAJOR] buildGeminiEnv now ignores hookSettingsPath and cwd, so the ACP Gemini process no longer receives GEMINI_CLI_SYSTEM_SETTINGS_PATH or GEMINI_PROJECT_DIR. That disables hook server config and can put remote sessions in the wrong project context (ACP spawn has no cwd). Evidence: cli/src/gemini/utils/config.ts:104-112.

Suggested fix:

export function buildGeminiEnv(opts: {
    model?: string;
    token?: string;
    hookSettingsPath?: string;
    cwd?: string;
}): NodeJS.ProcessEnv {
    const env: NodeJS.ProcessEnv = { ...process.env };

    if (opts.hookSettingsPath) {
        env.GEMINI_CLI_SYSTEM_SETTINGS_PATH = opts.hookSettingsPath;
    }
    if (opts.cwd) {
        env.GEMINI_PROJECT_DIR = opts.cwd;
    }

    return env;
}

...process.env
};

if (opts.model) {
env[GEMINI_MODEL_ENV] = opts.model;
}

if (opts.token && !env[GEMINI_API_KEY_ENV] && !env[GOOGLE_API_KEY_ENV]) {
env[GEMINI_API_KEY_ENV] = opts.token;
}

if (opts.hookSettingsPath) {
env.GEMINI_CLI_SYSTEM_SETTINGS_PATH = opts.hookSettingsPath;
}

if (opts.cwd) {
env.GEMINI_PROJECT_DIR = opts.cwd;
}

return env;
}
Loading