Skip to content

fix(tools): check for query execution error for pgxpool.Pool#1969

Merged
averikitsch merged 3 commits into
mainfrom
log-ainl
Nov 18, 2025
Merged

fix(tools): check for query execution error for pgxpool.Pool#1969
averikitsch merged 3 commits into
mainfrom
log-ainl

Conversation

@Yuan325

@Yuan325 Yuan325 commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

Description

Return error if there's error during query execution. AlloyDB AI NL tool was failing query silently. When this happened, the user was just receiving nil response and not informed of what the error was.

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #1949

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Yuan325, 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 debug logging capabilities to the alloydbainl tool. The primary objective is to enhance the observability of the tool's execution flow, allowing for better understanding of its internal operations, easier diagnosis of potential issues, and clearer tracking of its output and errors during query processing. This change focuses purely on improving developer experience and debugging without altering the core functionality of the tool.

Highlights

  • Logging Utility Import: The github.com/googleapis/genai-toolbox/internal/util package has been imported to provide common utility functions, specifically for logging.
  • Context-Aware Logger Integration: A logger is now retrieved from the context.Context at the beginning of the Invoke method within the alloydbainl tool, ensuring consistent and context-specific logging.
  • Enhanced Debug Logging: Debug log statements have been added to capture and print the tool's output and any errors encountered during query execution, improving observability and troubleshooting capabilities.
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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 adds debug logging to the AlloyDB AI NL tool. The changes are a good step towards better observability. I've provided a few suggestions to improve logging efficiency, use more appropriate log levels for error conditions, and ensure consistency in error handling. These changes will enhance code maintainability and correctness.

Comment thread internal/tools/alloydbainl/alloydbainl.go
Comment thread internal/tools/alloydbainl/alloydbainl.go Outdated
@Yuan325 Yuan325 changed the title chore: add debug logs to alloydb ai nl tool fix(tools/alloydb-ai-nl): check for query execution error Nov 17, 2025
@Yuan325 Yuan325 requested a review from a team November 18, 2025 16:26
@Yuan325 Yuan325 changed the title fix(tools/alloydb-ai-nl): check for query execution error fix(tools): check for query execution error Nov 18, 2025
@Yuan325 Yuan325 changed the title fix(tools): check for query execution error fix(tools): check for query execution error for pgxpool.Pool Nov 18, 2025
@averikitsch averikitsch merged commit 2bff138 into main Nov 18, 2025
11 checks passed
@averikitsch averikitsch deleted the log-ainl branch November 18, 2025 18:24
Yuan325 added a commit that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.21.0](v0.20.0...v0.21.0)
(2025-11-19)


### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([#1894](#1894))
([446d62a](446d62a))


### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([#1751](#1751))
([5abad5d](5abad5d))


### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([#1993](#1993))
([0e269a1](0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([#1969](#1969))
([2bff138](2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
github-actions Bot pushed a commit that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---

##
[0.21.0](v0.20.0...v0.21.0)
(2025-11-19)

### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([#1894](#1894))
([446d62a](446d62a))

### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([#1751](#1751))
([5abad5d](5abad5d))

### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([#1993](#1993))
([0e269a1](0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([#1969](#1969))
([2bff138](2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> e81dfea
github-actions Bot pushed a commit that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---

##
[0.21.0](v0.20.0...v0.21.0)
(2025-11-19)

### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([#1894](#1894))
([446d62a](446d62a))

### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([#1751](#1751))
([5abad5d](5abad5d))

### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([#1993](#1993))
([0e269a1](0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([#1969](#1969))
([2bff138](2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> e81dfea
github-actions Bot pushed a commit to renovate-bot/googleapis-_-genai-toolbox that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---

##
[0.21.0](googleapis/mcp-toolbox@v0.20.0...v0.21.0)
(2025-11-19)

### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([googleapis#1894](googleapis#1894))
([446d62a](googleapis@446d62a))

### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([googleapis#1751](googleapis#1751))
([5abad5d](googleapis@5abad5d))

### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([googleapis#1993](googleapis#1993))
([0e269a1](googleapis@0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([googleapis#1969](googleapis#1969))
([2bff138](googleapis@2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> e81dfea
github-actions Bot pushed a commit to renovate-bot/googleapis-_-genai-toolbox that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---

##
[0.21.0](googleapis/mcp-toolbox@v0.20.0...v0.21.0)
(2025-11-19)

### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([googleapis#1894](googleapis#1894))
([446d62a](googleapis@446d62a))

### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([googleapis#1751](googleapis#1751))
([5abad5d](googleapis@5abad5d))

### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([googleapis#1993](googleapis#1993))
([0e269a1](googleapis@0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([googleapis#1969](googleapis#1969))
([2bff138](googleapis@2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> e81dfea
github-actions Bot pushed a commit to CrazyForks/genai-toolbox that referenced this pull request Nov 20, 2025
🤖 I have created a release *beep* *boop*
---

##
[0.21.0](googleapis/mcp-toolbox@v0.20.0...v0.21.0)
(2025-11-19)

### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([googleapis#1894](googleapis#1894))
([446d62a](googleapis@446d62a))

### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([googleapis#1751](googleapis#1751))
([5abad5d](googleapis@5abad5d))

### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([googleapis#1993](googleapis#1993))
([0e269a1](googleapis@0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([googleapis#1969](googleapis#1969))
([2bff138](googleapis@2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> e81dfea
NightStack15 added a commit to NightStack15/googleapis-_-genai-toolbox that referenced this pull request Mar 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.21.0](googleapis/mcp-toolbox@v0.20.0...v0.21.0)
(2025-11-19)


### ⚠ BREAKING CHANGES

* **tools/spanner-list-tables:** Unmarshal `object_details` json string
into map to make response have nested json
([#1894](googleapis/mcp-toolbox#1894))
([446d62a](googleapis/mcp-toolbox@446d62a))


### Features

* **tools/postgres:** Add `long_running_transactions`, `list_locks` and
`replication_stats` tools
([#1751](googleapis/mcp-toolbox#1751))
([5abad5d](googleapis/mcp-toolbox@5abad5d))


### Bug Fixes

* **tools/alloydbgetinstance:** Remove parameter duplication
([#1993](googleapis/mcp-toolbox#1993))
([0e269a1](googleapis/mcp-toolbox@0e269a1))
* **tools:** Check for query execution error for pgxpool.Pool
([#1969](googleapis/mcp-toolbox#1969))
([2bff138](googleapis/mcp-toolbox@2bff138))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
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.

AlloyDB AI NL null response

3 participants