From 9bbe2c83f60193b015b3cc842032f90a88524d55 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 15 Sep 2026 11:24:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(extension):=20=E5=85=A5=E5=8F=A3=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E7=9B=AE=E5=BD=95=E8=A7=A3=E6=9E=90=E2=80=94=E2=80=94?= =?UTF-8?q?176=20=E9=83=A8=E7=BD=B2=E6=A0=91=E8=B7=AF=E5=BE=84=E6=B7=B1?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E5=90=8C=E8=87=B4=20trial=20=E6=8A=A5?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _resolve_extension_entry_dir 按 parents[4] 推导,175 仓库布局成立, 176 部署树(bioflow_service 独立树)深度不同 → 找不到 run_extension.py → 试运行报「入口脚本缺失」。修复:env BIOFLOW_EXT_ENTRY_DIR 优先 + 从 __file__ 向上逐级搜索 */bioflow_kernel/cli/run_extension.py + 兜底。 Co-Authored-By: Claude Fable 5 --- .../app/services/bioflow/extension_exec.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bioflow_service/app/services/bioflow/extension_exec.py b/bioflow_service/app/services/bioflow/extension_exec.py index 460250c..608f0a9 100644 --- a/bioflow_service/app/services/bioflow/extension_exec.py +++ b/bioflow_service/app/services/bioflow/extension_exec.py @@ -15,6 +15,7 @@ from __future__ import annotations import asyncio import logging +import os import shlex from dataclasses import dataclass, field from pathlib import Path @@ -261,8 +262,22 @@ def _default_exec_config() -> ExtensionExecConfig: def _resolve_extension_entry_dir() -> str: - """宿主入口脚本目录 = repo 根 bioflow_kernel/cli(按 __file__ 推导,零硬编码)。""" + """宿主入口脚本目录 = 部署树 bioflow_kernel/cli(env 优先 + 多候选推导)。 + + 2026-09-15 实测:parents[4] 推导在 175 仓库布局成立,176 部署树路径深度 + 不同 → 找到不存在位置 → 试运行报「入口脚本缺失」。修复: + 1. BIOFLOW_EXT_ENTRY_DIR env 显式指定(部署树配置) + 2. 从 __file__ 向上逐级找 */bioflow_kernel/cli/run_extension.py + 3. 兜底 parents[4] 推导 + """ + env_dir = os.environ.get("BIOFLOW_EXT_ENTRY_DIR", "").strip() + if env_dir and Path(env_dir).is_dir(): + return env_dir here = Path(__file__).resolve() + for parent in [here] + list(here.parents): + candidate = parent / "bioflow_kernel" / "cli" + if (candidate / "run_extension.py").is_file(): + return str(candidate) return str(here.parents[4] / "bioflow_kernel" / "cli")