Skip to content

fix: block insert env param to gemini(eg: gemini_api_key form json co…#283

Open
Next2012 wants to merge 1 commit intotiann:mainfrom
Next2012:fix_block_gemini_env
Open

fix: block insert env param to gemini(eg: gemini_api_key form json co…#283
Next2012 wants to merge 1 commit intotiann:mainfrom
Next2012:fix_block_gemini_env

Conversation

@Next2012
Copy link
Contributor

GeminiCLI can automatically obtain authorization, whether by retrieving the API_KEY from environment variables or by logging in with a Google account. This statement indicates that the extracted GEMINI_API_KEY will override the normal account login, thereby significantly reducing the quota of paid versions (such as Google AI Pro).

…nfig), which will cause google auth account tigger using limit
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Review mode: initial
Major: ACP Gemini env no longer passes hook settings or project dir to Gemini CLI; remote sessions can lose hooks and project context (see inline).
Testing: Not run (automation)

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;
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant