Skip to content

Comments

fix(cli): allow interspersed args for cloud_run command to support#4563

Open
khushi0433 wants to merge 1 commit intogoogle:mainfrom
khushi0433:fix-cloud-run-verbosity
Open

fix(cli): allow interspersed args for cloud_run command to support#4563
khushi0433 wants to merge 1 commit intogoogle:mainfrom
khushi0433:fix-cloud-run-verbosity

Conversation

@khushi0433
Copy link

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):


Problem:

The cloud_run CLI command was rejecting the documented debug options:

  • --verbosity DEBUG
  • --log_level DEBUG

even though these options were defined and visible in the CLI help output.

When running:

python -m google.adk.cli deploy cloud_run . --verbosity DEBUG

the CLI previously returned:

`Error: Unexpected arguments: --verbosity DEBUG`

This created an inconsistency between the CLI documentation and its actual behavior.

The root cause was that the Click command definition had:

allow_interspersed_args=False

which prevented valid options from being parsed correctly when used alongside positional arguments such as AGENT.

Solution:

Updated the cloud_run command definition in:

src/google/adk/cli/cli_tools_click.py

to enable proper option parsing by changing:

context_settings={
"allow_extra_args": True,
"allow_interspersed_args": False,
}


to:

context_settings={
"allow_extra_args": True,
"allow_interspersed_args": True,
}


This allows Click to correctly recognize and process the documented debug flags.

This is a minimal, safe fix that restores expected CLI functionality and aligns behavior with the documentation.

Testing Plan

Unit Tests:

 I have added or updated unit tests for my change.

 All unit tests pass locally.

(No unit tests added since this is a CLI parsing configuration fix. Manual testing confirms correct behavior.)

Manual End-to-End (E2E) Tests:

Before fix

Command:

python -m google.adk.cli deploy cloud_run . --verbosity DEBUG

Result:

Error: Unexpected arguments: --verbosity DEBUG
After fix

Command:

python -m google.adk.cli deploy cloud_run . --verbosity DEBUG

Result:

WARNING: The --verbosity option is deprecated. Use --log_level instead.
Start generating Cloud Run source files...
Copying agent source code completed.
Creating Dockerfile...
Deploying to Cloud Run...

This confirms that the CLI now correctly recognizes and processes the debug flags.

Checklist

I have read the CONTRIBUTING.md document.
I have performed a self-review of my own code.
I have manually tested my changes end-to-end.
I have added tests that prove my fix is effective or that my feature works.
New and existing unit tests pass locally with my changes.
Any dependent changes have been merged and published in downstream modules.

Additional context

This fix resolves issue #4546 and restores consistency between CLI documentation and actual behavior.
The fix is minimal and only affects Click CLI argument parsing configuration.
No breaking changes introduced.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @khushi0433, 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 a critical usability issue within the cloud_run CLI command by correcting its argument parsing configuration. The change ensures that debug options are properly recognized, thereby improving the consistency and reliability of the command-line interface for users.

Highlights

  • CLI Argument Parsing Fix: Resolved an issue where the cloud_run CLI command incorrectly rejected valid debug options like --verbosity DEBUG and --log_level DEBUG due to allow_interspersed_args being set to False.
  • Enhanced CLI Usability: Enabled allow_interspersed_args for the cloud_run command, allowing Click to correctly parse options when mixed with positional arguments, aligning CLI behavior with documentation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/google/adk/cli/cli_tools_click.py
    • Updated the context_settings for the cloud_run command to set allow_interspersed_args to True.
Activity
  • Manual end-to-end testing was performed to confirm the fix, demonstrating correct processing of debug flags.
  • No new unit tests were added, as the change is a CLI parsing configuration fix.
  • The author performed a self-review and confirmed all checklist items, including reading the contribution guide and ensuring no breaking changes.
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.

@khushi0433 khushi0433 changed the title fix(cli): allow interspersed args for cloud_run command to support bug: #4546 fix(cli): allow interspersed args for cloud_run command to support Feb 20, 2026
@adk-bot adk-bot added the tools [Component] This issue is related to tools 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 correctly addresses the issue of interspersed arguments not being allowed in the cloud_run command by setting allow_interspersed_args=True. The fix is direct and effective. I have one minor suggestion regarding file formatting to adhere to Python's standard style guide.

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

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adk CLI: None of the 2 debug option --verbosity & --log_level works

2 participants