Skip to content

fix(start): strip CI_* env vars in dev mode to prevent interactive hang#25649

Open
fuleinist wants to merge 1 commit intogoogle-gemini:mainfrom
fuleinist:fix/ci-env-var-scrub-dev-mode
Open

fix(start): strip CI_* env vars in dev mode to prevent interactive hang#25649
fuleinist wants to merge 1 commit intogoogle-gemini:mainfrom
fuleinist:fix/ci-env-var-scrub-dev-mode

Conversation

@fuleinist
Copy link
Copy Markdown

Summary

When running npm run start with CI_* env vars present (e.g. CI_TOKEN), the is-in-ci package (used by ink UI framework) detects them and switches to non-interactive mode, causing the CLI to hang after the ASCII art header.

The bundled build handles this via an esbuild alias to a stub is-in-ci module that always returns false. However, dev mode (npm run start) bypasses esbuild, so the real is-in-ci package is loaded and the hang occurs.

Fix

In scripts/start.js, strip any CI_* prefixed env vars from the env object before spawning the child process — matching the bundled behavior. Also prints a clear warning so developers know which vars were removed and that they remain available in spawned shell tools.

Testing

  1. export CI_TOKEN=anything
  2. npm run start
  3. Before fix: hangs after ASCII art, no prompt
  4. After fix: warning printed, interactive prompt appears normally

Related

…de hang

When running npm run start with CI_* env vars present (e.g. CI_TOKEN),
the is-in-ci package (used by ink) detects them and switches to
non-interactive mode, causing the CLI to hang after the ASCII art header.

The bundled build handles this via esbuild alias to a stub is-in-ci module,
but dev mode bypasses esbuild. This fix strips CI_* vars from the env
passed to the child process in scripts/start.js, matching the bundled
behavior.

Also prints a clear warning so developers know which vars were removed
and that they remain available in spawned shell tools.

Fixes google-gemini#22452.
@fuleinist fuleinist requested a review from a team as a code owner April 19, 2026 06:09
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@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 addresses an issue where the development environment incorrectly detects a CI context due to the presence of 'CI_*' environment variables. By filtering these variables out during the startup process, the application is forced into interactive mode, ensuring that the CLI functions as expected locally without hanging.

Highlights

  • Environment Variable Filtering: Implemented a mechanism in the development startup script to strip environment variables prefixed with 'CI_'.
  • Interactive Mode Restoration: Prevents the 'is-in-ci' package from incorrectly triggering non-interactive mode during local development, resolving CLI hangs.
  • Developer Feedback: Added console warnings to inform developers when CI-related variables are removed, ensuring transparency regarding the environment state.
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.

Copy link
Copy Markdown
Contributor

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

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 modifies scripts/start.js to filter out environment variables starting with CI_ from the development environment. This change ensures that the ink library remains in interactive mode during development by preventing the detection of a CI environment. I have no feedback to provide.

@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 19, 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 help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

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

1 participant