Repository navigation
fix(hermes): match config items with inline comments - #1030
Conversation
The plugins.enabled / plugins.disabled item scan compared raw line text, so
a YAML inline comment became part of the value it matched against. Three
concrete failures followed on configs users can edit by hand:
- an existing enabled entry carrying a comment ("agency-agents-router # x")
was not recognized, so the plugin was appended a second time;
- a stale disabled entry carrying a comment was not removed, so the
installer reported "enabled plugin ... in config.yaml" while the plugin
stayed disabled;
- the corrupted-glue repair counted "- " in the whole line, so a comment
containing " - " was split into fake list entries: the installer silently
rewrote a comment such as "# keep - rotate this one first" into two
enabled entries.
Strip a trailing YAML comment ("#" only starts one after whitespace) before
matching, counting, and splitting, and use the same value helper in the
post-repair re-check so a quoted entry is recognized too. No config format
or install behavior change beyond those shapes.
check-hermes-config-rewrite.py gains four cases for them plus two general
invariants: the plugin appears exactly once, and the writer may not gain or
lose unrelated enabled entries outside the documented glue repair. The
suite fails on the previous code with exactly those four cases and passes
with this patch.
|
I tested this PR against All three failures in the description reproduce on
The fourth row is not in the description, but the fix covers it too. The new test catches the bug. With Also unchanged by this PR, and the same on both sides: a header comment ( Not tested: a full |
Independent verification on the PR (phant0um) covered an existing quoted entry with an inline comment (`- "agency-agents-router" # quoted`). The fix recognizes it through the comment-stripped item value; pin that shape so it cannot regress. On the previous code the extended suite fails with this case plus the original four; with the fix all 21 cases pass.
|
Thanks for the independent verification, @phant0um — your table matches my local runs exactly, including the quoted row, and I've pinned that one in the suite. Quoted + comment case. Added as a 21st case in
disabled:with no items when the plugin was the only entry, and Same caveat as yours: a full |
…nts) Curated sync of the open upstream pull requests as of 2026-10-06: - Script and CI fixes: msitarzewski#1055, msitarzewski#1030, msitarzewski#865, msitarzewski#860, msitarzewski#967, msitarzewski#870, msitarzewski#869, msitarzewski#889, msitarzewski#1056, msitarzewski#755, msitarzewski#868, msitarzewski#771, msitarzewski#867; ported msitarzewski#523, msitarzewski#512 and the permissions part of msitarzewski#790. - Existing-agent fixes: msitarzewski#1033-msitarzewski#1052, msitarzewski#1053, msitarzewski#1054, msitarzewski#1023, msitarzewski#756-msitarzewski#759, msitarzewski#799, msitarzewski#805, msitarzewski#715, msitarzewski#752, msitarzewski#784, msitarzewski#793, msitarzewski#858, msitarzewski#812, msitarzewski#789, msitarzewski#1007. - New agents: msitarzewski#702, msitarzewski#707, msitarzewski#731, msitarzewski#732, msitarzewski#764, msitarzewski#848, msitarzewski#859, msitarzewski#862, msitarzewski#863, msitarzewski#886, msitarzewski#908, msitarzewski#982-msitarzewski#985, msitarzewski#1031, msitarzewski#1032. - Docs: msitarzewski#577, msitarzewski#743, msitarzewski#762, msitarzewski#785, msitarzewski#786, msitarzewski#815, msitarzewski#816. Fixes found while integrating: Bash 3.2 guard for the msitarzewski#755 worker argv, Windsurf re-conversion over a stale .windsurfrules, locale-independent check-divisions.sh, agency- prefix handling in the outputs eval, and the India Business Navigator's YAML and headings. Resolves upstream issues msitarzewski#229, msitarzewski#763, msitarzewski#821 and msitarzewski#1027. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NwgfpJ9tGbUh5g84u5VSgv
|
Merged — thank you, @Tong-bit-art. Another real one, in code we wrote: the raw-line compare in the Hermes rewrite has been there since #881. Verified in real Hermes (v0.21.5, configs written by
And thank you, @phant0um, for the independent before/after run. Your question about the null |
What does this PR do?
ensure_hermes_plugin_enabled()inscripts/install.shscans theplugins.enabled/plugins.disableditem lines and compared raw linetext against
agency-agents-router, so a YAML inline comment became partof the value it matched. In YAML a
#only starts a comment when it followswhitespace, and users do put comments on plugin entries.
Three concrete failures on a hand-editable config, all reproduced with the
real heredoc extracted from current main (
8329468):- agency-agents-router # our routerwasnot recognized as an existing entry, so the writer appended the plugin a
second time.
- agency-agents-router # temporarily offunderdisabled:was notremoved, while the installer printed
Hermes: enabled plugin agency-agents-router in <config>.-inthe whole line, so a comment containing
-tripped it and its textbecame list entries:
yaml.safe_loadconfirms the enabled list gained the literal stringrotate this one first.The fix strips a trailing YAML comment before matching, counting, and
splitting (
strip_comment/item_valuehelpers), and the post-repairre-check now recognizes a quoted entry too —
- basic - "agency-agents-router"previously produced another duplicate. Comments on untouched lines stay
because the writer only appends; nothing about the config format changes.
Agent Information (if adding/modifying an agent)
Not applicable — installer fix; no agent file added or changed.
scripts/install.sh, Hermes config writer)~/.hermes/config.yamlReproduction and validation
Reproduced by extracting the real heredoc from
scripts/install.shandrunning it against the shapes above. What main does, per case:
scripts/check-hermes-config-rewrite.py(run by the Check Hermes ConfigRewrite workflow) gains four cases for these shapes plus two general
invariants:
enabled;enabledentries, with thedocumented legacy glue repair as the only exception.
On current main the extended suite fails with exactly the four new cases;
with this patch all 20 cases pass, including the existing 16 and their
idempotent re-runs.
Validation on the exact commit:
scripts/check-hermes-config-rewrite.sh: 20/20;test-install.sh,test-install-hermes-destination.shand the stricttest-convert-outputs.sh(zero manifest drift);bash -n scripts/install.sh, Python syntax andgit diff --check: clean;plugins:keyline, CRLF config, comment lines inside the list, quoted entries in both
lists — all clean after the fix.
Scope notes
the same (
-count after the dash instead of in the whole line) and theexisting 16 cases still pass unchanged.
AI assistance was used in preparing this patch; the reproduction and test
runs above were executed locally.