Skip to content

Conversation

@sehoon38
Copy link
Contributor

@sehoon38 sehoon38 commented Jan 27, 2026

Summary

This PR enhances the Triage Duplicates tool by showing the state (e.g., OPEN/CLOSED) and stateReason (e.g., duplicate, not planned) for candidate issues. It also detects and highlights if a candidate issue has already been marked as a duplicate of the current target issue, if it was marked as duplicated by this command tool. (does not detect the ones updated from the UI)

Details

image
  • Added fields: state and stateReason to the Issue and Candidate interfaces.
  • Updated fetching: gh issue list and gh issue view calls now include state and stateReason in the JSON response.
  • UI Enhancement:
    • Displays [STATE - stateReason] next to candidate issue numbers.
    • Scans comments for "duplicate of #<target_issue_number>" and displays a bold red [DUPLICATE OF CURRENT] label if found.
    • Color coding: Green for OPEN, Red for others.

Related Issues

Fixes #17662

How to Validate

  1. Run the CLI in development mode: npm run start -- triage.
  2. Observe the candidate list.
  3. Verify that candidate issues show their state (e.g., [OPEN], [CLOSED - completed]).
  4. If a candidate is a duplicate of the current issue (check comments), verify the [DUPLICATE OF CURRENT] warning appears.

Pre-Merge Checklist

  • Validated on MacOS

@sehoon38 sehoon38 requested a review from a team as a code owner January 27, 2026 17:05
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sehoon38, 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 introduces a new oncall command to the CLI, specifically designed to aid on-call engineers in triaging duplicate issues. It integrates a sophisticated Triage Duplicates tool that leverages LLM analysis to provide intelligent recommendations, enhancing the efficiency and accuracy of issue management. The UI is designed for interactive issue assessment, providing key information and actions at the user's fingertips.

Highlights

  • Feature Enhancement: The PR introduces an oncall command with a dedup subcommand to triage issues labeled as status/possible-duplicate, enhancing the CLI's capabilities for on-call engineers.
  • UI Improvements: The Triage Duplicates tool now displays the state and stateReason for candidate issues, along with a visual indicator if a candidate is already marked as a duplicate of the current target issue.
  • LLM Integration: The triage process is augmented with LLM-based analysis to provide recommendations on whether to mark issues as duplicates, identify canonical issues, and suggest comments.
  • Navigation and Interaction: The Triage Duplicates UI includes improved navigation with focus sections, scrolling, and actions like marking duplicates, removing labels, and skipping issues.
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.

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 introduces a new /oncall dedup command for triaging duplicate GitHub issues using LLM analysis. A critical prompt injection vulnerability has been identified where unsanitized issue content is passed to the LLM, potentially allowing an attacker to manipulate the bot's behavior, such as posting arbitrary comments or incorrectly closing issues. Additionally, the tool's usability is limited by a hardcoded repository. Addressing these points will significantly improve the tool's robustness and security.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/cli/src/ui/components/triage/TriageDuplicates.tsx (522)

critical

The gh api call to close an issue as a duplicate has a hardcoded repository path (repos/google-gemini/gemini-cli/...). This prevents the tool from working on any other repository. The gh CLI supports {owner} and {repo} placeholders to refer to the current repository, which should be used here to make the tool generic.

          `repos/{owner}/{repo}/issues/${String(state.currentIssue.number).replace(/[^a-zA-Z0-9-]/g, '')}`, // Sanitize issue number

packages/cli/src/ui/components/triage/TriageDuplicates.tsx (197-243)

security-high high

The TriageDuplicates component is vulnerable to prompt injection because it directly concatenates untrusted GitHub issue bodies into the LLM prompt. An attacker could craft a malicious issue body (e.g., containing </target_issue><candidates></candidates>INSTRUCTIONS: ...) to manipulate the LLM's output, leading to sensitive actions like posting arbitrary comments or incorrectly closing issues. To mitigate this, the issue body should be sanitized by escaping special characters like < and > before being included in the prompt.

${issue.body.replace(/\u003c/g, '\u0026lt;').replace(/\u003e/g, '\u0026gt;').slice(0, 8000)}

packages/cli/src/ui/components/triage/TriageDuplicates.tsx (502-508)

security-high high

The LLM-generated suggested_comment is used directly as an argument to the gh issue comment command without validation. While the use of an argument array in spawnAsync prevents shell injection, the lack of validation on the LLM output means that a successful prompt injection (as identified above) can lead to the bot performing unintended actions, such as posting malicious links or misinformation on GitHub issues.

packages/cli/src/ui/components/triage/TriageDuplicates.tsx (219)

high

Similar to the target issue, the candidate issue body is directly injected into the LLM prompt without sanitization. This poses a prompt injection risk. The content should be sanitized by escaping special characters like < and > to prevent malicious instructions within the issue body from being executed by the model.

${c.body.replace(/\u003c/g, '\u0026lt;').replace(/\u003e/g, '\u0026gt;').slice(0, 4000)}
References
  1. To prevent prompt injection, sanitize any additional context from hooks by escaping HTML-like tag characters such as < and >.

@sehoon38 sehoon38 force-pushed the sehoon/triage-duplicates branch from f67b407 to f2c8937 Compare January 27, 2026 17:12
@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Jan 27, 2026
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Size Change: +1 kB (0%)

Total Size: 23.4 MB

Filename Size Change
./bundle/gemini.js 23.4 MB +1 kB (0%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@sehoon38 sehoon38 force-pushed the sehoon/triage-duplicates branch from f2c8937 to 1fa88bd Compare January 27, 2026 17:18
@sehoon38 sehoon38 enabled auto-merge January 27, 2026 17:34
@sehoon38 sehoon38 added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit 50e4f93 Jan 27, 2026
25 checks passed
@sehoon38 sehoon38 deleted the sehoon/triage-duplicates branch January 27, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create oncall command to deduplicate issues

2 participants