Skip to content

fix(setup): preserve Hermes YAML string values - #3102

Closed
shoyann wants to merge 2 commits into
morluto:mainfrom
shoyann:fix/hermes-yaml-string-roundtrip
Closed

shoyann wants to merge 2 commits into
morluto:mainfrom
shoyann:fix/hermes-yaml-string-roundtrip

Conversation

@shoyann

@shoyann shoyann commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Updating a Hermes registration could turn a valid string environment setting into a boolean. For example, REA_MCP_OUTPUT_SCHEMA_PROFILE: "off" became unquoted off; Hermes read false, while REA setup reported ready and doctor reported aligned. Keep the same value and type through setup by using Hermes's YAML rules for both parsing and writing.

No separate issue: this was reproduced through the public CLI while checking configuration round trips.

Problem and expected behavior

Seed a Hermes config.yaml with a stale REA command and the quoted environment value above, then run rea setup --client hermes --skill=false --yes --json. On the base revision, the written value becomes a boolean under Hermes's YAML 1.1 loader. Repeating setup does not repair it.

Expected: preserve string environment values, unrelated settings and the original backup; reject an already non-string environment value before writing.

Change and scope

  • Make HermesConfigurationYaml own the default YAML 1.1 policy for existing and new files. Honor explicit version directives; include the standard timestamp tag because Hermes also resolves dates under YAML 1.2.
  • Keep numeric and timestamp source spellings, including large IDs, octal values, timestamp precision and offsets. Recognize equivalent boolean keys as duplicates.
  • Create ordinary mapping parents when adding an absent server table, avoiding YAML 1.1 ordered-map tags.
  • Route the fresh-file serializer through the same owner. Other client formats are unchanged.

This is an ordinary configuration-correctness fix within existing contribution scope; a new capability scope decision is not applicable.

Contract and boundary impact

  • Semantic owner: HermesConfigurationYaml, used by configuration parsing, editing and fresh serialization.
  • CLI/MCP contract: no new commands, flags or schemas. Invalid typed Hermes environment values now produce the existing invalid-configuration diagnostic.
  • Provider/platform compatibility: Hermes configuration only; no analysis-provider change.
  • Evidence/provenance: no analysis Evidence changes.
  • Authority and cleanup: existing setup approval, backup and write boundaries remain in place.
  • Generated metadata/package impact: no generated or release metadata changes; installed setup behavior is corrected.

Expected effects:

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

The changed behavior reads and writes the selected Hermes configuration through the existing setup workflow.

Evidence and regression coverage

  • Public CLI regression: quoted boolean-like strings, dates, sexagesimal values, numbers, null-like strings and boolean-like keys survive setup; unrelated scalar text and backup remain exact; doctor is aligned and repeated setup makes no changes.
  • Filesystem regressions: a fresh registration preserves off; already typed boolean/date/time environment values are refused without changing the file or creating a backup.
  • Producer coverage: explicit YAML 1.2 directives, timestamp source precision, duplicate boolean keys and edited numbers.
  • Base reproduction: five new regression checks failed against unchanged production at b3c5672c; existing checks passed.
  • Independent consumer check: Hermes's actual safe_load, using isolated ruamel.yaml 0.18.16, reads the pre-fix CLI output as boolean false and the fixed output as string off. PyYAML 6.0.3 agrees for this default-schema case.
  • Remaining proof gap: no running Hermes agent or model request; loader compatibility and actual REA CLI/filesystem behavior were exercised.

Validation performed

  • Pinned Node 24.18.0 / npm 11.16.0 in WSL Ubuntu.
  • Relevant Hermes, setup environment and client lifecycle suites: 119 tests passed.
  • npm run check: passed, including typecheck, lint, formatting, knip, metadata and architecture guards.
  • npm run verify:package: passed, including isolated installation/update, CLI/setup/uninstall and MCP workflows. The first attempt hit the host proxy for a loopback registry fixture; rerunning with loopback-only NO_PROXY/npm noproxy exclusions passed without code or test changes.
  • npm pack --dry-run: passed.
  • git diff --check: passed.

Compatibility, safety, and release

No new dependency, release metadata change or target-execution capability. Previously malformed non-string environment values need to be quoted or otherwise corrected, with the existing source-specific diagnostic. Verification used isolated synthetic homes; no personal client configuration was changed. Linux CLI and the upstream Python loader were exercised; native client sessions on Windows/macOS remain unverified.

Before merge

  • This PR addresses a concrete problem within existing scope.
  • The PR has one focused outcome and a Conventional Commit title.
  • The reason for not linking an issue is stated above.
  • Tests cover observable changes and meaningful failure paths.
  • No public contract or generated documentation update is required.
  • Representative CLI and consumer readback evidence is included.
  • The diff was checked for unrelated changes and unsupported claims.

@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; no actionable correctness or security issue was found.

Summary

This PR gives Hermes configuration one shared YAML policy for reading, editing, and creating files.

  • Hermes setup keeps environment values as strings in config.yaml.

No actionable new issue was found. No previous review threads were supplied. Tests were inspected but not run. Whether this PR has been superseded could not be checked because GitHub access required authentication.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Hermes configuration] --> B[Parse with Hermes YAML rules]
  B --> C[Check configuration and environment values]
  C -->|Invalid| D[Stop without writing]
  C -->|Valid| E{Existing file?}
  E -->|Yes| F[Edit REA entry and retain source text]
  E -->|No| G[Create YAML with the same rules]
  F --> H[Write and read back]
  G --> H
Loading

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@kaoru0822-kitauji kaoru0822-kitauji added the ci-fix-wip Claimed by the CI-fix track label Oct 14, 2026
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI-fix track: none of the failures came from this PR. IDA native admission, the JavaScript semantic tests, headless Chrome cdpSvgXlinkHref and the Linux-only directoryArtifactReaderOwnership order check all broke on main while it was red, and #3080 fixed them. I merged current main (no conflicts) so CI re-runs. The Hermes YAML, setup acceptance and client configuration tests pass on the merged tree (45), and check:fast is clean.

@kaoru0822-kitauji kaoru0822-kitauji added ci-fix-wip Claimed by the CI-fix track and removed ci-fix-wip Claimed by the CI-fix track labels Oct 14, 2026
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI-fix track: this change is already on main via 66536d0 ("preserve Hermes YAML scalar semantics"). It uses one Hermes YAML owner for fresh writes and edits and preserves source scalars and timestamp semantics. After merging current main and resolving the four conflicts, no file differs from main. Main has the identical boundary case (refusing off, 2026-10-14 and 12:34:56 as non-string environment values), and broader unit coverage including YAML directive handling on edits. I didn't push an empty merge. This PR looks safe to close as superseded.

@kaoru0822-kitauji kaoru0822-kitauji removed the ci-fix-wip Claimed by the CI-fix track label Oct 14, 2026
@morluto

morluto commented Oct 14, 2026

Copy link
Copy Markdown
Owner

This PR's behavior is now published on main (8dde637) in 66536d0d2. Thanks @shoyann for the original contribution.

Covered scope: Hermes YAML reads and edits now retain string scalar semantics and refuse YAML-coerced non-string values.

Main evidence: src/application/HermesConfigurationYaml.test.ts; tests/boundary/filesystem/hermesClientConfiguration.test.ts; tests/acceptance/setup/hermesClientSetup.test.ts.

Validation limits: Configuration parsing and setup fixtures only; no external Hermes service behavior is asserted.

I checked the current published source and the substantive review threads; no unique behavior or dependency change remains on this PR. Closing as superseded without resolving individual review threads.

@morluto morluto closed this Oct 14, 2026
@morluto morluto added bug Something isn't working area: setup Setup, packaging, upgrade, install, Doctor, and client registration labels Oct 14, 2026
N0zoM1z0 added a commit that referenced this pull request Oct 14, 2026
Retain source nodes for unchanged scalar values and string keys when
replacing a Hermes registration. Discarding quoted YAML 1.2 keys could
make Hermes' C reader reject duplicate boolean keys and switch to the
pure reader, changing the interpretation of unrelated settings.

Use linear mapping lookup, quote newly created YAML 1.2 strings for
YAML 1.1 compatibility, and preserve direct numeric edit formatting.
Extend actual CLI coverage for both existing reader-selection directions;
verify strings, exact unrelated numeric/timestamp values, backups and
idempotence with the actual Hermes Python loader.

Follow-up to #3102 and main's independent Hermes scalar fix.

Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: gensokyo-dev <[email protected]>
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.

3 participants