Skip to content

[Bug] get_openclaw_context 环境变量检测不扫描 .env 文件,产生误报 #327

Description

@mouxangithub

问题描述

get_openclaw_context 生成的诊断快照中,环境变量检测只扫描了 openclaw.json 的 env.vars 声明,没有扫描 ~/.openclaw/.env 文件和 Gateway 进程的实际环境变量,导致即使模型调用正常,也会产生"未在 OpenClaw env 中找到"的误报。

复现步骤

  1. 在 ~/.openclaw/.env 中配置 API Key
  2. 在 openclaw.json 的 models.providers 中用 ${VAR} 引用
  3. Gateway 正常运行,但诊断显示"未在 OpenClaw env 中找到"

期望行为

诊断工具应同时扫描 .env 文件和进程环境变量

  1. openclaw.json 的 env.vars 声明
  2. ~/.openclaw/.env 文件
  3. Gateway 进程的实际 OS 环境变量
    如果变量在上述任一位置存在且可读,应该标记为"已找到"。

操作系统

其他 Linux 发行版

系统版本

Debian GNU/Linux 12 (bookworm)

ClawPanel 版本

v0.18.2

截图或日志

No response

补充信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions