fix(aith): exit early when agent cert config is outside well-known directory#17762
Open
nbayati wants to merge 2 commits into
Open
fix(aith): exit early when agent cert config is outside well-known directory#17762nbayati wants to merge 2 commits into
nbayati wants to merge 2 commits into
Conversation
…ectory To prevent unnecessary startup latency, this updates the agent certificate retrieval to only poll when the config points to the well-known workload directory (where Cloud Run dynamically mounts files). For all other paths, it exits early. - Extracts config parsing into a dedicated helper function - Removes the hardcoded fallback to the well-known path when no config is provided - Adds test coverage for new logic
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the agent identity certificate path retrieval logic in _agent_identity_utils.py by extracting configuration parsing and polling into dedicated helper functions, and conditionally disabling polling for paths outside the well-known directory to avoid startup delays. The review feedback recommends specifying encoding="utf-8" when opening the configuration file to ensure consistent cross-platform behavior.
| """ | ||
| import json | ||
|
|
||
| with open(cert_config_path, "r") as f: |
Contributor
There was a problem hiding this comment.
Specify encoding="utf-8" when opening the configuration file to ensure consistent behavior across different platforms (such as Windows) where the default system encoding might not be UTF-8.
Suggested change
| with open(cert_config_path, "r") as f: | |
| with open(cert_config_path, "r", encoding="utf-8") as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To prevent unnecessary startup latency, this updates the agent certificate retrieval to only poll when the config points to the well-known workload directory (where Cloud Run dynamically mounts files). For all other paths, it exits early.
fixes b/522957573