fix(install): preserve list-item indent when adding the Hermes plugin; regression test + CI (#714)

ensure_hermes_plugin_enabled() hardcoded a 2-space indent for the inserted `- agency-agents-router` line. Hermes writes plugins.enabled items at 4 spaces, so the new line and the next existing item collapsed into one plain scalar ("agency-agents-router - disk-cleanup") and every previously enabled plugin silently dropped (#839, and #689 diagnosed the same in July). The inserter now matches the existing item indent (default 4), appends after existing entries so order is preserved, and is idempotent on re-run. scripts/check-hermes-config-rewrite.{sh,py} runs seven regression cases; a small workflow runs it on every PR.

Reproduced on main with a 4-space config and verified fixed with this patch; installer suite 36/0; the regression script passes 7/7.

Fixes #839. Closes #689 (same fix, proposed first by @harshsinghmp).

Co-Authored-By: Harsh Singh <32476777+harshsinghmp@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jonathan J Wagner
2026-09-06 15:47:19 -05:00
committed by GitHub
co-authored by Harsh Singh Claude Fable 5.1
parent 1454492577
commit 647c8baa42
4 changed files with 381 additions and 63 deletions
@@ -0,0 +1,24 @@
name: Check Hermes Config Rewrite
# Regression test for the ensure_hermes_plugin_enabled() heredoc bug fixed
# alongside this workflow. Catches two related symptoms:
# 1. Wrong indent on insert (collapses plugins.enabled onto one line as a
# scalar string under any config whose items use a non-default indent).
# 2. Non-idempotent re-runs that silently duplicate the new entry.
# Runs on every PR — small surface area, fast, no deps beyond bash + python3.
on:
pull_request:
push:
branches: [main]
jobs:
check-hermes-config-rewrite:
name: install.sh hermes config rewrite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run regression cases
run: |
chmod +x scripts/check-hermes-config-rewrite.sh
./scripts/check-hermes-config-rewrite.sh