Skip to content

Comments

Fixes 'input.on' is not a function error in Gemini CLI#19691

Merged
mattKorwel merged 1 commit intomainfrom
gundermanc/fix
Feb 20, 2026
Merged

Fixes 'input.on' is not a function error in Gemini CLI#19691
mattKorwel merged 1 commit intomainfrom
gundermanc/fix

Conversation

@gundermanc
Copy link
Member

@gundermanc gundermanc commented Feb 20, 2026

Summary

Fixes an error that blocks the ability to use Gemini CLI when authenticated with a Google account. User types in a message and is confronted by an unhandled error.

This is another case of the codebase using casts (as keyword) to override the type system, leading to a failure at runtime instead of a compilation error, as code and dependencies change.

I have filed the following item to track eliminating these code smells: #19440

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gundermanc, 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 delivers a crucial fix for a runtime error that was blocking the Gemini CLI's functionality for authenticated users. By refining how the application handles input streams, it enhances the overall stability and reliability of the CLI. Additionally, the changes introduce more detailed telemetry for file modifications, offering better insights into automated code edits.

Highlights

  • Critical Bug Fix: Resolved a critical runtime error ('input.on' is not a function) that prevented the Gemini CLI from functioning correctly when authenticated with a Google account, specifically when handling user input streams.
  • Improved Stream Handling: Refactored the internal stream processing within CodeAssistServer to correctly handle ReadableStream objects, eliminating reliance on problematic type assertions and ensuring compatibility with various stream types.
  • Enhanced Telemetry for File Edits: Extended the telemetry system to capture and report the number of lines added and removed by model-driven file edits, providing more granular insights into agentic interactions.
  • Increased Type Safety: Addressed a 'code smell' by replacing a problematic type cast with a more robust and type-safe approach for handling input streams, preventing future runtime failures related to type mismatches.
  • New Test Coverage: Added a new test case to validate the generateContentStream method's ability to correctly process Web ReadableStream responses, ensuring the stability of the stream handling logic.
Changelog
  • packages/core/src/code_assist/server.test.ts
    • Added a new test case to verify generateContentStream correctly handles Web ReadableStream.
  • packages/core/src/code_assist/server.ts
    • Imported Readable from node:stream to facilitate proper stream handling.
    • Updated the client.request call with a type argument for better type safety.
    • Modified readline.createInterface to use Readable.from(res.data) instead of a direct type assertion, resolving the 'input.on' error.
  • packages/core/src/code_assist/telemetry.test.ts
    • Extended mock CompletedToolCall data to include response with resultDisplay and diffStat for testing purposes.
    • Updated expected ConversationInteraction in tests to include acceptedLines and removedLines.
  • packages/core/src/code_assist/telemetry.ts
    • Imported computeModelAddedAndRemovedLines and getFileDiffFromResultDisplay for calculating line changes.
    • Initialized acceptedLines and removedLines variables within summarizeToolCalls.
    • Updated summarizeToolCalls to calculate and accumulate addedLines and removedLines for successful edit tool calls.
    • Modified createConversationInteraction to accept and include acceptedLines and removedLines in the telemetry event.
  • packages/core/src/code_assist/types.ts
    • Added removedLines as an optional string property to the ConversationInteraction interface.
  • packages/core/src/utils/fileDiffUtils.ts
    • Imported DiffStat type for more precise type definitions.
    • Refined getFileDiffFromResultDisplay to directly check for diffStat existence.
    • Updated the type signature of computeModelAddedAndRemovedLines to use DiffStat.
Activity
  • No human activity recorded yet.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@gundermanc gundermanc marked this pull request as ready for review February 20, 2026 19:43
@gundermanc gundermanc requested a review from a team as a code owner February 20, 2026 19:43
@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 20, 2026
Copy link
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 effectively resolves a critical runtime error ('input.on' is not a function) that occurred when using Google account authentication. The fix correctly replaces an unsafe type cast with Readable.from(), ensuring that both Node.js and Web API streams are handled properly. The addition of a new test case to cover this scenario is a great practice. However, this PR also includes unrelated changes to add new telemetry for edit tool statistics. While these changes are correct, they violate the repository's convention of keeping pull requests small and focused, as noted in the specific comment.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/core/src/code_assist/telemetry.ts (25-28)

high

While the main purpose of this PR is to fix a runtime error with streams, it also introduces new telemetry for tracking added/removed lines from edit tools. According to the repository's development conventions, pull requests should be small and focused. Bundling a bug fix with a new feature makes the PR harder to review and can complicate rollbacks if needed. Please consider splitting these changes into separate pull requests in the future.

References
  1. The repository style guide recommends that pull requests should be small and focused. This pull request combines a bug fix with a new telemetry feature, which should ideally be in separate pull requests. (link)

@github-actions
Copy link

Size Change: -1.45 kB (-0.01%)

Total Size: 25.2 MB

Filename Size Change
./bundle/gemini.js 25.2 MB -1.45 kB (-0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

@mattKorwel mattKorwel enabled auto-merge February 20, 2026 19:50
@mattKorwel mattKorwel added this pull request to the merge queue Feb 20, 2026
Merged via the queue into main with commit 7cf4c05 Feb 20, 2026
30 checks passed
@mattKorwel mattKorwel deleted the gundermanc/fix branch February 20, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants