fix(plugins): default stdio server cwd to the data root, not the package dir #136283
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.55) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 525 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.375
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #136283"
general
weight: 0.35
PRATHAMESH75
What does this PR do?
A stdio MCP server declared by a plugin without a
cwdfield was translated with its cwd pinned to the plugin's own install directory (hermes_cli/agent_plugins.py::_translate_stdio). On Windows a live process's current directory cannot be renamed, so while that server ran, the rename-aside at the heart of every plugin update (pm/publication.py::StagedPlugin.publish,os.replace(target, backup)) failed with[WinError 32], the update rolled back, and the plugin stayed on its old revision (#136223).This changes the default cwd to the per-plugin data root (
plugin-data/<namespace>), which is the writable, package-external location loading already creates. The fix works for every operation that swaps the plugin tree (update, reinstall, disable/re-enable housekeeping), not just the reportedplugins updatepath, and it needs no new coordination between the CLI publisher and the gateway process that owns the running server.Explicit
cwdvalues (./...,${PLUGIN_ROOT},${PLUGIN_DATA}) are resolved exactly as before; packages that genuinely need to run inside their own tree can still configure that, at the cost of the same Windows rename pin.PLUGIN_ROOT/PLUGIN_DATAenv vars keep pointing plugins at both trees.Related Issue
Fixes #136223
Type of Change
Changes Made
hermes_cli/agent_plugins.py—_translate_stdio: when nocwdis configured, default todata_rootinstead ofplugin_root, with a comment naming the Windows rename pin (#136223). The existingcreate_databranch already creates the data root on load, so the spawned server's cwd always exists.tests/hermes_cli/test_agent_plugins.py— updated the default-cwd assertion intest_loads_manifest_skill_and_stdio_serverand addedtest_stdio_default_cwd_stays_off_the_package_directorypinning the new default (cwd = data root, directory created, never the package dir).How to Test
1.
pytest tests/hermes_cli/test_agent_plugins.py -q— Observed result: 48 passed. With the old default restored,test_loads_manifest_skill_and_stdio_serverandtest_stdio_default_cwd_stays_off_the_package_directoryfail (red/green verified).2.
pytest tests/hermes_cli/test_plugins.py tests/tui_gateway/test_plugins_manage_late_activation.py -q— Observed result: 88 passed.3.
python scripts/check --base <merge-base with upstream/main>— Observed result: 11 checks, ok.4. Windows reproduction of the report (conceptually, per the issue): a plugin whose stdio server is running no longer holds the plugin directory as the server's cwd, so
hermes plugins update <name>can rename the old tree aside and publish the new one.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passpython scripts/checkpasses (the blocking lint and code-health checks CI runs)Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A