Skip to content

Hermes Agent target emits broken YAML in platform_toolsets block via codegraph install #467

@pty819

Description

@pty819

Bug

Running codegraph install --target hermes (or interactive install selecting Hermes Agent) produces broken YAML in ~/.hermes/config.yaml. The platform_toolsets.cli section has - hermes-cli at the wrong indentation level, causing yaml.safe_load to raise a ParserError.

Broken output

platform_toolsets:
  cli:
    - mcp-codegraph
  - hermes-cli    # ← wrong: at cli: level instead of inside

Correct output (from --print-config)

platform_toolsets:
  cli:
    - hermes-cli
    - mcp-codegraph

Note that --print-config produces correct YAML, but the actual writeHermesConfig()upsertCodeGraphToolset() code path does not.

Error

yaml.parser.ParserError: while parsing a block mapping
  in "config.yaml", line 547, column 3
expected <block end>, but found 

Affected code

File: src/installer/targets/hermes.ts → compiled lib/dist/installer/targets/hermes.js

Function: upsertCodeGraphToolset (lines 259-281)

Three code paths:

  1. !parent (no platform_toolsets: block) — appends correct YAML at EOF. ✅
  2. !cli (block exists but no cli: child) — splices correct YAML. ✅
  3. cli exists — either returns unchanged or appends mcp-codegraph at cli.end. ❓

The broken output (- hermes-cli outside cli:) does not match any of these insertion patterns, suggesting a subtle edge case in childRange end-boundary detection (line 178, regex /^\s\S/ on line 194) or topLevelRange (line 162) when there are other sibling children under platform_toolsets.

Environment

  • codegraph version: 0.9.5
  • Hermes Agent: latest
  • config location: ~/.hermes/config.yaml (global)
  • OS: Linux (arm64)

Additional context

The --print-config hermes output is correct — the bug manifests only in the actual file-writing path. This was discovered on a fresh install where platform_toolsets did not exist in the config beforehand (so the !parent branch was taken), yet the resulting YAML had the malformed structure shown above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions