From 2d7c14a2ce3e5bcbc9275a95a67f48e23dd5b841 Mon Sep 17 00:00:00 2001 From: Arjun Gupta Date: Thu, 20 Nov 2025 16:42:26 +0530 Subject: [PATCH 1/2] Work around appworld CLI install failure --- env_service/environments/appworld/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 env_service/environments/appworld/setup.sh diff --git a/env_service/environments/appworld/setup.sh b/env_service/environments/appworld/setup.sh old mode 100644 new mode 100755 index cbbe4d2..04d5d7c --- a/env_service/environments/appworld/setup.sh +++ b/env_service/environments/appworld/setup.sh @@ -37,11 +37,11 @@ conda run -n appworld pip install -r "$SCRIPT_DIR/requirements.txt" # 5. 初始化 appworld echo "📁 初始化 appworld..." -conda run -n appworld appworld install +conda run -n appworld python -c $'from appworld.install import install_package\ninstall_package()\n' # 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 echo "⚠️ 自动下载失败,尝试从备用地址获取数据..." wget -O "$APPWORLD_ROOT/appworld_data.zip" "https://dail-wlcb.oss-accelerate.aliyuncs.com/eric.czq/appworld_data.zip" mkdir -p /tmp/unziptemp From 8c3cc3106f86234fc578e136fe4ad4de6ae770a2 Mon Sep 17 00:00:00 2001 From: Arjun Gupta Date: Thu, 20 Nov 2025 17:13:35 +0530 Subject: [PATCH 2/2] fix: validate companion env vars before launch --- launcher.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/launcher.py b/launcher.py index 49ebda7..bb689a8 100644 --- a/launcher.py +++ b/launcher.py @@ -7,6 +7,7 @@ import os import signal import shlex +from pathlib import Path from dotenv import load_dotenv from agentevolver.utils.daemon import LaunchCommandWhenAbsent @@ -98,9 +99,32 @@ def parse_args(): return parser.parse_args() +def _require_service_env(service_name: str): + """Return (path, script) for the companion service, validating env vars.""" + env_prefix = service_name.upper() + service_path = os.environ.get(f'{env_prefix}_PATH') + service_script = os.environ.get(f'{env_prefix}_SCRIPT') + missing = [] + if not service_path: + missing.append(f'{env_prefix}_PATH') + if not service_script: + missing.append(f'{env_prefix}_SCRIPT') + if missing: + example_hint = "" + example_env = Path("example.env") + if example_env.exists(): + example_hint = ( + f" Copy the relevant entries from {example_env} into your .env file." + ) + raise RuntimeError( + f"Missing environment variable(s) required to launch '{service_name}': " + f"{', '.join(missing)}.{example_hint}" + ) + return service_path, service_script + + def pty_launch(service_name: str, success_std_string="Starting server on"): - service_path = os.environ.get(f'{service_name.upper()}_PATH') - service_script = os.environ.get(f'{service_name.upper()}_SCRIPT') + service_path, service_script = _require_service_env(service_name) companion = LaunchCommandWhenAbsent( full_argument_list=[service_script], dir=service_path, @@ -393,4 +417,4 @@ def main(): sys.exit(1) if __name__ == "__main__": - main() \ No newline at end of file + main()