NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[All Platforms][CLI&UX] config set on a Hermes sandbox rewrites 19-digit integers such as Discord channel IDs

Open PicoNVIDIA opened this issue 2 months ago • 0 comments

Description

On a Hermes sandbox, nemoclaw <sandbox> config set reads /sandbox/.hermes/config.yaml with YAML.parse, changes one key, and writes the whole file back with YAML.stringify (src/lib/sandbox/config.ts, src/lib/sandbox/config-format.ts). Integers pass through JavaScript numbers on the way, so any unquoted integer above 2^53 is written back as a different number, even when it isn't the key you set.

Discord IDs are 18 or 19 digits, which puts every one of them above 2^53. Hermes' own hermes config set writes integer-looking values as unquoted YAML integers (_coerce_config_set_value in hermes_cli/config.py), so a Discord ID set through Hermes ends up unquoted in this file.

--value has the same problem because it goes through JSON.parse: --value 1234567890123456789 is stored as 1234567890123456800.

Reproduction Steps

  1. In an isolated HOME, register a Hermes sandbox named hsb. Stub openshell so that reading config.yaml returns:
    platforms:
      discord:
        home_channel:
          platform: discord
          chat_id: 1234567890123456789
          name: Home
    display:
      skin: default
    
    Stub docker exec to save whatever the CLI writes.
  2. Run nemoclaw hsb config set --key display.skin --value mono.
  3. Compare the saved file with the original.

Environment

  • macOS 26.5.2 (arm64), Node.js v22.22.3
  • NemoClaw main at 4c44f7cc8; the files involved are unchanged on d61268122
  • Real CLI (node bin/nemoclaw.js) with stubbed openshell and docker

Debug Output

$ nemoclaw hsb config set --key display.skin --value mono
  hermes config updated.
before:  chat_id: 1234567890123456789
after:   chat_id: 1234567890123456800
         skin: mono

$ nemoclaw hsb config set --key platforms.discord.home_channel.chat_id --value 1234567890123456789
  New value: 1234567890123456800
written: chat_id: 1234567890123456800

If the ID is quoted (chat_id: "1234567890123456789"), the file comes back unchanged apart from skin: mono. Small integers round-trip fine.

Logs

Hermes reads the ID back with str(data["chat_id"]), so after an unrelated config set the home channel points at a different ID than the one the user set. The command reports success and never mentions the field it changed.

Parsing with YAML.parse(raw, { intAsBigInt: true }), or editing a YAML.parseDocument() in place so untouched nodes keep their original text, would stop the rewrite. For --value, integers outside the safe range could stay as strings or BigInts. A round-trip test with a 19-digit integer would cover both.

Checklist

  • [x] I confirmed this bug is reproducible
  • [x] I searched existing issues and this is not a duplicate

PicoNVIDIA avatar Sep 28 '26 21:09 PicoNVIDIA