Skip to content

fix(constants): render display_hermes_home tail with forward slashes - #49507

Open
Bartok9 wants to merge 2 commits into
NousResearch:mainfrom
Bartok9:fix/49500-display-hermes-home-posix
Open

fix(constants): render display_hermes_home tail with forward slashes#49507
Bartok9 wants to merge 2 commits into
NousResearch:mainfrom
Bartok9:fix/49500-display-hermes-home-posix

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • display_hermes_home() rendered a mixed POSIX/Windows path on Windows.
  • hermes doctor (and any other consumer) now shows a uniform ~/-prefixed path.

Motivation

Closes #49500.

hermes doctor displayed:

~/AppData\Local\hermes/.env file missing

That mixes a POSIX ~/ prefix, a Windows AppData\Local\ middle, and a POSIX /.env tail.

Root cause is in display_hermes_home():

return "~/" + str(home.relative_to(Path.home()))

On Windows, home.relative_to(Path.home()) is a WindowsPath whose str() uses backslashes, so the POSIX ~/ prefix is concatenated to a backslash tail. doctor.py then appends /.env, producing the reported mixed string.

Fix

Use .as_posix() on the relative tail so it renders with forward slashes, matching the ~/ prefix:

return "~/" + home.relative_to(Path.home()).as_posix()

On POSIX, as_posix() is identical to str(), so existing behavior is unchanged. The ValueError fallback (HERMES_HOME outside the user home) still returns the native absolute path.

Verification

  • python3 -m pytest tests/test_hermes_constants.py — 52 passed
  • New TestDisplayHermesHome regression test fails on current code without the fix and passes with it.

Real behavior proof

  • Behavior addressed: Windows profile home C:\Users\tester\AppData\Local\hermes rendered as ~/AppData\Local\hermes.
  • Exact command run after the patch (simulating a Windows get_hermes_home() / Path.home()):
display_hermes_home() => ~/AppData/Local/hermes
doctor msg            => ~/AppData/Local/hermes/.env file missing
  • Same simulation BEFORE the fix (reproduces the issue exactly):
~/AppData\Local\hermes
  • Regression test: tests/test_hermes_constants.py::TestDisplayHermesHome::test_windows_relative_tail_uses_forward_slashes — asserts ~/AppData/Local/hermes and "\\" not in result; FAILS without the fix (gets ~/AppData\Local\hermes).

Note on related PR

Open PR #38695 also touches this area but for cron-script validation; open #21929 edits display_hermes_home() for the distinct HERMES_HOME == HOME (~/.) case by adding a guard above the try block. This change only touches the return line inside the try, so the two are independent / non-conflicting.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jun 20, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Windows regression fix. Current main still has the reported behavior at hermes_constants.py:646, and the proposed .as_posix() conversion directly corrects it.

Problems

  • Two fallback helpers that state they mirror this contract still retain the same str(home.relative_to(Path.home())) behavior: skills/productivity/google-workspace/scripts/_hermes_home.py:40 and plugins/platforms/google_chat/oauth.py:90. They are fallback-only and do not affect hermes doctor, but can still render mixed separators when the core helper is unavailable.

Suggested changes

  • Normalize those fallback tails with .as_posix() as well, or track them as a tightly scoped follow-up if this PR remains limited to the core helper.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 14, 2026
Rebuilt on latest main (Bartok9 hygiene 2026-08-01).
Original: NousResearch#49507
@Bartok9

Bartok9 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Rebuilt onto latest main via patch re-apply (force-push). Please re-run CI.

— Bartok9 public PR hygiene 2026-08-01

@Bartok9
Bartok9 force-pushed the fix/49500-display-hermes-home-posix branch from 5a4f3e6 to 4c0870c Compare August 1, 2026 17:35
…tok9

Per-PR attribution so check-attribution passes on this branch (Teknium).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes doctor shows mixed POSIX and Windows path style in .env message

3 participants