fix(openviking): harden local server and .env handling - #87604
Merged
kshitijk4poor merged 4 commits intoAug 17, 2026
Merged
Conversation
…ousResearch#78153) (cherry picked from commit 7afd991)
f1ea4a5 ("cover the remaining setup-time .env reads with utf-8-sig", following 75afc47 for mem0/hindsight) swept this class; openviking's _write_env_vars was missed and still reads with strict utf-8. It copies every existing line through on each update, so the read decides whether a credential update lands: BOM'd .env -> the first key never matches, so the old line survives and the new value is appended as a duplicate. .env loaders keep the first occurrence, so the update silently does nothing. cp1252 .env -> UnicodeDecodeError aborts setup outright. Read exactly like the canonical hermes_cli/config.py save_env_value (utf-8-sig + errors="replace"). A plain UTF-8 file rewrites byte-identically. Scope: hermes_cli/memory_setup.py has the same read but is already the subject of NousResearch#30281 / NousResearch#60587, so it is left alone here. (cherry picked from commit 175c685)
Clarify that the Desktop backend can add Hermes venv packages to PYTHONPATH and that current .env loaders use the last duplicate value.
ehz0ah
force-pushed
the
fix/openviking-env-reliability
branch
from
August 16, 2026 17:45
a9d1741 to
2854fab
Compare
Contributor
Author
|
Updated after the accuracy review:
Validation on the rebased branch:
|
ehz0ah
marked this pull request as ready for review
August 17, 2026 06:24
kshitijk4poor
approved these changes
Aug 17, 2026
bobaba76
pushed a commit
to bobaba76/hermes-agent
that referenced
this pull request
Aug 27, 2026
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
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 does this PR do?
This PR consolidates #78219 and #78940. It fixes two OpenViking setup and startup failures.
First, the Hermes Desktop backend can include the Hermes virtual-environment packages in
PYTHONPATH. An auto-startedopenviking-serverinherited this path and could import those packages instead of its own. On Windows, loaded.pydfiles could lock that environment and blockhermes update.Second, the OpenViking
.envwriter used strict UTF-8. A UTF-8 BOM prevented the first key from matching, which could leave a stale duplicate credential. A non-UTF-8 byte could stop setup. The new read path removes a BOM and preserves undecodable bytes when it updates another value.The original authorship from #78219 and #78940 is preserved. The final follow-up commit changes the original replacement-character behavior so unrelated bytes remain unchanged.
Related Issue
Fixes #78153
Consolidates #78219 and #78940.
Type of Change
Changes Made
PYTHONPATHfrom the environment of an auto-started OpenViking server. Preserve all other environment variables..envfile withutf-8-sigso a leading BOM does not change the first key.surrogateescapeon read and write so unrelated non-UTF-8 bytes remain unchanged.How to Test
Run the focused OpenViking tests:
Run Ruff and the Windows footgun scan:
ruff check . python scripts/check-windows-footguns.py --allConfirm that the focused result is
105 passed.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passThe complete macOS suite was started through
scripts/run_tests.sh tests/ -q. It cannot be an all-green local gate in the standard development environment because some unrelated tests require optional Teams and WeCom dependencies, and one Linux abstract-socket test runs on macOS. The branch-specific OpenViking suite passes with retries disabled.Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs