Skip to content

fix: increase project timeout and add manual entry in gws auth setup (closes #116)#233

Closed
NeekChaw wants to merge 1 commit intogoogleworkspace:mainfrom
NeekChaw:fix/setup-project-timeout-116
Closed

fix: increase project timeout and add manual entry in gws auth setup (closes #116)#233
NeekChaw wants to merge 1 commit intogoogleworkspace:mainfrom
NeekChaw:fix/setup-project-timeout-116

Conversation

@NeekChaw
Copy link

@NeekChaw NeekChaw commented Mar 6, 2026

Closes #116

…(closes #116)

Users who belong to organizations with thousands of GCP projects would hit the hardcoded 10-second timeout in gws auth setup when the CLI attempted to list their projects, blocking them from completing setup without manually using --project.

This PR improves the experience for these users by:

  1. Increasing the project listing timeout from 10s to 30s
  2. Adding a new '✏️ Enter existing project ID' option to the interactive project picker.

Description

Please include a summary of the change and which issue is fixed. If adding a new feature or command, please include the output of running it with --dry-run to prove the JSON request body matches the Discovery Document schema.

Dry Run Output:

// Paste --dry-run output here if applicable

Checklist:

  • My code follows the AGENTS.md guidelines (no generated google-* crates).
  • I have run cargo fmt --all to format the code perfectly.
  • I have run cargo clippy -- -D warnings and resolved all warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have provided a Changeset file (e.g. via pnpx changeset) to document my changes.

…loses googleworkspace#116)

Users who belong to organizations with thousands of GCP projects would hit
the hardcoded 10-second timeout in gws auth setup when the CLI attempted
to list their projects, blocking them from completing setup without manually
using --project.

This PR improves the experience for these users by:
1. Increasing the project listing timeout from 10s to 30s
2. Adding a new '✏️ Enter existing project ID' option to the interactive project picker.
@google-cla
Copy link

google-cla bot commented Mar 6, 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.

@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

🦋 Changeset detected

Latest commit: d66f087

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
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 significantly improves the gws auth setup experience for users managing numerous GCP projects. By increasing the project listing timeout and introducing a manual project ID entry option, it resolves issues where users were blocked from completing setup due to project enumeration delays or missing projects in the interactive list.

Highlights

  • Project Listing Timeout Increased: The timeout for listing GCP projects during gws auth setup has been extended from 10 seconds to 30 seconds. This change improves the experience for users belonging to organizations with a large number of GCP projects, preventing timeouts during project enumeration.
  • Manual Project ID Entry Option: A new option, '✏️ Enter existing project ID', has been added to the interactive project picker. This allows users to manually input a project ID if their desired project is not displayed in the automatically listed options, addressing cases where API limits or dropouts might occur.
Changelog
  • .changeset/fix-setup-project-timeout.md
    • Added a new changeset entry detailing the timeout increase and manual project ID feature.
  • src/setup.rs
    • Increased the project listing timeout from 10 seconds to 30 seconds.
    • Updated the timeout error message to reflect the new 30-second limit.
    • Introduced a new interactive option in the project picker to manually enter an existing project ID.
    • Implemented the logic to handle the manual project ID entry, including input validation and setting the chosen project.
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 Generative AI Prohibited Use Policy, 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
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 increases the project listing timeout and adds an option to manually enter a project ID. My review focuses on improving maintainability. I've suggested defining the timeout value as a constant to avoid inconsistencies, and refactoring some duplicated logic that was expanded in this PR. Addressing these points would make the code easier to manage in the future.

return (
Vec::new(),
Some("Timed out listing projects (10s)".to_string()),
Some("Timed out listing projects (30s)".to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The timeout value 30 is hardcoded here. It's also hardcoded on line 549 where the duration is set. This can lead to inconsistencies if the value is changed in one place but not the other. It would be better to define a constant for the timeout and use it to format this message.

For example:

// At the top of `list_gcloud_projects`
const LIST_PROJECTS_TIMEOUT_SECS: u64 = 30;

// ... in the function
let timeout = std::time::Duration::from_secs(LIST_PROJECTS_TIMEOUT_SECS);

// ... later in the function
return (
    Vec::new(),
    Some(format!("Timed out listing projects ({}s)", LIST_PROJECTS_TIMEOUT_SECS)),
);

Comment on lines +1035 to +1055
Some(item) if item.label.starts_with("✏️") => {
let project_id = match ctx
.wizard
.as_mut()
.unwrap()
.show_input("Enter GCP project", "Enter an existing project ID", None)
.map_err(|e| GwsError::Validation(format!("TUI error: {e}")))?
{
crate::setup_tui::InputResult::Confirmed(v) if !v.is_empty() => v,
_ => {
return Err(GwsError::Validation(
"Project selection cancelled by user".to_string(),
))
}
};

set_gcloud_project(&project_id)?;
ctx.wiz(2, StepStatus::Done(project_id.clone()));
ctx.project_id = project_id;
Ok(SetupStage::EnableApis)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This new logic for manually entering a project ID introduces some code duplication that's also present in other arms of this match statement. To improve maintainability, consider a couple of refactorings:

  1. The logic for getting user input (lines 1036-1049) is very similar to the logic for getting a new project name (lines 1057-1070). This could be extracted into a helper function.

  2. The final block of code (lines 1051-1054) that sets the project and advances the stage is identical to the logic in the other match arms. This could be moved outside the match statement to run after the project_id has been determined.

Applying these refactorings would make the code more DRY and easier to maintain in the future.

@NeekChaw
Copy link
Author

NeekChaw commented Mar 6, 2026

Closing this PR - the same fix (30s timeout + manual project ID entry) has already been merged into main by the maintainers. Will follow up with a separate small PR addressing the code review suggestions (extracting timeout constant + refactoring duplicated input logic). Thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need the project listing timeout to be longer OR allow the user to enter their own project ID

2 participants