Skip to content

gateway/run.py clobbers resolved TERMINAL_CWD with raw config value '.' #4672

@HenkDz

Description

@HenkDz

Bug

When launching hermes from a project directory (e.g. /mnt/e/Projects/AI/myproject), the terminal always opens in $HOME instead of the launch directory, even when terminal.cwd: "." is set in config.yaml.

Root Cause

Two separate code paths bridge config.yaml terminal settings to TERMINAL_CWD env var:

  1. cli.py (line 335-338): Correctly resolves cwd: "."os.getcwd() → sets TERMINAL_CWD to the absolute path (e.g. /mnt/e/Projects/AI/myproject)
  2. gateway/run.py (line 132-138): Later imported as a plugin during the same startup. Re-reads the raw cwd: "." from config.yaml and blindly sets os.environ["TERMINAL_CWD"] = ".", overwriting the resolved value.
  3. gateway/run.py (line 208-211): Sees TERMINAL_CWD is ".", treats it as unresolved, falls back to Path.home().

Reproduction

cd /mnt/e/Projects/AI/myproject
hermes chat -q "pwd"
# Shows /home/user instead of /mnt/e/Projects/AI/myproject

Environment

  • WSL2 on Windows
  • terminal.cwd: "." in config.yaml (the default)
  • terminal.backend: local

Fix

Skip the cwd key in gateway/run.py's terminal env bridge when TERMINAL_CWD is already set to an absolute path. See PR #XXXX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions