-
Notifications
You must be signed in to change notification settings - Fork 59
Guard ReMe launcher with env validation #10
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?
Guard ReMe launcher with env validation #10
Conversation
Summary of ChangesHello @arjuntheprogrammer, 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 enhances the robustness of the launcher by implementing a pre-launch validation for critical environment variables required by companion services. This ensures that auxiliary services do not attempt to start with incomplete configurations, providing immediate and clear feedback to the user on how to resolve missing settings. It also refines the Highlights
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
|
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 introduces a validation mechanism for environment variables required by companion services, which is a solid improvement. It prevents crashes from missing configurations and provides actionable error messages to the user. My review includes one suggestion for the changes in env_service/environments/appworld/setup.sh to improve maintainability by refactoring complex inline Python commands into separate helper scripts.
| # 6. 下载数据 | ||
| echo "📦 下载数据(失败则使用备用下载)..." | ||
| if ! conda run -n appworld appworld download data; then | ||
| if ! conda run -n appworld python -c $'import os\nfrom appworld import update_root\nfrom appworld.download import download_data\nroot = os.environ.get("APPWORLD_ROOT") or "."\nupdate_root(root)\ndownload_data()\n'; then |
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 inline Python script here, and similarly on line 40, is quite complex. This makes the script harder to read, debug, and maintain. For better long-term code health, consider moving this logic into a dedicated helper Python script.
For example, you could create a download_helper.py in this directory:
# env_service/environments/appworld/download_helper.py
import os
import sys
from appworld import update_root
from appworld.download import download_data
root = os.environ.get("APPWORLD_ROOT")
if not root:
print("Warning: APPWORLD_ROOT environment variable not set. Defaulting to '.'", file=sys.stderr)
root = "."
update_root(root)
download_data()You could then call it from this shell script like so:
if ! conda run -n appworld python "$SCRIPT_DIR/download_helper.py"; then
# ...
fiThis approach would make the setup.sh script cleaner and the Python logic easier to manage and test independently.
Summary
Testing
Fixes #9