Skip to content

fix(dev): scrub CI env vars when running locally - #25287

Closed
aniruddhaadak80 wants to merge 2 commits into
google-gemini:mainfrom
aniruddhaadak80:fix-22452
Closed

fix(dev): scrub CI env vars when running locally#25287
aniruddhaadak80 wants to merge 2 commits into
google-gemini:mainfrom
aniruddhaadak80:fix-22452

Conversation

@aniruddhaadak80

@aniruddhaadak80 aniruddhaadak80 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Resolves #22452. In dev mode (npm run start), the CLI silently hangs if any environment variable with a CI_ prefix is set. This checks and ignores them during bootstrap.

@aniruddhaadak80
aniruddhaadak80 requested a review from a team as a code owner April 13, 2026 13:49
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the local development experience by preventing CI-specific environment variables from interfering with interactive processes. By automatically scrubbing these variables upon startup, the script ensures a more consistent local environment, while still providing an opt-out mechanism for specific use cases.

Highlights

  • CI Environment Variable Scrubbing: Implemented a mechanism to automatically remove CI-related environment variables when running the development script locally to ensure proper interactive mode behavior.
  • Opt-out Mechanism: Added a new flag --no-interactive-check that allows users to bypass the automatic scrubbing of CI environment variables.
  • User Feedback: Added console error messages to inform the user when CI variables have been removed and how to suppress the check.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates scripts/start.js to automatically scrub CI-related environment variables (such as CI, CONTINUOUS_INTEGRATION, and those starting with CI_) from the environment configuration unless the --no-interactive-check flag is provided. This change ensures the CLI can operate in interactive mode even when detected in a CI environment, while providing console feedback about the removed variables. I have no feedback to provide as there were no review comments.

@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 13, 2026
@pmenic

pmenic commented May 10, 2026

Copy link
Copy Markdown
Contributor

Hi @aniruddhaadak80 — quick heads-up: I opened a near-identical PR (#26838) for #22452 yesterday without first searching for prior PRs, my bad. I'm closing mine in favor of this one since you got there first.

While iterating on #26838 with a reviewer I picked up two correctness points that I think also apply here — sharing them so you can roll them in if you agree:

1. Scope can be narrowed to CI / CONTINUOUS_INTEGRATION. The is-in-ci pinned in this repo is 2.0.0 (node_modules/ink/node_modules/is-in-ci/index.js), and its source is exactly:

const check = (key) => key in env && env[key] !== '0' && env[key] !== 'false';
const isInCi = check('CI') || check('CONTINUOUS_INTEGRATION');

There is no CI_* prefix check at this version — the issue body's claim that CI_TOKEN=anything triggers the hang doesn't match what is-in-ci@2.0.0 actually does. As written, the current diff scrubs legitimate developer tokens like CI_TOKEN / CI_BUILD_ID from both the CLI process and its shell-tool subprocesses unnecessarily.

2. Mirror is-in-ci's truthiness rule. A developer who explicitly sets CI=0 to mark "not in CI" should be a no-op (currently it would be stripped + warned about).

3. Warning copy. The line "These variables are still available in processes spawned by shell tools" doesn't match the implementation — once the var is deleted from the spawn env it's gone from grandchildren too. Worth either flipping the message to "unset in the CLI process and its shell-tool subprocesses" or actually preserving the vars via a side channel + re-injecting at spawn time (the latter is more invasive).

If it helps, the post-review diff I had landed in #26838 covers points 1+2+3 and is happy to be cherry-picked or just used as reference: https://github.com/google-gemini/gemini-cli/pull/26838/files

No urgency from my side — just wanted to leave the trail for whoever picks this up next.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/security Issues related to security labels May 13, 2026
@scidomino

Copy link
Copy Markdown
Collaborator

closing in favor of #27159

@scidomino scidomino closed this May 20, 2026
@sripasg sripasg added the size/s A small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality area/security Issues related to security help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release. size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: CI_* env var scrub not applied in dev mode (npm run start) — interactive mode hangs

5 participants