Skip to content

fix: Need to be able to specify different host for gRPC in TCK#877

Merged
kabir merged 1 commit into
a2aproject:mainfrom
kabir:tck-grpc
May 15, 2026
Merged

fix: Need to be able to specify different host for gRPC in TCK#877
kabir merged 1 commit into
a2aproject:mainfrom
kabir:tck-grpc

Conversation

@kabir
Copy link
Copy Markdown
Collaborator

@kabir kabir commented May 15, 2026

No description provided.

Copy link
Copy Markdown
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 refactors the host configuration in TckAgentCardProducer by introducing separate constants for the general host and the gRPC host, enabling independent configuration via environment variables. A review comment suggests that GRPC_HOST should fall back to the value of HOST instead of the hardcoded DEFAULT_HOST to ensure that the gRPC endpoint correctly follows a custom host setting when a specific gRPC host is not provided.

private static final String host = getEnvOrDefault("SUT_HOST", "localhost:9999");
private static final String DEFAULT_HOST = "localhost:9999";
private static final String HOST = getEnvOrDefault("SUT_HOST", DEFAULT_HOST);
private static final String GRPC_HOST = getEnvOrDefault("SUT_GRPC_HOST", DEFAULT_HOST);
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.

medium

The GRPC_HOST should fall back to the value of HOST if SUT_GRPC_HOST is not specified. Currently, it defaults to DEFAULT_HOST (localhost:9999). This means that if a user configures SUT_HOST to a custom value but leaves SUT_GRPC_HOST unset, the gRPC endpoint will incorrectly point to localhost:9999 instead of the custom host specified in SUT_HOST.

Suggested change
private static final String GRPC_HOST = getEnvOrDefault("SUT_GRPC_HOST", DEFAULT_HOST);
private static final String GRPC_HOST = getEnvOrDefault("SUT_GRPC_HOST", HOST);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@gemini-code-assist updated, does it look better now?

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.

Yes, that looks correct. By using HOST as the default for GRPC_HOST, you ensure that if SUT_GRPC_HOST is not explicitly set, it will inherit the value from SUT_HOST (or the default localhost:9999 if neither is set), which is the expected behavior.

@kabir kabir merged commit ececaab into a2aproject:main May 15, 2026
11 checks passed
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.

1 participant