fix: OMNIMEMEVAL_ENV_FILE 路径在 Windows/git-bash 下不可用 - #5
Open
wefio wants to merge 1 commit into
Open
Conversation
extract_env_arg builds the env-file path with plain 'pwd', which in git-bash (MSYS2) emits POSIX paths (/c/...). Native Windows Python then silently fails to open them — python-dotenv's load_dotenv returns False without raising — so NMG_ROOT/ANSWER_MODEL etc. are never loaded and every run_*_eval.sh silently runs with missing config. MSYS2 auto-converts command-line arguments to Windows paths but NOT environment variables, and the env-file path crosses bash -> python via an env var, so it stays in POSIX form. Fix: pwd -W 2>/dev/null || pwd - pwd -W (MSYS extension) emits Windows paths (C:/...) that Windows Python can open. - On Linux/macOS/WSL, pwd -W fails, the error is swallowed, and plain pwd runs — behaviour is unchanged. Cross-platform, no WSL dependency. Applies to both injection points: --env and --replay env-file paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么(What changed)
scripts/_experiment_utils.sh的extract_env_arg中,环境文件路径由pwd生成。git-bash(MSYS2)下pwd输出 POSIX 风格路径(/c/...),Windows 原生 Python 打不开——python-dotenv的load_dotenv()静默返回 False,导致NMG_ROOT/ANSWER_MODEL等环境变量从未加载,run_*_eval.sh全部静默缺配置运行。改动(2 处:
--env与--replay路径):pwd -W输出 Windows 路径(C:/...),Python 可正常打开pwd -W不存在,自动回退普通pwd,行为不变验证(Tested)
Windows + git-bash:
load_dotenv成功、ANSWER_MODEL正常加载;Linux 回退不受影响。English:
extract_env_argbuilt the env-file path with plainpwd, which emits POSIX paths (/c/...) under git-bash; Windows Python silently fails to open them (python-dotenv returns False), so env vars were never loaded. Fix:pwd -W 2>/dev/null || pwd(2 places) — Windows paths on git-bash, unchanged fallback elsewhere. Tested on Windows git-bash (loads correctly); Linux unaffected.