Skip to content

Conversation

Skyllarr
Copy link
Contributor

@Skyllarr Skyllarr commented Sep 9, 2025

No description provided.

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.

Summary of Changes

Hello @Skyllarr, 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 focuses on a comprehensive refactor to align the Java codebase with established linting rules and best practices. The changes are purely cosmetic and aimed at improving code maintainability, consistency, and documentation without altering any existing functionality. It ensures the project adheres to high-quality coding standards, making it easier for developers to understand and contribute to the codebase.

Highlights

  • Code Style and Readability Improvements: The pull request introduces various changes to enhance code style and readability, including standardizing Javadoc comments, adding the 'final' keyword to method parameters, and replacing magic numbers with named constants.
  • Consistent Import Statements: Wildcard imports have been replaced with explicit class imports across the codebase, improving clarity and reducing potential naming conflicts.
  • Introduction of Package-Level Documentation: New 'package-info.java' files have been added to both client and server packages, providing comprehensive package-level Javadoc documentation.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 does a good job of fixing lint errors and improving code quality by adding documentation, using constants, and making parameters final. I've found a few areas for further improvement, including a critical issue with the streaming implementation that doesn't actually stream, and some opportunities to reduce code duplication and improve error handling.

.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();

HttpResponse<String> response = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The sendTaskStreaming method's name is misleading as it doesn't actually stream the response. HttpResponse.BodyHandlers.ofString() is a blocking handler that buffers the entire response body in memory before returning. This defeats the purpose of a streaming API, especially for long-running tasks that produce many updates.

To implement true streaming, you should use a non-blocking body handler like HttpResponse.BodyHandlers.ofLines(), which provides a Stream<String> that can be processed as data arrives. This would require refactoring the subsequent parsing logic.

Comment on lines 46 to 66
public A2AClient(final String url) {
this.baseUrl = url.endsWith("/")
? url.substring(0, url.length() - 1) : url;
this.httpClient = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30))
.build();
.connectTimeout(Duration.ofSeconds(CONNECTION_TIMEOUT_SECONDS))
.build();
this.objectMapper = new ObjectMapper();
}

/**
* Create a new A2A client with custom HTTP client
*
* @param baseUrl the base URL of the A2A server
* @param httpClient custom HTTP client
* Create a new A2A client with custom HTTP client.
*
* @param url the base URL of the A2A server
* @param client custom HTTP client
*/
public A2AClient(String baseUrl, HttpClient httpClient) {
this.baseUrl = baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length() - 1) : baseUrl;
this.httpClient = httpClient;
public A2AClient(final String url, final HttpClient client) {
this.baseUrl = url.endsWith("/")
? url.substring(0, url.length() - 1) : url;
this.httpClient = client;
this.objectMapper = new ObjectMapper();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is code duplication in the constructors for initializing baseUrl and objectMapper. You can simplify this by using constructor chaining, where one constructor calls another. This improves maintainability by centralizing the initialization logic.

    public A2AClient(final String url) {
        this(url, HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(CONNECTION_TIMEOUT_SECONDS))
                .build());
    }
    
    /**
     * Create a new A2A client with custom HTTP client.
     *
     * @param url the base URL of the A2A server
     * @param client custom HTTP client
     */
    public A2AClient(final String url, final HttpClient client) {
        this.baseUrl = url.endsWith("/")
                ? url.substring(0, url.length() - 1) : url;
        this.httpClient = client;
        this.objectMapper = new ObjectMapper();
    }
Comment on lines 187 to 194
} catch (Exception e) {
sendErrorEvent(emitter, request.id(), ErrorCode.INTERNAL_ERROR, e.getMessage());
sendErrorEvent(emitter, request.id(),
ErrorCode.INTERNAL_ERROR, e.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

In this catch block, you're catching a generic Exception and only passing e.getMessage() to sendErrorEvent. This practice can hide important details for debugging, such as the stack trace and the original exception type. For better error diagnostics, it's recommended to log the full exception. If a logger is not available, consider enhancing sendErrorEvent to include more error details in the response, at least during development.

@Skyllarr Skyllarr force-pushed the lintingErrors branch 2 times, most recently from 669088d to 08c74d8 Compare September 9, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant