Repository navigation
fix(hermes): detach aliased server tables before editing - #3785
Conversation
Copy aliased parent mappings before setting or removing a Hermes registration. Resolve references against the original document and remove anchors from the private copies to preserve existing sources and consumers, including shadowed anchor names. Cover YAML 1.1 and 1.2 setup, refresh, doctor readiness, repeated setup and uninstall, along with comments, exact backups and invalid-alias refusal. Fixes morluto#3320
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed changes appear safe to merge. SummaryThe PR lets Hermes edit an aliased
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Requested YAML edit] --> B{Parent is an alias?}
B -->|Yes| C[Copy its original values and remove copied anchors]
C --> D[Replace only the selected parent]
B -->|No| E[Keep the existing parent]
D --> F[Set or delete the selected registration]
E --> F
F --> G{Deletion removed nothing?}
G -->|Yes| H[Return original bytes]
G -->|No| I[Write the edited document]
Reviews (2) · Last reviewed commit: "test(setup): isolate Hermes flows from h..." · Reviewed by Greptile |
baron
left a comment
There was a problem hiding this comment.
Reviewed the YAML producer and its setup/uninstall serialization consumer at f4e0ccd. The fix detaches aliased parent mappings before mutation, resolves aliases against their original bindings, removes anchors from private copies, preserves source consumers, and refuses cyclic/unresolved copied references; successful absent-key deletion preserves the original bytes. No source/design blocker found. The owning source file on latest fetched main is unchanged from the PR base.
Independent validation: all 20 HermesConfigurationYaml owner tests pass on macOS using Node 24.19.0; an additional direct shadowed-anchor/private-copy and exact no-op-byte probe passes. Current-head repository CI was refreshed immediately before this review: CI required, static/source checks, build, five test shards, portable tests and Linux package baseline are green; unrelated conditional lanes are skipped. No installed Hermes-loader, full local acceptance/package, or real-provider verification is claimed.
baron
left a comment
There was a problem hiding this comment.
Additional latest-main integration HOLD at unchanged reviewed head f4e0ccd1d15cdba4d8727080ef4995dfe6da9773; I am not merging it in this batch. Current-head repository CI remains green, and no new production-code defect is asserted.
Against main fc712b3750cbe16755c4f78c1f90fdf09fbaca31, the exact diff applies cleanly, the combined six-PR typecheck passes, and all 20 YAML-owner tests pass. However, ten of twelve public Hermes acceptance tests exceeded their 20-second subprocess or 30-second test deadlines. A bounded isolated rerun of “Hermes YAML 1.2 adds REA in an aliased table without changing its source” again timed out at 30 seconds without useful CLI output.
Host/resource pressure is a possible explanation, but it has not been established as the cause or independently baseline-reproduced for this workflow. I therefore cannot claim verified latest-main setup/uninstall integration from those runs. Please retain the hold until the public workflow is validated on a suitable host or the failure is explained; source-owner unit tests do not substitute for that public boundary. Earlier source/design approval and hosted CI receipts remain valid within their stated scope. No files or PR branches were changed by this review.
|
@baron Thanks for the detailed integration review. I investigated the timeout with a controlled baseline/patch comparison. On Windows x64 with Node 24.18.0, using the original 20-second subprocess and 30-second test deadlines:
The existing Linux CI also records 12/12 acceptance tests passing at the unchanged PR head. These results do not reproduce the macOS timeouts or establish host contention as the cause. I couldn't reconstruct the six-PR integration state without its exact refs and logs, so that remains unverified. No source changes, timeout increases, or additional commits were made. A matching macOS baseline/patch comparison would still be needed to explain the HOLD. Thanks again for reviewing this. |
|
TL;DR: The unit fix works. On current main, 12 of the 20 tests in the changed unit file fail. On this branch, all 20 pass. ResultsI ran one file (
The failing tests delete an absent key from an aliased table. They run on YAML 1.1 and 1.2. Some cases use nested aliases. Some use shadowed anchors or shared users of one table. One is a flow table with CRLF line ends. They also cover the cyclic and unresolved alias cases. On main the source bytes change. On this branch they stay the same. The file has no network calls and does not mention Not run
Thanks, CmsChase, for the fix and for the thorough alias tests. Commandsnpm ci && npm run build && npm run test:prepare
npm run test:focused -- src/application/HermesConfigurationYaml.test.tsFor the "before" run I copied the PR's test file into the extracted main tree. For the "after" run I also copied the PR's source file over main's. Logs are saved with this draft. Test setup🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
@baron Quick follow-up: the second CI attempt for #3785 has completed successfully at the unchanged PR head ( I understand that green repository CI does not by itself resolve the separate macOS/six-PR integration HOLD from your review. The Windows baseline-versus-patch results remain documented in my earlier comment; no source or timeout changes have been made. If there is a specific additional test or reproduction I can provide to help evaluate the outstanding HOLD, I'm happy to do so. Thanks again for the review. |
fix(hermes): detach aliased server tables before editing
Summary
Fixes #3320. Allow approved Hermes setup and owned-registration removal to edit an aliased
mcp_serverstable while preserving its source and other consumers.Problem and expected behavior
Hermes configuration admission resolves
mcp_servers: *serversinto a valid mapping, but the YAML writer cannot edit an Alias node as a collection. Setup can create a backup and then fail withneeds_human; uninstall of an owned registration in that table also fails. Both operations should edit the selected registration without changing the referenced defaults or unrelated consumers.Change and scope
Materialize aliased parent mappings along the edit path. Resolve copied references against the original document and remove anchors from private copies, preserving bindings even when anchor names are reused. Retain source formatting and comments; return the original bytes when a successful deletion removes no node. Cyclic and unresolved copied aliases remain rejected.
This is an ordinary configuration fix within the existing setup/uninstall boundary; an advance maintainer scope decision is not applicable. The separate anchored-registration-leaf problem in explicit tables (#3325) remains outside this change.
Contract and boundary impact
HermesConfigurationYaml, YAML AST editing after configuration admission.ready/aligned, repeated setup plans no actions, and owned uninstall succeeds. No command, schema or catalog change.Expected effects of the changed configuration workflow:
Evidence and regression coverage
Twelve real CLI cases cover add/refresh, repeated setup, doctor, uninstall/repeated uninstall, exact backups, comments, foreign consumers, shadowed anchors and invalid-input refusal across both YAML versions. On unmodified
9a44fea3479a2ad463fdad2b14e86b412717f771, seven fail and five pass; with the fix, all twelve pass.Twenty YAML owner tests pass, including ten exact-byte no-op cases for aliased/nested tables, shadowed anchors, shared consumers and explicit CRLF flow mappings. The implementation without the no-op guard fails all ten byte assertions. Upstream direct alias deletion instead throws a collection error; upstream explicit-map deletion normalizes formatting.
Actual CLI replay confirms aliased-table setup/repeat/doctor exits change from
1/1/1to0/0/0, withready/aligneddiagnostics. Eight additional baseline/fixed absent-registration uninstall calls all return exit 0 andskipped, preserving bytes without creating backups.The same fixed owner/CLI selection passes 32/32 on the separately tested main revision
2a9252e4e6e04d8f24dda816ea61b76c75005e39.Remaining proof gaps: installed Hermes/Python loader, real providers, POSIX, full suite/CI and complete installed-package verification.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
Windows x64, Node 24.18.0, npm 11.16.0, locked dependencies:
npm run test:focused -- src/application/HermesConfigurationYaml.test.ts tests/acceptance/setup/hermesAliasedTableSetup.test.ts— 32 passed. The final test-group-only split was independently rerun: owner 20/20 passed.npm run test:focused -- src/application/HermesConfigurationYaml.test.ts tests/boundary/filesystem/hermesClientConfiguration.test.ts tests/acceptance/setup/hermesClientSetup.test.ts— fixed 62 passed / 2 failed, including twelve new owner cases; unmodified baseline 50 passed / the same 2 failed. Complete failure assertions match: Windows drive-prefix expectations (D:\custom\agentversus\custom\agent, andD:\srv\hermes\config.yamlversus\srv\hermes\config.yaml). Existing Hermes CLI tests pass 13/13 on both.npm run check— passed: typecheck, formatting, lint, knip, metadata, module boundaries and architecture guards; 0 lint errors, with only the same pre-existing timestamp-parser warning in changed files.npm run verify:test-discovery— 1299 test files discovered exactly once.git diff --checkand the normal staged formatting/lint commit hook — passed. The committed changes are byte-identical to the reviewed diff.npm run verify:package/npm run verify:package:windowsruns on baseline and fixed code were blocked by Windowsspawn npm ENOENTand the absentnative/windows/build/manifest.json, respectively. These were not rerun after the YAML-only no-op correction; complete package verification remains unavailable.Compatibility, safety, and release
Author readiness
Human owner: @CmsChase
Before merge
type(scope): outcome.Maintainer blocker verification
The public Hermes acceptance comparison did not reproduce the earlier timeout concern. On this host, current main passed 7/12 cases; the prior PR passed 10/12, with the two remaining failures caused by ambient Hopper autodetection in setup. The test fixture now supplies
HOPPER_LAUNCHER_PATH=process.execPath, isolating the intended setup input without changing production code. All 12 acceptance cases then passed (14.31s), as didnpm run check:fast.These are local CLI/configuration acceptance results, not installed Hermes-client or real-provider verification. Earlier Windows packaging gaps remain unverified by this pass. The former integration hold based on an unexplained timeout is superseded by the completed functional comparison.