#4267·AionUi

[Bug]: 会话内 client terminal 不携带 AIONUI_* 运行期变量 —— $AIONUI_HELPER_BIN 为空,内置技能与 aioncore config CLI 不可用

Author: marce006982Created Sep 15, 2026Updated Sep 15, 2026
Labelsneeds-triage

环境

  • AionUi 2.2.2;Windows 11 Pro(10.0.26200)
  • aioncore v0.2.2(bundled;resources/bundled-aioncore/win32-x64/manifest.json"version": "v0.2.2",2026-09-09 构建)
  • 会话 agent:Kimi Code(aioncore 日志 Spawning CLI process (SDK mode)
  • 涉及功能:内置技能(Assistant Rules / skills,如 skills、cron、aionui-config)

Bug 描述

内置技能文档要求 agent 经终端调用 helper(官方示例):

bash
printf '%s' '{"name":"cron"}' | "$AIONUI_HELPER_BIN" skills show

实际在 agent 会话内执行时,$AIONUI_HELPER_BIN 为空展开:

/usr/bin/bash: line 1: : command not found
exit=127

直接写 aioncore.exe 绝对路径调用同样不可用:

> aioncore.exe config cron current list
CONFIG_ENV_MISSING command="config cron current list" field="AIONUI_BASE_URL": missing required environment variable   (exit=2)

根因面:agent 进程本身有这 5 个运行期变量,但 agent 执行命令的 client terminal 进程没有AIONUI_USER_ID / AIONUI_CONVERSATION_ID / AIONUI_HELPER_BIN / AIONUI_BASE_URL / AIONUI_RUNTIME_TOKEN)。因此所有以 "$AIONUI_HELPER_BIN" 为入口的内置技能工作流在会话内全部不可用。

复现(任意 AionUi 会话,让 agent 在终端执行)

bash
env | grep '^AION'
# 只有 6 个静态键,没有任何运行期键:
#   AIONCORE_BOOTSTRAP_SECRET  AIONUI_CACHE_DIR  AIONUI_CDP_ACTIVE_PORT
#   AIONUI_CDP_BRIDGE_TOKEN  AIONUI_LOG_DIR  AIONUI_WORK_DIR

"$AIONUI_HELPER_BIN" skills capabilities   # → 空展开,command not found

实测证据(同一时刻,同机)

  1. 终端 shell 的父进程链:bash → … → aioncore.exe → AionUi.exe;命令由 aioncore 的 client terminal 代执行(aioncore 日志 client terminal created 与每条工具命令一一对应,09-16 当天 365 条),不是 agent 进程的子进程
  2. AIONUI_HELPER_BIN / AIONUI_RUNTIME_TOKEN 任一存在筛选扫描当前用户可读的进程环境(系统侧 psutil 读取,仅核对键名):唯一命中者是 agent 本体 kimi.exe;终端 shell 一个运行期键都没有。
  3. 同日 aioncore 日志同时存在 Spawning CLI process (SDK mode)(这 5 个键随该处注入 agent 进程)与大量 client terminal created —— 注入只发生在前者。

代码线索(v0.2.2;terminal.rs 实测 main 与 v0.2.2 内容一致)

  • crates/aionui-ai-agent/src/protocol/acp.rs · handle_terminal_create():组装 CreateTerminalParamsenv 只透传 agent 请求携带的 envenv: request.env.iter().map(...)),无任何兜底/合并。
  • crates/aionui-ai-agent/src/terminal.rs · TerminalRegistry::create():spawn 时也只 builder.env(k, v)(来自 params.env),其余继承 aioncore 进程环境;而 aioncore 自身环境并不包含这 5 个 per-conversation 变量。
  • 对照设计意图:crates/aionui-ai-agent/src/types.rsruntime_env 注释为 "Per-turn environment values exposed to runtime tool execution";ConversationService::runtime_token_for_build 注释说明 token 是给 "in-conversation CLIaioncore config / diagnose)" 用的 —— 但终端创建路径没有把这套运行期上下文并入。
  • 参考方向(供你们判断):连接构建处已在传 terminal_label / terminal_cwdTerminalRegistry::new(terminal_label, terminal_cwd)),可再带一份会话运行期 env 并在 create() 合并;或在 handle_terminal_create 侧从会话上下文解析后并入。

影响

  • 内置技能在会话内形同虚设:文档入口就是 "$AIONUI_HELPER_BIN",实测不可执行。
  • agent 无法用 CLI 管理定时任务 / 技能 / 会话(如 aioncore config cron),只能靠 UI 手动操作。
  • 无法用「用户预设静态环境变量」绕过:AIONUI_BASE_URL 每次启动为随机端口、AIONUI_RUNTIME_TOKEN 是进程内存一次性凭据,写死必然过期。

相关

  • #4250:Hermes 团队成员缺失 AIONUI_* 变量(team mailbox 不可用)——同类、不同场景(团队/ACP 进程面);本 issue 是普通单会话的 client terminal 面
  • #4145:aioncore config CLI 的 HTTP_PROXY 问题——该 CLI 的会话内可用性属同一套机制。