-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Respect ADK_DISABLE_LOAD_DOTENV across all usages of load_dotenv_for_agent #4019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Spikhalskiy, 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 addresses an inconsistency in how the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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
|
219066c to
295c77a
Compare
There was a problem hiding this 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 applies the ADK_DISABLE_LOAD_DOTENV check to all usages of load_dotenv_for_agent, ensuring consistent behavior across the application. The changes are straightforward and address the issue described. However, I strongly recommend adding unit tests for this change. While the original feature may not have had tests, adding them now would significantly improve the robustness of this functionality and prevent future regressions. Simple unit tests could be added to verify that load_dotenv_for_agent is called or skipped based on the environment variable. I've also left a comment about using a constant for the environment variable name to improve maintainability.
|
|
||
| # Create new runner | ||
| envs.load_dotenv_for_agent(os.path.basename(app_name), self.agents_dir) | ||
| if not is_env_enabled('ADK_DISABLE_LOAD_DOTENV'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic string 'ADK_DISABLE_LOAD_DOTENV' is used in multiple files across this pull request. To improve maintainability and prevent potential typos in the future, it would be best to define this as a constant in a shared module (for example, in src/google/adk/utils/env_utils.py alongside is_env_enabled) and import it where needed.
|
Response from ADK Triaging Agent Hello @Spikhalskiy, thank you for your contribution! I've noticed that this PR does not include unit tests. As per our contribution guidelines, all code changes should include tests to ensure the quality and prevent regressions. Could you please add unit tests for your changes? This will help us to review and merge your PR more efficiently. Thanks! |
295c77a to
1a4d9e2
Compare
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
.envloading #3228Problem:
15afbcd implemented an environment variable that would stop ADK from loading agent
.envfiles. It did it incli.pyonly, while more places load.envfilesSolution:
All usages of
load_dotenv_for_agentare not under the ADK_DISABLE_LOAD_DOTENV check.Testing Plan
I did not; the change is pretty trivial and should not call the
load_dotenv_for_agentif the corresponding environment variable is supplied.Unit Tests:
Original contribution 15afbcd was not covered by tests, so I assumed they were not needed for this change.
Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Checklist