Skip to content

fix(hermes): detach aliased server tables before editing - #3785

Merged
morluto merged 2 commits into
morluto:mainfrom
CmsChase:fix/hermes-aliased-server-tables
Oct 22, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
CmsChase:fix/hermes-aliased-server-tables

Conversation

@CmsChase

@CmsChase CmsChase commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

fix(hermes): detach aliased server tables before editing

Summary

Fixes #3320. Allow approved Hermes setup and owned-registration removal to edit an aliased mcp_servers table while preserving its source and other consumers.

Problem and expected behavior

Hermes configuration admission resolves mcp_servers: *servers into a valid mapping, but the YAML writer cannot edit an Alias node as a collection. Setup can create a backup and then fail with needs_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

  • Semantic owner and earliest changed stage: HermesConfigurationYaml, YAML AST editing after configuration admission.
  • Contribution scope fit and linked maintainer decision: ordinary existing client configuration behavior; not applicable.
  • CLI and MCP/tool-catalog contract: aliased-table setup can reach ready/aligned, repeated setup plans no actions, and owned uninstall succeeds. No command, schema or catalog change.
  • Provider, bridge, target-format, or platform compatibility: Hermes YAML 1.1 and explicit 1.2 covered on Windows x64; no installed Hermes loader or POSIX verification.
  • Evidence, artifact, provenance, or reconstruction contract: source mappings, shared consumers, comments, exact backups and successful no-op bytes are covered; no analysis-evidence change.
  • Target selection, authority, upstream behavior, and cleanup details: existing approved setup and owned-registration uninstall determine writes. Missing registrations still skip public uninstall without a backup.
  • Generated metadata, package, or installation impact: no dependency, metadata, package-layout or installation-policy changes.

Expected effects of the changed configuration workflow:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

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/1 to 0/0/0, with ready/aligned diagnostics. Eight additional baseline/fixed absent-registration uninstall calls all return exit 0 and skipped, 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\agent versus \custom\agent, and D:\srv\hermes\config.yaml versus \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 --check and the normal staged formatting/lint commit hook — passed. The committed changes are byte-identical to the reviewed diff.
  • Earlier npm run verify:package / npm run verify:package:windows runs on baseline and fixed code were blocked by Windows spawn npm ENOENT and the absent native/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

  • Breaking changes or migration steps: none intended; valid aliased tables become editable and successful empty deletions preserve source bytes.
  • Real Hopper/Ghidra, browser, or OS coverage: isolated Windows REA CLI configurations; no installed Hermes client, live provider or POSIX claim.
  • Package or release metadata impact: unchanged; packaging limitations are recorded above.
  • Security, privacy, process, or containment review: existing admission/approval/ownership checks remain in force; invalid copied references still fail before publishing an update. No new target execution or network capability.

Author readiness

Human owner: @CmsChase

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

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 did npm 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.

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
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-15T01:07:30.214395Z f4e0ccd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

The PR lets Hermes edit an aliased mcp_servers mapping without changing its source or other consumers. Successful deletions that remove nothing return the original bytes.

  • Hermes edits aliased server tables without changing their shared defaults.

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]
Loading

Reviews (2) · Last reviewed commit: "test(setup): isolate Hermes flows from h..." · Reviewed by Greptile

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

@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:

  • fc712b3 without the fix: 5/12 passed; seven failed quickly due to the original alias-editing error, with no timeouts.
  • The same revision with only Round 7: 12/12 passed.
  • The approved commit and newer main 6fcfc5b5 with Round 7 also passed 12/12.
  • Three isolated YAML 1.2 setup repeats passed in 9.850s, 9.313s, and 7.784s.
  • Running the new and existing Hermes acceptance files together with the normal two-worker configuration passed 25/25.

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.

@CassieFox23

Copy link
Copy Markdown
Contributor

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.

Results

I ran one file (HermesConfigurationYaml.test.ts) with Node 24.18.0 on Linux. The 12 failing tests are all new in this PR. Eight older tests pass on both trees.

Tree Command result Tests
main c7f6b8b, with the PR's test file fail 12 of 20 fail
main c7f6b8b, with the PR's test file and source file pass 20 of 20

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 doctor.

Not run

  • tests/acceptance/setup/hermesAliasedTableSetup.test.ts. It runs doctor --client hermes --json. I do not run doctor on this box.
  • The public Hermes setup and uninstall workflow. So I have not confirmed the fix through the CLI.
  • Any full suite.
  • On this PR, the repo's own CI did run. Its "CI required" check is green. I read that from GitHub and did not rerun it.

Thanks, CmsChase, for the fix and for the thorough alias tests.

Commands
npm ci && npm run build && npm run test:prepare
npm run test:focused -- src/application/HermesConfigurationYaml.test.ts

For 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
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0
  • Head / base: f4e0ccd / c7f6b8b
  • Other: the box was shared with other test agents, and I took no timings.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

Copy link
Copy Markdown
Contributor Author

@baron Quick follow-up: the second CI attempt for #3785 has completed successfully at the unchanged PR head (f4e0ccd), including all five test shards, Portable tests, and the required CI check.

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.

@morluto
morluto merged commit 4a90059 into morluto:main Oct 22, 2026
42 checks passed
@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added area: server Server layer and tool wiring bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: server Server layer and tool wiring bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Hermes setup fails to register REA through an aliased MCP server table

4 participants