Skip to content

Fix cli_help output to return only answer field [issue: #19463]#19620

Open
aashishgrinds wants to merge 1 commit intogoogle-gemini:mainfrom
aashishgrinds:fix/cli-help-output
Open

Fix cli_help output to return only answer field [issue: #19463]#19620
aashishgrinds wants to merge 1 commit intogoogle-gemini:mainfrom
aashishgrinds:fix/cli-help-output

Conversation

@aashishgrinds
Copy link
Copy Markdown

Summary
Fixes CLI output formatting when delegating to the cli_help subagent. Previously, the CLI would output the full JSON object including internal metadata like sources. Now it only outputs the actual answer text to users, eliminating confusing internal reasoning text.

Details
The cli_help agent was using processOutput: (output) => JSON.stringify(output, null, 2) which returned the complete response object. Changed to processOutput: (output) => output.answer to return only the user-facing answer. This affects only the final display output - internal agent logic and schema validation remain unchanged.

Updated the corresponding unit test to expect only the answer field instead of the full JSON string.

Related Issues
Fixes #19463 - CLI prints internal reasoning text when delegating to cli_help subagent instead of only showing the answer.
Screenshot 2026-02-20 120333

Fixed this as you can see in the screenshot above

NOTE:-
Not validated on MacOS/Linux (Windows only).

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

@aashishgrinds aashishgrinds requested a review from a team as a code owner February 20, 2026 07:01
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @aashishgrinds, 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 cli_help subagent was outputting full JSON objects, including internal metadata, directly to the command line. The change ensures that users only see the relevant answer text, significantly improving the clarity and user-friendliness of the CLI output without altering the agent's internal logic or schema validation.

Highlights

  • CLI Output Formatting: The cli_help subagent's output has been refined to display only the answer text, removing internal metadata and sources from the command-line interface.
  • processOutput Logic Update: The processOutput function in cli-help-agent.ts was changed from JSON.stringify(output, null, 2) to output.answer to achieve the desired output.
  • Unit Test Alignment: The corresponding unit test for CliHelpAgent was updated to reflect the new processOutput behavior, now expecting only the answer string.
Changelog
  • packages/core/src/agents/cli-help-agent.test.ts
    • Updated the test case should process output to a formatted JSON string to should process output to return only the answer field, and adjusted its assertion to expect only the answer string.
  • packages/core/src/agents/cli-help-agent.ts
    • Modified the processOutput function to return output.answer instead of JSON.stringify(output, null, 2).
Activity
  • The author updated a unit test to align with the new output processing logic.
  • The author performed self-validation on Windows using npm run and npx.
  • The author provided a screenshot demonstrating the fix.
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.

@aashishgrinds aashishgrinds changed the title Fix cli_help output to return only answer field Fix cli_help output to return only answer field Fixes #19463 Feb 20, 2026
@aashishgrinds aashishgrinds changed the title Fix cli_help output to return only answer field Fixes #19463 Fix cli_help output to return only answer field [issue: #19463] Feb 20, 2026
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

The pull request successfully addresses the issue where the cli_help agent was outputting a full JSON object to the terminal. By updating the processOutput function to return only the answer field, the user experience is improved with cleaner, text-only responses. The corresponding unit tests have been updated to verify this change. No high or critical severity issues were identified during the review.

@gemini-cli gemini-cli Bot added the 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini CLI issues presenting answer from cli_help subagent

1 participant