Skip to content

Code Review Workflow Silently Fails when it tries to prompt a question to a user #278

Closed

Description

@dkoenawan

TL;DR

Pull Request Review "succeeds" but did not leave any review comments in the Pull Requests.

Image

Expected behavior

Gemini PR to leave pull request review when triggered on the pull request and does not silently fail.

Observed behavior

Gemini PR did not leave a pull request review when triggered and silently fail.

Action YAML

name: '🔀 Gemini Dispatch'

on:
  pull_request:
    types:
      - 'opened'
      - 'synchronize'

defaults:
  run:
    shell: 'bash'

jobs:
  debugger:
    if: |-
     ${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}
    runs-on: 'ubuntu-latest'
    permissions:
      contents: 'read'
    steps:
      - name: 'Print context for debugging'
        env:
          DEBUG_event_name: '${{ github.event_name }}'
          DEBUG_event__action: '${{ github.event.action }}'
          DEBUG_event__comment__author_association: '${{ github.event.comment.author_association }}'
          DEBUG_event__issue__author_association: '${{ github.event.issue.author_association }}'
          DEBUG_event__pull_request__author_association: '${{ github.event.pull_request.author_association }}'
          DEBUG_event__review__author_association: '${{ github.event.review.author_association }}'
          DEBUG_event: '${{ toJSON(github.event) }}'
        run: |-
          env | grep '^DEBUG_'
  dispatch:
    # For PRs: only if not from a fork
    # For comments: only if user types @gemini-cli and is OWNER/MEMBER/COLLABORATOR
    # For issues: only on open/reopen
    if: |-
      (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.fork == false
      ) || (
        github.event.sender.type == 'User' &&
        startsWith(github.event.comment.body || github.event.review.body || github.event.issue.body, '@gemini-cli') &&
        contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association || github.event.review.author_association || github.event.issue.author_association)
      ) || (
        github.event_name == 'issues' &&
        contains(fromJSON('["opened", "reopened"]'), github.event.action)
      )
    runs-on: 'ubuntu-latest'
    permissions:
      contents: 'read'
      issues: 'write'
      pull-requests: 'write'
    outputs:
      command: '${{ steps.extract_command.outputs.command }}'
      request: '${{ steps.extract_command.outputs.request }}'
      additional_context: '${{ steps.extract_command.outputs.additional_context }}'
      issue_number: '${{ github.event.pull_request.number || github.event.issue.number }}'
    steps:
      - name: 'Mint identity token'
        id: 'mint_identity_token'
        if: |-
          ${{ vars.APP_ID }}
        uses: 'actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b' # ratchet:actions/create-github-app-token@v2
        with:
          app-id: '${{ vars.APP_ID }}'
          private-key: '${{ secrets.APP_PRIVATE_KEY }}'
          permission-contents: 'read'
          permission-issues: 'write'
          permission-pull-requests: 'write'

      - name: 'Extract command'
        id: 'extract_command'
        uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7
        env:
          EVENT_TYPE: '${{ github.event_name }}.${{ github.event.action }}'
          REQUEST: '${{ github.event.comment.body || github.event.review.body || github.event.issue.body }}'
        with:
          script: |
            const request = process.env.REQUEST;
            const eventType = process.env.EVENT_TYPE
            core.setOutput('request', request);
            if (request.startsWith("@gemini-cli /review")) {
              core.setOutput('command', 'review');
              const additionalContext = request.replace(/^@gemini-cli \/review/, '').trim();
              core.setOutput('additional_context', additionalContext);
            } else if (request.startsWith("@gemini-cli /triage")) {
              core.setOutput('command', 'triage');
            } else if (request.startsWith("@gemini-cli")) {
              core.setOutput('command', 'invoke');
              const additionalContext = request.replace(/^@gemini-cli/, '').trim();
              core.setOutput('additional_context', additionalContext);
            } else if (eventType === 'pull_request.opened' || eventType === 'pull_request.synchronize') {
              core.setOutput('command', 'review');
            } else if (['issues.opened', 'issues.reopened'].includes(eventType)) {
              core.setOutput('command', 'triage');
            } else {
              core.setOutput('command', 'fallthrough');
            }
      - name: 'Acknowledge request'
        env:
          GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}'
          ISSUE_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}'
          MESSAGE: |-
            🤖 Hi @${{ github.actor }}, I've received your request, and I'm working on it now! You can track my progress [in the logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
          REPOSITORY: '${{ github.repository }}'
        run: |-
          gh issue comment "${ISSUE_NUMBER}" \
            --body "${MESSAGE}" \
            --repo "${REPOSITORY}"
  review:
    needs: 'dispatch'
    if: |-
      ${{ needs.dispatch.outputs.command == 'review' }}
    uses: './.github/workflows/gemini-review.yml'
    permissions:
      contents: 'read'
      id-token: 'write'
      issues: 'write'
      pull-requests: 'write'
    with:
      additional_context: '${{ needs.dispatch.outputs.additional_context }}'
    secrets: 'inherit'

  triage:
    needs: 'dispatch'
    if: |-
      ${{ needs.dispatch.outputs.command == 'triage' }}
    uses: './.github/workflows/gemini-triage.yml'
    permissions:
      contents: 'read'
      id-token: 'write'
      issues: 'write'
      pull-requests: 'write'
    with:
      additional_context: '${{ needs.dispatch.outputs.additional_context }}'
    secrets: 'inherit'

  invoke:
    needs: 'dispatch'
    if: |-
      ${{ needs.dispatch.outputs.command == 'invoke' }}
    uses: './.github/workflows/gemini-invoke.yml'
    permissions:
      contents: 'read'
      id-token: 'write'
      issues: 'write'
      pull-requests: 'write'
    with:
      additional_context: '${{ needs.dispatch.outputs.additional_context }}'
    secrets: 'inherit'

  fallthrough:
    needs:
      - 'dispatch'
      - 'review'
      - 'triage'
      - 'invoke'
    if: |-
      ${{ always() && !cancelled() && (failure() || needs.dispatch.outputs.command == 'fallthrough') }}
    runs-on: 'ubuntu-latest'
    permissions:
      contents: 'read'
      issues: 'write'
      pull-requests: 'write'
    steps:
      - name: 'Mint identity token'
        id: 'mint_identity_token'
        if: |-
          ${{ vars.APP_ID }}
        uses: 'actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b' # ratchet:actions/create-github-app-token@v2
        with:
          app-id: '${{ vars.APP_ID }}'
          private-key: '${{ secrets.APP_PRIVATE_KEY }}'
          permission-contents: 'read'
          permission-issues: 'write'
          permission-pull-requests: 'write'

      - name: 'Send failure comment'
        env:
          GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}'
          ISSUE_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}'
          MESSAGE: |-
            🤖 I'm sorry @${{ github.actor }}, but I was unable to process your request. Please [see the logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
          REPOSITORY: '${{ github.repository }}'
        run: |-
          gh issue comment "${ISSUE_NUMBER}" \
            --body "${MESSAGE}" \
            --repo "${REPOSITORY}"

Log output

##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/d6f015c1-3ee9-4e5f-a401-8954f55d971f.sh
##[debug]Set output gemini_response = Okay, I'll use the ticket number for the duration of this session. I will now begin the code review by gathering the necessary information about the pull request, starting with the environment variables.I am ready to start the code review, but I need the repository name and pull request number. Please provide them.
##[debug]Set output gemini_errors = Error executing tool run_shell_command: Command(s) not in the allowed commands list. Disallowed commands: "env"
##[debug]Finished: run
##[debug]Evaluating: steps.gemini_run.outputs.gemini_response
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating steps:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'gemini_run'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'outputs'
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'gemini_response'

Additional information

I copied only the relevant log file, but it seems that there are two problems:

  1. It hallucinates a ticket number, and when it fails to find the ticket number, it silently fails.
    Upon further investigation, this is due to our repository Gemini.md, which requires our local coding agent to branch out with a ticket number to commit their changes. We have to comment out this line to make the GitHub action pipeline work. Is there a way we can prevent either Gemini from trying to prompt a question to the user or prevent it from silently failing?

  2. Error executing tool run_shell_command: Command(s) not in the allowed commands list. Disallowed commands: "env". It does not have shell access to envI've tested this by addingenv` in the core tool, and the pipeline works. Should this be added as a default core tool?

Activity

  1. gemini-cli commented on Sep 15, 2025

    @gemini-cli
    Contributor

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

  2. added this to the v0.1.14 milestone on Sep 16, 2025
  3. modified the milestones: v0.1.14, v0.1.15 on Oct 23, 2025
  4. MJjainam commented on Nov 17, 2025

    @MJjainam
    Contributor

    @dkoenawan This must be fixed as part of bug bash in Gemini CLI.
    Is it working as expected for you now?

  5. removed this from the v0.1.15 milestone on Nov 18, 2025
  6. MayV commented on Dec 1, 2025

    @MayV

    /assign

  7. MayV commented on Dec 4, 2025

    @MayV

    Hi @dkoenawan
    I tried to reproduce the issue but I am unable to. I see gemini always responding.

    Regarding your comment for enabling run_shell_command(env), you can enable that tool in the settings variable present inside the workflows cloned in your repository.

  8. MJjainam commented on Dec 4, 2025

    @MJjainam
    Contributor

    Closing as not reproducible. If you face it again, please re-open

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions