Skip to content

Windows sandbox: subprocess fails to find executables because sandbox env drops parent PATH #46645

Open

Description

@cc0815

markdown 受影响版本: hermes-agent 0.16.0 (你改成你装的版本号 —— 终端跑 hermes --version 看)

问题: Windows 上 hermes 命令在沙盒子进程里运行报错: FileNotFoundError: [WinError 2] 系统找不到指定的文件

复现:

Windows 装 hermes-agent
沙盒里**跑 hermes --version 或 hermes gateway status
报错(即使 hermes.exe 在 PATH 里)
根因: hermes-agent 自己的 subprocess 调用(_subprocess_compat.py + gateway_windows.py L654/L671)都正确构造了 env 字典传递给 Popen。 但沙盒子进程调 subprocess.run(['hermes', ...]) 时 env 字典没有父进程的 PATH, 子进程找不到 hermes.exe。

建议修复**: 沙盒子进程调 subprocess.run() 之前构造 env 字典传递** PATH**:

import os env = os.environ.copy() # 关键:继承父进程 PATH result = subprocess.run([...], env=env, ...)

相关** issue**:

Windows: uv.exe spawns blank console window on every subprocess invocation
[Windows] subprocess.Popen creationflags double-pass bug
环境: Windows 11(改成你的 Windows 版本), Python 3.11.15, hermes-agent 0.16.0(改成你的版本)

两处你要改的**:

"受影响版本" 行:改成你的版本号(你终端跑** hermes --version 看)**
"环境**" 行末尾:把 "** Windows 11**" 改成你的** Windows 版本**(桌面右键此电脑 → 属性** 看**)**_

Activity

  1. added
    type/bugSomething isn't working
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    P2Medium — degraded but workaround exists
    on Jun 15, 2026
  2. GottZ commented on Jul 30, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    One PR addresses #46645. #46691 targets the reported cause by preserving mixed-case Windows environment keys such as Path, but its unconditional normalization also changes the established case-sensitive POSIX behavior.

    Related pull requests

    Suggested consolidation

    Keep #46691 open with a salvage path: retain its Windows mixed-case environment-key fix and regression coverage, but revise the implementation so safe-prefix normalization occurs only when is_windows=True; update the POSIX lowercase test and equivalence fixture accordingly. This reconciles the verify verdict of partial_fix with the contributor's keep_open review, and there are no duplicate PRs to close.

    Complex graph

    flowchart LR
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I46645(["issue #46645 (open)"])
        P46691["PR #46691 (open)"]
        P46691 -.->|partial| I46645
        class I46645 open
        class I46645 target
        class P46691 open
        click I46645 "https://github.com/NousResearch/hermes-agent/issues/46645"
        click P46691 "https://github.com/NousResearch/hermes-agent/pull/46691"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

    Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 2 kB of issue/PR text, 1 kB of discussion (1 comments), 1 verify verdict. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointtool/code-execexecute_code sandboxtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions