fix(cli): load Hermes dotenv in mini_swe and sample_and_compress - #8415
fix(cli): load Hermes dotenv in mini_swe and sample_and_compress#8415Tianworld wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for consolidating the remaining dotenv entrypoints. The underlying issue remains on current main in mini_swe_runner.py:36-40 and scripts/sample_and_compress.py:25-26, both of which still call bare load_dotenv().
Problems
- The added
Path(__file__)expression inmini_swe_runner.pyhas no correspondingfrom pathlib import Pathimport in PR commit2a9c13e; importing the runner would raiseNameError. - This branch needs selective salvage: GitHub reports it conflicting,
environments/hermes_base_env.pyis absent from current main, and current main already usesload_hermes_dotenv()intrajectory_compressor.py:51-56andscripts/discord-voice-doctor.py:177-184.
Suggested changes
- Retain the two still-needed entrypoint conversions, add the missing
Pathimport, and drop the obsolete/redundant hunks. - Cover a latin-1
.envthrough an actual affected entrypoint path.
Automated hermes-sweeper review.
| @@ -37,10 +37,12 @@ | |||
| from typing import List, Dict, Any, Optional, Literal | |||
|
|
|||
| import fire | |||
| from dotenv import load_dotenv | |||
|
|
|||
There was a problem hiding this comment.
This added Path(...) expression needs from pathlib import Path. The module's imports do not currently define Path, so importing mini_swe_runner.py would fail with NameError before dotenv loading runs.
There was a problem hiding this comment.
Fixed in efd676f: added from pathlib import Path before the Path(__file__) usage.
Replace bare load_dotenv() with load_hermes_dotenv so UTF-8 and latin-1 .env files work on Windows. Add missing Path import for mini_swe_runner. Drop obsolete hunks already fixed on main. Add import-path regression test.
2a9c13e to
efd676f
Compare
|
Addressed review feedback:
|
|
Ready for re-review. Addressed the sweeper feedback on current
CI green (including Python tests/lints); no conflicts. PR title/description updated to match |
What
Selective salvage of remaining bare
load_dotenv()entrypoints on currentmain:mini_swe_runner.py— useload_hermes_dotenv(project_env=...)and add missingfrom pathlib import Pathscripts/sample_and_compress.py— same shared loader (UTF-8 then latin-1)tests/test_mini_swe_runner_dotenv.py— regression: latin-1~/.hermes/.envloads successfully when importingmini_swe_runnerObsolete/redundant hunks already fixed on main were dropped (
trajectory_compressor,discord-voice-doctor,dump,hermes_base_env,load_dotenv_path).Why
CONTRIBUTING documents latin-1 fallback for
.envon Windows; these two entrypoints still used plainload_dotenv(), which could raise or mis-read non-UTF8 files.How to test
Platforms
Logic-only; behavior aligned with existing
load_hermes_dotenv/ gateway/cron patterns.Made with Cursor