Skip to content

fix(setup): retain Hermes YAML scalar source during updates - #3568

Merged
N0zoM1z0 merged 2 commits into
mainfrom
review/hermes-yaml-3102-20261014
Oct 14, 2026
Merged

N0zoM1z0 merged 2 commits into
mainfrom
review/hermes-yaml-3102-20261014

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Updating a Hermes registration could discard quoting on unchanged YAML 1.2 string keys such as "ON" and "YES". The actual Hermes C loader then saw duplicate boolean keys and switched to its pure fallback. Unchanged notifications: on consequently changed from boolean True to string "on", despite its source bytes remaining identical.

Follow-up to #3102 and main's independent fix 66536d0. This addresses a separately reproduced representation loss, not the already-fixed default YAML 1.1 off case.

Change and scope

  • Keep source nodes for unchanged scalars, mapping keys and sequence elements at HermesConfigurationYaml, the existing format owner.
  • Match string keys with a linear lookup when replacing mappings; avoid a second interpretation in consumers.
  • Quote newly created YAML 1.2 strings for YAML 1.1 compatibility. Preserve the library's existing formatting for direct scalar edits, including octal numbers.
  • Extend the public CLI regression to default 1.1 and explicit 1.2 with both quoted and plain string keys, covering both existing loader-selection directions.

No new CLI/MCP, Evidence, package or target-execution contract. This is an ordinary configuration fix within existing scope; no additional capability decision is applicable. Writes retain the existing setup approval, backup and idempotence boundaries.

Executed evidence

Linux; Node 24.18.0 / npm 11.16.0; real Hermes loader with ruamel.yaml 0.18.16 / C extension 0.2.15. Upstream's current main had the identical loader blob when checked.

  • Before: real public CLI + actual safe_load observed True → "on". The new CLI regression failed against main's compiled runtime with duplicate YAML 1.1 keys. The initial quote-only experiment also failed the reverse direction; retaining source nodes fixes that producing boundary.
  • After: 50 related tests across three files passed; the final producer suite passed all eight tests, including two additional goldens for sequence quoting and explicit key/value tags. Those exact goldens failed on unchanged main (2 failed / 6 passed). npm run check passed all six tasks and architecture guards. After rebasing onto fresh main 569ef41, changed production/test files remained byte-identical and npm run check:fast passed; it also passed again after the final test-only commit.
  • 15 actual public CLI calls: three valid configurations each passed dry-run/apply/doctor/repeat. The Python consumer preserved all 12 string environment values, exact large integer 9876543210987654321, timestamp precision/offset, original backup and repeated-setup bytes. Three non-string env cases returned needs_human/exit 1 without changing the configuration or creating a backup.
  • Verification used owned temporary homes and inspected planned targets before writes; personal configurations were not changed. No running Hermes agent, model request, or native Windows/macOS client session was verified. Permanent CI coverage models the observed C-reader schema; actual Python-loader evidence was run independently.

Performance and limitations

Mapping reconciliation is linear in the replaced mapping and traverses existing YAML nodes. No new tool fields, analysis payload or cache are introduced. Agent tokens were not measured. Single fresh-process CLI observations: first plan 2.15 s; repeated setup 1.88 s; JSON output 5.3–10.5 KB. The equivalent completed default-1.1 four-call workflow took 8.39 s on main and 8.57 s with the fix; all four stdout byte counts were unchanged. These single trials are observations rather than a speedup claim.

Serial two-CPU / 8 GiB validation: related suites peaked at 3.11 GiB, static checks at 4.33 GiB; 15-call CLI probe took 33.90 s, user/system CPU 33.99/7.32 s and sampled peak family RSS 415 MiB. No guard stop or OOM.

Existing upstream limitation: removing a configuration block that made the C loader reject can still switch Hermes's reader and alter interpretation of other ambiguous YAML 1.2 scalars. A production-serializer removal probe with the actual Python loader reproduced this on both unchanged main and this patch; the public uninstall CLI was not exercised for that explicit-1.2 case. This PR prevents source loss during registration replacement; it does not establish universal equivalence between Hermes's C and pure readers.

Author readiness

Human owner: @N0zoM1z0

Recorded from the owner's explicit standing declarations for the remaining approved bug-fix batch. Technical review and the executed evidence above were performed by the agent; ownership remains with the named human.

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

Replacing a registration discarded quoting on unchanged YAML 1.2 string
keys. Hermes' YAML 1.1 C reader could then reject duplicate boolean keys
and fall back to its directive-aware pure reader, changing how unrelated
settings were interpreted.

Retain unchanged scalar nodes and string-key source at the YAML owner,
using linear mapping lookup. Quote newly created YAML 1.2 strings for
YAML 1.1 compatibility and preserve direct numeric edit formatting.
Cover both existing reader-selection directions through public CLI tests
and independently verify with the actual Hermes Python loader.

Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: gensokyo-dev <[email protected]>
@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 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the added tests address the previous finding.

Summary

This PR keeps unchanged YAML scalar nodes when replacing Hermes registrations, preserving quotes and explicit tags. It also quotes new YAML 1.2 strings for Hermes’s YAML 1.1 reader.

  • Hermes registration updates keep unchanged YAML values in their original form.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Replace Hermes registration] --> B[Create replacement YAML nodes]
  B --> C[Match existing mapping keys and sequence positions]
  C --> D[Reuse unchanged scalar nodes]
  D --> E[Preserve original quotes and tags]
  E --> F[Write updated configuration]
  B --> G[Quote new YAML 1.2 strings]
  G --> F
Loading

Reviews (2) · Last reviewed commit: "test(setup): lock Hermes scalar tags and..." · Reviewed by Greptile

Prove registration replacement keeps a caller-selected quoted argument
and explicit string tags on unchanged environment keys and values. Both
goldens fail against unchanged main and pass with the source-owner fix.

Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: gensokyo-dev <[email protected]>
@N0zoM1z0
N0zoM1z0 merged commit 93e75bc into main Oct 14, 2026
36 checks passed
@N0zoM1z0
N0zoM1z0 deleted the review/hermes-yaml-3102-20261014 branch October 14, 2026 16:58
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration 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: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants