Keep service start from downloading the Python base layer
ci / svc-realcombo (pull_request) Successful in 2m2s
ci / test (pull_request) Successful in 5m49s
ci / test-pg (pull_request) Successful in 8m54s

Why: env ensure downloads an interpreter and wheels. The real-combination start test allows 120 seconds, and that download made rc1 start time out.
Evidence: CI job 5184 timed out in test_U3_real_agent_identity_lifecycle_sqlite on scripts/svc.sh rc1 start.
Impact: Start only mounts a base layer that already exists. The first build is an explicit env ensure, run outside start.
Refs: Agent-System-Dev pull 570
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-15 14:14:48 +00:00
co-authored by Cursor
parent bd18e11836
commit 9c7fa2730e
+8 -7
View File
@@ -3948,9 +3948,10 @@ agent_static_preflight() {
return 0
}
# agent_exec_env_prepare:多个实例共用 runtime/envs。产物认识 env 子命令时先 ensure。
# 下载失败只警告。current 基础层存在时,经环境变量把根和依赖层交给 serve,
# 不改写已经持久化的 exec=。
# agent_exec_env_prepare:多个实例共用 runtime/envs。启动不下载解释器或 wheel,
# 避免把 start 拖进网络安装(真实组合测试的启动上限是 120 秒)。
# current 基础层已经存在时,经环境变量把根和依赖层交给 serve,不改写 exec=。
# 首次建立基础层用:<二进制> env ensure --root "$RUNTIME/envs"
agent_exec_env_prepare() {
local probe root id deps
probe="$("$ENV_BIN" env 2>&1 || true)"
@@ -3959,13 +3960,13 @@ agent_exec_env_prepare() {
*) return 0 ;;
esac
root="$RUNTIME/envs"
if ! "$ENV_BIN" env ensure --root "$root"; then
c_warn "[$ENV_NAME] Python 环境根未就绪($root)。启动继续,基础层导入不可用,直到 env ensure 成功。"
if [ ! -L "$root/current" ]; then
c_warn "[$ENV_NAME] Python 基础层未建立($root)。启动继续;需要时运行:$ENV_BIN env ensure --root $root"
return 0
fi
[ -L "$root/current" ] || return 0
id="$(basename "$(readlink "$root/current")")"
deps="$root/layers/$id/site-packages"
[ -d "$deps" ] || return 0
[ -d "$deps" ] || { c_warn "[$ENV_NAME] Python 基础层 $id 缺少 site-packages"; return 0; }
guard_env+=("AGENT_SYSTEM_EXEC_ENV_ROOT=$root")
guard_env+=("AGENT_SYSTEM_EXEC_DEPS_DIR=$deps")
c_info "[$ENV_NAME] Python 环境:$root (基础层 $id)"