fix(codex-runtime): pin hermes-tools MCP launch context - #32812
Conversation
a15f3f5 to
c61df30
Compare
|
Refresh update: I rebased this branch onto current Updated head: Targeted local verification on the updated head:
GitHub Actions is still blocked at the fork workflow approval gate ( |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing a real launch-context gap: current main's hermes_cli/codex_runtime_plugin_migration.py:557-606 still emits a callback without a cwd and only propagates PYTHONPATH when it was already set.
Problems
hermes_cli/codex_runtime_plugin_migration.py:566ordersvenv/bin/python3before.venv/bin/python3.AGENTS.md:216establishes.venvas the preferred checkout environment, and current main contains both executable paths. This can select a different environment than the documented one for the MCP callback.
Suggested changes
- Put
.venvcandidates ahead ofvenvon POSIX and Windows, and cover the both-present case intests/hermes_cli/test_codex_runtime_plugin_migration.py. - Update the generated-entry example at
website/docs/user-guide/features/codex-app-server-runtime.md:354-359to includecwd.
Automated hermes-sweeper review.
| server has Hermes' optional deps (notably mcp), then fall back to the | ||
| current interpreter for packaged installs. | ||
| """ | ||
| candidates = [ |
There was a problem hiding this comment.
venv is selected before .venv, but AGENTS.md:216 defines .venv as the preferred checkout environment and current main has both. Please put .venv candidates first and add a both-present regression test so the callback does not select a different virtualenv than the documented runtime.
c61df30 to
9c20c53
Compare
|
Thanks — addressed on current head
Targeted verification: Please re-review when convenient. |
Summary
hermes-toolsMCP server entry to the Hermes source root withcwdPYTHONPATHsopython -m agent.transports.hermes_tools_mcp_serverremains importable when Codex starts MCP servers from arbitrary project directoriesvenv/.venvPython for the MCP subprocess, falling back to the current interpreter for packaged installsWhy
Codex can launch configured MCP servers from a project working directory that is not the Hermes checkout. In that case the generated
hermes-toolscallback can fail before the MCP initialize response withModuleNotFoundError: No module named 'agent', surfacing only as a generic MCP handshake failure.Duplicate PR check
I searched open PRs for exact terms around
hermes_tools_mcp_server,hermes-tools,PYTHONPATH,cwd,codex_runtime_plugin_migration, and the initialize-response startup failure. No open PR appears to fix this launch-context issue. Related but non-duplicate PRs include schema/tool-surface work (#26432, #31279), migration rerun behavior (#26532), and generic MCP startup/timeout handling (#29764, #29853, #24508).Tests
/home/dso2ng/.hermes/hermes-agent/venv/bin/python -m pytest tests/hermes_cli/test_codex_runtime_plugin_migration.py -q(71 passed)/home/dso2ng/.hermes/hermes-agent/venv/bin/python -m ruff check hermes_cli/codex_runtime_plugin_migration.py tests/hermes_cli/test_codex_runtime_plugin_migration.py