Skip to content

Fix Gemini PR review trust workspace issue#3780

Merged
copybara-service[bot] merged 1 commit intomainfrom
gemini_fix
May 1, 2026
Merged

Fix Gemini PR review trust workspace issue#3780
copybara-service[bot] merged 1 commit intomainfrom
gemini_fix

Conversation

@RissyRan
Copy link
Copy Markdown
Collaborator

@RissyRan RissyRan commented Apr 30, 2026

Description

Fix Gemini PR review trust workspace issue, and also added Prepare prompt context step following by example.

Tests

  • Before the change: not triggering error
  • After the change: check comments bellow

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@github-actions
Copy link
Copy Markdown

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@github-actions
Copy link
Copy Markdown

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request refactors the Gemini code review workflow to use a more structured JSON-based context instead of environment variable interpolation, which is a positive change. It also updates several configurations, including the actions/checkout version and tool permissions.

🔍 General Feedback

  • Context Handling: The transition to @{.gemini/context.json} for input data is a significant improvement in how instructions receive PR context.
  • Security: Adding persist-credentials: 'false' to the checkout step is a good security practice.
  • Version Pinning: Please verify the usage of actions/checkout@v6, as v4 is currently the stable version.
  • Permissions: The shift to unrestricted shell commands (allowCommands: ["*"]) should be carefully evaluated against the principle of least privilege.

Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml Outdated
@github-actions
Copy link
Copy Markdown

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@AI-Hypercomputer AI-Hypercomputer deleted a comment from github-actions Bot Apr 30, 2026
@AI-Hypercomputer AI-Hypercomputer deleted a comment from github-actions Bot Apr 30, 2026
@AI-Hypercomputer AI-Hypercomputer deleted a comment from github-actions Bot Apr 30, 2026
@AI-Hypercomputer AI-Hypercomputer deleted a comment from github-actions Bot Apr 30, 2026
@AI-Hypercomputer AI-Hypercomputer deleted a comment from github-actions Bot Apr 30, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request successfully addresses the "trust workspace" issue in the Gemini PR review workflow by setting GEMINI_CLI_TRUST_WORKSPACE: 'true' and refactoring how context is passed to the CLI. The transition to using a JSON file for structured data and updating the workflow configuration to the latest CLI schema are positive improvements.

🔍 General Feedback

  • Security Hardening: While the move to JSON is good, the method of creating the JSON file using shell expansion poses a minor injection risk. Using jq's env object directly is recommended.
  • Configuration Alignment: The update to the shell tool configuration and the addition of the code-review extension align well with current best practices for the Gemini CLI.
  • Consistency: Consider a follow-up PR to unify the actions/checkout version across all workflows in the repository.

Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml Outdated
@github-actions
Copy link
Copy Markdown

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request aims to fix workspace trust issues for Gemini PR reviews and improves how prompt context is prepared. The transition to a JSON-based context file and the updated policy structure are positive improvements for security and maintainability.

🔍 General Feedback

  • Security: The use of GEMINI_CLI_TRUST_WORKSPACE: 'true' is appropriate for this context, but ensure that the workspace is indeed trusted.
  • Dependency Management: Be cautious with version tags for GitHub Actions; always prefer stable, verified releases (like v4 for checkout).
  • Policy: The shift from a generic core policy to a specific shell capability with explicit environment variables and commands is a great security improvement.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request aims to fix workspace trust issues for Gemini PR reviews and improves how prompt context is prepared. The transition to a JSON-based context file and the updated policy structure are positive improvements for security and maintainability.

🔍 General Feedback

  • Security: The use of GEMINI_CLI_TRUST_WORKSPACE: 'true' is appropriate for this context, but ensure that the workspace is indeed trusted.
  • Dependency Management: Be cautious with version tags for GitHub Actions; always prefer stable, verified releases (like v4 for checkout).
  • Policy: The shift from a generic core policy to a specific shell capability with explicit environment variables and commands is a great security improvement.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request aims to fix workspace trust issues for Gemini PR reviews and improves how prompt context is prepared. The transition to a JSON-based context file and the updated policy structure are positive improvements for security and maintainability.

🔍 General Feedback

  • Security: The use of GEMINI_CLI_TRUST_WORKSPACE: 'true' is appropriate for this context, but ensure that the workspace is indeed trusted.
  • Dependency Management: Be cautious with version tags for GitHub Actions; always prefer stable, verified releases (like v4 for checkout).
  • Policy: The shift from a generic core policy to a specific shell capability with explicit environment variables and commands is a great security improvement.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request aims to fix workspace trust issues for Gemini PR reviews and improves how prompt context is prepared. The transition to a JSON-based context file and the updated policy structure are positive improvements for security and maintainability.

🔍 General Feedback

  • Security: The use of GEMINI_CLI_TRUST_WORKSPACE: 'true' is appropriate for this context, but ensure that the workspace is indeed trusted.
  • Dependency Management: Be cautious with version tags for GitHub Actions; always prefer stable, verified releases (like v4 for checkout).
  • Policy: The shift from a generic core policy to a specific shell capability with explicit environment variables and commands is a great security improvement.

Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml
Comment thread .gemini/commands/gemini-review.toml
Comment thread .gemini/commands/gemini-review.toml
Copy link
Copy Markdown
Collaborator

@hengtaoguo hengtaoguo left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

Comment thread .github/workflows/gemini-review.yml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This Pull Request addresses the workspace trust issues and improves the security posture of the Gemini PR review workflow. The transition to a JSON-based context injection method is a cleaner and more structured approach than using multiple shell-based echo commands.

🔍 General Feedback

  • Security Improvements: The addition of GEMINI_CLI_TRUST_WORKSPACE: 'true' and the use of persist-credentials: 'false' are good security practices.
  • Context Injection: Moving towards a structured .gemini/context.json file simplifies the prompt definition and reduces reliance on shell environment variables.
  • Policy Granularity: The update to the shell tool policy is a positive step towards more restrictive and secure tool execution.

Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml
Comment thread .github/workflows/gemini-review.yml
Copy link
Copy Markdown
Collaborator

@gagika gagika left a comment

Choose a reason for hiding this comment

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

thanks

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.

5 participants