Skip to content

feat(nix): container-aware CLI — auto-route into managed container - #7543

Merged
alt-glitch merged 4 commits into
mainfrom
feat/container-aware-cli-clean
Apr 11, 2026
Merged

feat(nix): container-aware CLI — auto-route into managed container#7543
alt-glitch merged 4 commits into
mainfrom
feat/container-aware-cli-clean

Conversation

@alt-glitch

Copy link
Copy Markdown
Collaborator

Summary

  • When container.enable = true, the host hermes CLI transparently routes all subcommands into the managed Docker/Podman container via docker exec
  • New container.hostUsers option creates a ~/.hermes symlink bridge to the service stateDir, unifying sessions/config/memories between host and container
  • Users in hostUsers are auto-added to the hermes group
  • Retry with spinner on container-down (TTY: 5s, non-TTY: 10s), hard fail instead of silent fallback
  • HERMES_DEV=1 env var bypasses routing for development
  • Cleanup on disable: removes symlinks, .container-mode, stops service

Depends on #7488 (mautrix migration) for a clean nix build — the atomicwrites sdist failure from matrix-nio[e2e] is resolved there.

Test plan

  • 16 unit tests passing (container detection, metadata parsing, exec construction, retry behavior)
  • NixOS module parses (nix-instantiate --parse)
  • Smoke tested on live NixOS system: hermes version, hermes config, hermes sessions list, hermes chat -q, tool calling, session persistence
  • HERMES_DEV=1 bypass verified (host Python 3.12 vs container Python 3.11)
  • Routing is invisible (no stderr messages)

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

fixes #7380

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

@alt-glitch
alt-glitch marked this pull request as ready for review April 11, 2026 04:24
@cursor

cursor Bot commented Apr 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Routes all host CLI invocations through docker/podman exec based on a state-file marker and adds activation-time symlink/user management, which could break interactive workflows if container metadata or runtime visibility is misconfigured. Uses sudo probing and retry behavior that changes failure modes for scripts and terminals.

Overview
Adds a container-aware host CLI path for NixOS container deployments: when HERMES_HOME/.container-mode is present, hermes now transparently re-execs all subcommands into the managed Docker/Podman container (with env passthrough, TTY handling, retry-on-container failures, and optional sudo fallback when the container is only visible to root).

Extends the NixOS module with container.hostUsers to auto-add interactive users to the Hermes group and to create/cleanup a ~/.hermes symlink bridge to the service state directory; the activation script also writes/removes the .container-mode metadata file used for routing.

Adds comprehensive unit tests for container detection/metadata parsing/exec retry logic and updates Nix setup docs to describe routing behavior, HERMES_DEV=1 bypass, and Podman sudo requirements.

Reviewed by Cursor Bugbot for commit 38277a6. Configure here.

Comment thread hermes_cli/main.py Outdated
@nousr

nousr commented Apr 11, 2026

Copy link
Copy Markdown

this branch currently does not seem to work for me.

error: Cannot build '/nix/store/07q2i2awg59mdhjdshj5533g0s6m8fsg-atomicwrites-1.4.1.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/v766f9izcyprbrmqj0hrc558s0wc16lq-atomicwrites-1.4.1
       Last 25 log lines:
       > DEBUG Proceeding without build isolation
       > DEBUG Locking the source tree for setuptools
       > DEBUG Acquired exclusive lock for `/build/atomicwrites-1.4.1`
       > DEBUG Calling `setuptools.build_meta:__legacy__.build_wheel("/build/atomicwrites-1.4.1/dist/", {}, None)`
       > Traceback (most recent call last):
       >   File "<string>", line 8, in <module>
       > ModuleNotFoundError: No module named 'setuptools'
       > DEBUG Released lock at `/build/uv-setuptools-91b6cf3c668b19dd.lock`
       >   x Failed to build `/build/atomicwrites-1.4.1`
       >   |-> The build backend returned an error
       >   `-> Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit
       >       status: 1)
       >
       >       hint: This error likely indicates that `atomicwrites-1.4.1` depends
       >       on `setuptools`, but doesn't declare it as a build dependency.
       >       If `atomicwrites-1.4.1` is a first-party package, consider adding
       >       `setuptools` to its `build-system.requires`. Otherwise, either add it to
       >       your `pyproject.toml` under:
       >
       >       [tool.uv.extra-build-dependencies]
       >       "atomicwrites-1.4.1" = ["setuptools"]
       >
       >       or `uv pip install setuptools` into the environment and re-run with
       >       `--no-build-isolation`.
       > DEBUG Released lock at `/build/.tmpGVjimy/.lock`

If I cherry-pick #7513, the build completes without this failure.

After that, hermes chat fails with:

Error: no container with name or ID "hermes-agent" found: no such container

My hermes.nix contains:

container = {
  enable = true;
  image = "localhost/hermes-research:2026-04-09-v1";
  backend = "podman";
  extraVolumes = [ "/srv/projects:/projects:rw" ];
};

From my user account, Podman shows no running containers:

[xxx@xxx]$ podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

But the container does exist under sudo:

[xxx@xxx]$ sudo podman ps
CONTAINER ID  IMAGE                                    COMMAND               CREATED       STATUS         PORTS       NAMES
1b6816c1671a  localhost/hermes-research:2026-04-09-v1  /data/current-pac...  11 hours ago  Up 11 minutes              hermes-agent

So the managed container is running as root, not under my user. hermes chat appears to look for a user-owned Podman container and does not find the root-owned one.

If I start a separate container under my own user with:

podman run -d --name hermes-agent --replace localhost/hermes-research:2026-04-09-v1 sleep infinity

then hermes chat gets past the missing-container error, but fails with:

Error: unable to find user hermes: no matching entries in passwd file

i'll wait to hear thoughts before going further -- can do some more tests if helpful

@nousr

nousr commented Apr 11, 2026

Copy link
Copy Markdown

rebased off main to include #7518 -- still got the

Error: no container with name or ID "hermes-agent" found: no such container

@alt-glitch
alt-glitch force-pushed the feat/container-aware-cli-clean branch from 40dc41c to ac809a7 Compare April 11, 2026 08:38
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@alt-glitch
alt-glitch force-pushed the feat/container-aware-cli-clean branch 2 times, most recently from 78783f0 to 2816de8 Compare April 11, 2026 08:49
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

…ged container

When container.enable = true, the host `hermes` CLI transparently execs
every subcommand into the managed Docker/Podman container. A symlink
bridge (~/.hermes -> /var/lib/hermes/.hermes) unifies state between host
and container so sessions, config, and memories are shared.

CLI changes:
- Global routing before subcommand dispatch (all commands forwarded)
- docker exec with -u exec_user, env passthrough (TERM, COLORTERM,
  LANG, LC_ALL), TTY-aware flags
- Retry with spinner on failure (TTY: 5s, non-TTY: 10s silent)
- Hard fail instead of silent fallback
- HERMES_DEV=1 env var bypasses routing for development
- No routing messages (invisible to user)

NixOS module changes:
- container.hostUsers option: lists users who get ~/.hermes symlink
  and automatic hermes group membership
- Activation script creates symlink bridge (with backup of existing
  ~/.hermes dirs), writes exec_user to .container-mode
- Cleanup on disable: removes symlinks + .container-mode + stops service
- Warning when hostUsers set without addToSystemPackages
@alt-glitch
alt-glitch force-pushed the feat/container-aware-cli-clean branch from 2816de8 to 79e8cd1 Compare April 11, 2026 08:54
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@nousr thanks for testing! Both issues are now addressed in the latest push (79e8cd12):

1. atomicwrites build failure — This was because the branch predated #7488 (mautrix migration). Now rebased on main which includes that fix, so nix build works cleanly.

2. Podman "no container with name or ID" error — This is a Podman rootful vs rootless namespace issue. The NixOS systemd service runs the container as root, but podman ps / podman exec from your regular user only sees user-owned containers (unlike Docker, which has group-based socket access).

The CLI now probes whether the runtime can see the container. If it can't, it tries sudo -n (passwordless sudo). If that works, all exec commands go through sudo transparently. If neither works, you get a clear error message with the exact NixOS config to add:

Error: container 'hermes-agent' not found via podman.

The NixOS service runs the container as root. Your user cannot
see it because podman uses per-user namespaces.

Fix: grant passwordless sudo for podman:

  security.sudo.extraRules = [{
    users = [ "your-user" ];
    commands = [{ command = "/run/current-system/sw/bin/podman"; options = [ "NOPASSWD" ]; }];
  }];

Or run: sudo hermes chat

Add this to your NixOS config and rebuild:

security.sudo.extraRules = [{
  users = [ "nousr" ];
  commands = [{
    command = "/run/current-system/sw/bin/podman";
    options = [ "NOPASSWD" ];
  }];
}];

After that, hermes chat should work transparently — the CLI auto-detects it needs sudo and uses it.

3. "unable to find user hermes" — Also fixed. The exec function now uses subprocess.run instead of os.execvp, so it can detect and retry on docker/podman exit codes 125-127 (container not ready, user not found, etc.). This handles the race condition during container startup where the entrypoint hasn't created the hermes user yet.

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

Comment thread hermes_cli/main.py Outdated
Comment thread nix/nixosModules.nix Outdated
- hermes_cli/main.py: reuse the existing `sudo` variable instead of
  redundant `shutil.which("sudo")` call that could return None
- nix/nixosModules.nix: add missing `chown -h` when updating an
  existing symlink target so ownership stays consistent with the
  fresh-create and backup-replace branches
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

Comment thread hermes_cli/main.py Outdated
Comment thread nix/nixosModules.nix Outdated
Comment thread nix/nixosModules.nix
- hermes_cli/main.py: move container routing BEFORE parse_args() so
  --help, unrecognised flags, and all subcommands are forwarded
  transparently into the container instead of being intercepted by
  argparse on the host (high severity)

- nix/nixosModules.nix: resolve home dirs via
  config.users.users.${user}.home instead of hardcoding /home/${user},
  supporting users with custom home directories (medium severity)

- nix/nixosModules.nix: gate hostUsers group membership on
  container.enable so setting hostUsers without container mode doesn't
  silently add users to the hermes group (low severity)
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

- Replace subprocess.run retry loop with os.execvp (no idle parent process)
- Extract _probe_container helper for sudo detection with 15s timeout
- Narrow exception handling: FileNotFoundError only in get_container_exec_info,
  catch TimeoutExpired specifically, remove silent except Exception: pass
- Collapse needs_sudo + sudo into single sudo_path variable
- Simplify NixOS symlink creation from 4 branches to 2
- Gate NixOS sudoers hint with "On NixOS:" prefix
- Full test rewrite: 18 tests covering execvp, sudo probe, timeout, permissions
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e793c70. Configure here.

@alt-glitch
alt-glitch merged commit cab814a into main Apr 11, 2026
5 of 8 checks passed
@alt-glitch
alt-glitch deleted the feat/container-aware-cli-clean branch April 11, 2026 23:47
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
…ousResearch#7543)

* feat(nix): container-aware CLI — auto-route all subcommands into managed container

When container.enable = true, the host `hermes` CLI transparently execs
every subcommand into the managed Docker/Podman container. A symlink
bridge (~/.hermes -> /var/lib/hermes/.hermes) unifies state between host
and container so sessions, config, and memories are shared.

CLI changes:
- Global routing before subcommand dispatch (all commands forwarded)
- docker exec with -u exec_user, env passthrough (TERM, COLORTERM,
  LANG, LC_ALL), TTY-aware flags
- Retry with spinner on failure (TTY: 5s, non-TTY: 10s silent)
- Hard fail instead of silent fallback
- HERMES_DEV=1 env var bypasses routing for development
- No routing messages (invisible to user)

NixOS module changes:
- container.hostUsers option: lists users who get ~/.hermes symlink
  and automatic hermes group membership
- Activation script creates symlink bridge (with backup of existing
  ~/.hermes dirs), writes exec_user to .container-mode
- Cleanup on disable: removes symlinks + .container-mode + stops service
- Warning when hostUsers set without addToSystemPackages

* fix: address review — reuse sudo var, add chown -h on symlink update

- hermes_cli/main.py: reuse the existing `sudo` variable instead of
  redundant `shutil.which("sudo")` call that could return None
- nix/nixosModules.nix: add missing `chown -h` when updating an
  existing symlink target so ownership stays consistent with the
  fresh-create and backup-replace branches

* fix: address remaining review items from cursor bugbot

- hermes_cli/main.py: move container routing BEFORE parse_args() so
  --help, unrecognised flags, and all subcommands are forwarded
  transparently into the container instead of being intercepted by
  argparse on the host (high severity)

- nix/nixosModules.nix: resolve home dirs via
  config.users.users.${user}.home instead of hardcoding /home/${user},
  supporting users with custom home directories (medium severity)

- nix/nixosModules.nix: gate hostUsers group membership on
  container.enable so setting hostUsers without container mode doesn't
  silently add users to the hermes group (low severity)

* fix: simplify container routing — execvp, no retries, let it crash

- Replace subprocess.run retry loop with os.execvp (no idle parent process)
- Extract _probe_container helper for sudo detection with 15s timeout
- Narrow exception handling: FileNotFoundError only in get_container_exec_info,
  catch TimeoutExpired specifically, remove silent except Exception: pass
- Collapse needs_sudo + sudo into single sudo_path variable
- Simplify NixOS symlink creation from 4 branches to 2
- Gate NixOS sudoers hint with "On NixOS:" prefix
- Full test rewrite: 18 tests covering execvp, sudo probe, timeout, permissions

---------

Co-authored-by: Hermes Agent <hermes@nousresearch.com>
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…ousResearch#7543)

* feat(nix): container-aware CLI — auto-route all subcommands into managed container

When container.enable = true, the host `hermes` CLI transparently execs
every subcommand into the managed Docker/Podman container. A symlink
bridge (~/.hermes -> /var/lib/hermes/.hermes) unifies state between host
and container so sessions, config, and memories are shared.

CLI changes:
- Global routing before subcommand dispatch (all commands forwarded)
- docker exec with -u exec_user, env passthrough (TERM, COLORTERM,
  LANG, LC_ALL), TTY-aware flags
- Retry with spinner on failure (TTY: 5s, non-TTY: 10s silent)
- Hard fail instead of silent fallback
- HERMES_DEV=1 env var bypasses routing for development
- No routing messages (invisible to user)

NixOS module changes:
- container.hostUsers option: lists users who get ~/.hermes symlink
  and automatic hermes group membership
- Activation script creates symlink bridge (with backup of existing
  ~/.hermes dirs), writes exec_user to .container-mode
- Cleanup on disable: removes symlinks + .container-mode + stops service
- Warning when hostUsers set without addToSystemPackages

* fix: address review — reuse sudo var, add chown -h on symlink update

- hermes_cli/main.py: reuse the existing `sudo` variable instead of
  redundant `shutil.which("sudo")` call that could return None
- nix/nixosModules.nix: add missing `chown -h` when updating an
  existing symlink target so ownership stays consistent with the
  fresh-create and backup-replace branches

* fix: address remaining review items from cursor bugbot

- hermes_cli/main.py: move container routing BEFORE parse_args() so
  --help, unrecognised flags, and all subcommands are forwarded
  transparently into the container instead of being intercepted by
  argparse on the host (high severity)

- nix/nixosModules.nix: resolve home dirs via
  config.users.users.${user}.home instead of hardcoding /home/${user},
  supporting users with custom home directories (medium severity)

- nix/nixosModules.nix: gate hostUsers group membership on
  container.enable so setting hostUsers without container mode doesn't
  silently add users to the hermes group (low severity)

* fix: simplify container routing — execvp, no retries, let it crash

- Replace subprocess.run retry loop with os.execvp (no idle parent process)
- Extract _probe_container helper for sudo detection with 15s timeout
- Narrow exception handling: FileNotFoundError only in get_container_exec_info,
  catch TimeoutExpired specifically, remove silent except Exception: pass
- Collapse needs_sudo + sudo into single sudo_path variable
- Simplify NixOS symlink creation from 4 branches to 2
- Gate NixOS sudoers hint with "On NixOS:" prefix
- Full test rewrite: 18 tests covering execvp, sudo probe, timeout, permissions

---------

Co-authored-by: Hermes Agent <hermes@nousresearch.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ousResearch#7543)

* feat(nix): container-aware CLI — auto-route all subcommands into managed container

When container.enable = true, the host `hermes` CLI transparently execs
every subcommand into the managed Docker/Podman container. A symlink
bridge (~/.hermes -> /var/lib/hermes/.hermes) unifies state between host
and container so sessions, config, and memories are shared.

CLI changes:
- Global routing before subcommand dispatch (all commands forwarded)
- docker exec with -u exec_user, env passthrough (TERM, COLORTERM,
  LANG, LC_ALL), TTY-aware flags
- Retry with spinner on failure (TTY: 5s, non-TTY: 10s silent)
- Hard fail instead of silent fallback
- HERMES_DEV=1 env var bypasses routing for development
- No routing messages (invisible to user)

NixOS module changes:
- container.hostUsers option: lists users who get ~/.hermes symlink
  and automatic hermes group membership
- Activation script creates symlink bridge (with backup of existing
  ~/.hermes dirs), writes exec_user to .container-mode
- Cleanup on disable: removes symlinks + .container-mode + stops service
- Warning when hostUsers set without addToSystemPackages

* fix: address review — reuse sudo var, add chown -h on symlink update

- hermes_cli/main.py: reuse the existing `sudo` variable instead of
  redundant `shutil.which("sudo")` call that could return None
- nix/nixosModules.nix: add missing `chown -h` when updating an
  existing symlink target so ownership stays consistent with the
  fresh-create and backup-replace branches

* fix: address remaining review items from cursor bugbot

- hermes_cli/main.py: move container routing BEFORE parse_args() so
  --help, unrecognised flags, and all subcommands are forwarded
  transparently into the container instead of being intercepted by
  argparse on the host (high severity)

- nix/nixosModules.nix: resolve home dirs via
  config.users.users.${user}.home instead of hardcoding /home/${user},
  supporting users with custom home directories (medium severity)

- nix/nixosModules.nix: gate hostUsers group membership on
  container.enable so setting hostUsers without container mode doesn't
  silently add users to the hermes group (low severity)

* fix: simplify container routing — execvp, no retries, let it crash

- Replace subprocess.run retry loop with os.execvp (no idle parent process)
- Extract _probe_container helper for sudo detection with 15s timeout
- Narrow exception handling: FileNotFoundError only in get_container_exec_info,
  catch TimeoutExpired specifically, remove silent except Exception: pass
- Collapse needs_sudo + sudo into single sudo_path variable
- Simplify NixOS symlink creation from 4 branches to 2
- Gate NixOS sudoers hint with "On NixOS:" prefix
- Full test rewrite: 18 tests covering execvp, sudo probe, timeout, permissions

---------

Co-authored-by: Hermes Agent <hermes@nousresearch.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ousResearch#7543)

* feat(nix): container-aware CLI — auto-route all subcommands into managed container

When container.enable = true, the host `hermes` CLI transparently execs
every subcommand into the managed Docker/Podman container. A symlink
bridge (~/.hermes -> /var/lib/hermes/.hermes) unifies state between host
and container so sessions, config, and memories are shared.

CLI changes:
- Global routing before subcommand dispatch (all commands forwarded)
- docker exec with -u exec_user, env passthrough (TERM, COLORTERM,
  LANG, LC_ALL), TTY-aware flags
- Retry with spinner on failure (TTY: 5s, non-TTY: 10s silent)
- Hard fail instead of silent fallback
- HERMES_DEV=1 env var bypasses routing for development
- No routing messages (invisible to user)

NixOS module changes:
- container.hostUsers option: lists users who get ~/.hermes symlink
  and automatic hermes group membership
- Activation script creates symlink bridge (with backup of existing
  ~/.hermes dirs), writes exec_user to .container-mode
- Cleanup on disable: removes symlinks + .container-mode + stops service
- Warning when hostUsers set without addToSystemPackages

* fix: address review — reuse sudo var, add chown -h on symlink update

- hermes_cli/main.py: reuse the existing `sudo` variable instead of
  redundant `shutil.which("sudo")` call that could return None
- nix/nixosModules.nix: add missing `chown -h` when updating an
  existing symlink target so ownership stays consistent with the
  fresh-create and backup-replace branches

* fix: address remaining review items from cursor bugbot

- hermes_cli/main.py: move container routing BEFORE parse_args() so
  --help, unrecognised flags, and all subcommands are forwarded
  transparently into the container instead of being intercepted by
  argparse on the host (high severity)

- nix/nixosModules.nix: resolve home dirs via
  config.users.users.${user}.home instead of hardcoding /home/${user},
  supporting users with custom home directories (medium severity)

- nix/nixosModules.nix: gate hostUsers group membership on
  container.enable so setting hostUsers without container mode doesn't
  silently add users to the hermes group (low severity)

* fix: simplify container routing — execvp, no retries, let it crash

- Replace subprocess.run retry loop with os.execvp (no idle parent process)
- Extract _probe_container helper for sudo detection with 15s timeout
- Narrow exception handling: FileNotFoundError only in get_container_exec_info,
  catch TimeoutExpired specifically, remove silent except Exception: pass
- Collapse needs_sudo + sudo into single sudo_path variable
- Simplify NixOS symlink creation from 4 branches to 2
- Gate NixOS sudoers hint with "On NixOS:" prefix
- Full test rewrite: 18 tests covering execvp, sudo probe, timeout, permissions

---------

Co-authored-by: Hermes Agent <hermes@nousresearch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants