Skip to content

Comments

fix(automation): fix jq quoting error in pr-triage.sh#16958

Merged
bdmorgan merged 2 commits intogoogle-gemini:mainfrom
Kimsoo0119:fix/pr-triage-jq-quoting
Jan 19, 2026
Merged

fix(automation): fix jq quoting error in pr-triage.sh#16958
bdmorgan merged 2 commits intogoogle-gemini:mainfrom
Kimsoo0119:fix/pr-triage-jq-quoting

Conversation

@Kimsoo0119
Copy link
Contributor

@Kimsoo0119 Kimsoo0119 commented Jan 18, 2026

Summary

Details

The previous change in #16657 incorrectly "fixed" quote escaping by adding backslashes inside single-quoted strings:

# Before (working):
JQ_TSV_FORMAT='... (.issue // "null") ...'

# After #16657 (broken):
JQ_TSV_FORMAT='... (.issue // \"null\") ...'

In bash single quotes, backslash escapes are not processed - they're passed literally. So jq receives \"null\" instead of "null", causing:

jq: error: syntax error, unexpected INVALID_CHARACTER (Unix shell quoting issues?)

Fix: Use jq's native null value with tostring, which converts to the string "null" - avoiding shell quoting issues entirely.

Related Issues

How to Validate

  1. Run the jq command locally:
echo '{"issue": null}' | jq -r '(.issue // null) | tostring'
# Should output: null
  1. Verify the audit-prs workflow passes after merge

Pre-Merge Checklist

  • Documentation updated (N/A - no user-facing changes)
  • Tests added/updated (N/A - CI workflow will validate)
  • Verified on macOS

@Kimsoo0119 Kimsoo0119 requested a review from a team as a code owner January 18, 2026 05:40
@google-cla
Copy link

google-cla bot commented Jan 18, 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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Kimsoo0119, 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 resolves a critical jq syntax error within the pr-triage.sh script, which was preventing the audit-prs workflow from completing successfully. The issue stemmed from incorrect shell quoting that caused jq to misinterpret escaped quotes. The solution involves leveraging jq's native null value and tostring function to robustly handle null data, thereby eliminating the need for problematic shell-level escaping and restoring the workflow's functionality.

Highlights

  • Resolved jq Quoting Error: Fixed an incorrect shell quoting issue in the pr-triage.sh script that led to jq syntax errors.
  • Restored audit-prs Workflow: Addressed the root cause of the audit-prs workflow failures, which began after a previous merge (chore(automation): ensure status/need-triage is applied and never cleared automatically #16657).
  • Improved Null Handling: Modified the JQ_TSV_FORMAT to use jq's native null value combined with tostring, preventing shell escaping problems and ensuring correct conversion to the string "null".
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.

@Kimsoo0119 Kimsoo0119 closed this Jan 18, 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 resolves a jq syntax error within the pr-triage.sh script. The error was caused by improper shell quoting of backslashes inside a single-quoted string. The proposed fix, which uses jq's native null keyword and the tostring function, is a robust and idiomatic solution that avoids shell quoting complexities altogether. The change is clear, well-explained, and effectively fixes the failing audit-prs workflow. The change is approved.

@Kimsoo0119 Kimsoo0119 reopened this Jan 18, 2026
@Kimsoo0119 Kimsoo0119 closed this Jan 18, 2026
@Kimsoo0119 Kimsoo0119 reopened this Jan 18, 2026
The previous change incorrectly escaped quotes inside single-quoted
strings. In bash single quotes, backslash escapes are not processed,
so `\"null\"` is passed literally to jq, causing a syntax error:
"unexpected INVALID_CHARACTER (Unix shell quoting issues?)"

Fix by using jq's native `null` value with `tostring` instead of
trying to embed a quoted string literal.

Fixes the audit-prs workflow failure introduced in google-gemini#16657.
@bdmorgan
Copy link
Collaborator

Thanks @Kimsoo0119 !!

@bdmorgan bdmorgan enabled auto-merge January 19, 2026 20:49
@bdmorgan bdmorgan added this pull request to the merge queue Jan 19, 2026
Merged via the queue into google-gemini:main with commit 4b4bdd1 Jan 19, 2026
25 checks passed
Mango-Lee-dev pushed a commit to Mango-Lee-dev/gemini-cli that referenced this pull request Jan 20, 2026
Thomas-Shephard pushed a commit to Thomas-Shephard/gemini-cli that referenced this pull request Jan 21, 2026
thacio added a commit to thacio/auditaria that referenced this pull request Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: audit-prs workflow failing due to jq quoting error in pr-triage.

2 participants