Skip to content

The agent that grows with you

fix(config): hedge the `config get` phantom-key notice — the schema walk has false positives

teknium1da942e44834d
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index 18bed060da7..8b9d65b058a 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -3655,15 +3655,18 @@ def get_config_value(key: str, *, as_json: bool = False, raw: bool = False):
print(_format_config_get_value(value, as_json=as_json), flush=True)
# Phantom-key notice (#112348): a nested path under a KNOWN section that the schema does not
- # define (``compression.compressor.enabled``) is echoed straight from the user's file and read
- # by nothing, so it must not look like a live setting. Custom top-level keys stay exempt (they
+ # define (``compression.compressor.enabled``) is echoed straight from the user's file and is
+ # usually read by nothing, so it must not look like a live setting. The check is a
+ # DEFAULT_CONFIG walk and some live keys are deliberately unseeded (``browser.cloud_provider``,
+ # ``stt.provider``, ``gateway.proxy_url``: a stored value counts as an explicit user pick), so
+ # the wording hedges exactly like the set-path notice. Custom top-level keys stay exempt (they
# are bridged into os.environ for skills) and ``_validate_config_key`` already accepts
# open-subkey sections. stderr keeps stdout/--json parseable; the exit code stays 0.
if _split_key_path(key)[0] in _known_top_level_keys():
is_known, suggestion = _validate_config_key(key)
if not is_known:
print(color(
- f"⚠ '{key}' is not a recognized config key — Hermes does not read it; the value "
+ f"⚠ '{key}' is not a recognized config key — Hermes may not read it; the value "
"printed above comes from your config file.", Colors.YELLOW), file=sys.stderr)
if suggestion:
print(color(f" Did you mean: {suggestion}", Colors.YELLOW), file=sys.stderr)
diff --git a/tests/hermes_cli/test_set_config_value.py b/tests/hermes_cli/test_set_config_value.py
index ab0709f8957..e683e54de0d 100644
--- a/tests/hermes_cli/test_set_config_value.py
+++ b/tests/hermes_cli/test_set_config_value.py
@@ -239,6 +239,20 @@ class TestConfigGetPhantomKeyNotice:
assert json.loads(captured.out) is True # stdout stays parseable: notice is stderr-only
assert "not a recognized config key" in captured.err
+ def test_unseeded_live_key_notice_hedges_instead_of_asserting_unread(
+ self, _isolated_hermes_home, capsys
+ ):
+ # The check is a DEFAULT_CONFIG walk; ``browser.cloud_provider`` is deliberately unseeded
+ # yet read by tools/browser_tool_cloud.py, so the notice must not claim it is never read.
+ (_isolated_hermes_home / "config.yaml").write_text("browser:\n cloud_provider: local\n")
+
+ config_command(argparse.Namespace(config_command="get", key="browser.cloud_provider", json=False))
+
+ captured = capsys.readouterr()
+ assert captured.out.strip() == "local"
+ assert "may not read it" in captured.err
+ assert "does not read it" not in captured.err
+
@pytest.mark.parametrize(
"key, body",
[
diff --git a/website/docs/reference/cli-commands.md b/website/docs/reference/cli-commands.md
index f3a797f35c8..a799d8f5a6b 100644
--- a/website/docs/reference/cli-commands.md
+++ b/website/docs/reference/cli-commands.md
@@ -1242,7 +1242,7 @@ Subcommands:
|------------|-------------|
| `show` | Show current config values. |
| `edit` | Open `config.yaml` in your editor. |
-| `get <key> [--json] [--raw]` | Print a single config value by dotted key (e.g. `hermes config get model.default`). `--json` emits machine-readable output. Credential-shaped values (`api_key`, `*_TOKEN`, `*_SECRET`, `password`, …) are masked (`sk-o...7890`) because the agent runs this from sessions whose transcripts persist; `--raw` prints the real value (or set `security.redact_secrets: false`). A nested key under a known section that the schema does not define (`compression.compressor.enabled`) still prints its file value, plus a stderr notice that Hermes does not read it; stdout and the exit code (0) are unchanged. |
+| `get <key> [--json] [--raw]` | Print a single config value by dotted key (e.g. `hermes config get model.default`). `--json` emits machine-readable output. Credential-shaped values (`api_key`, `*_TOKEN`, `*_SECRET`, `password`, …) are masked (`sk-o...7890`) because the agent runs this from sessions whose transcripts persist; `--raw` prints the real value (or set `security.redact_secrets: false`). A nested key under a known section that the schema does not define (`compression.compressor.enabled`) still prints its file value, plus a stderr notice that Hermes may not read it; stdout and the exit code (0) are unchanged. |
| `set <key> <value> [--force]` | Set a config value. Dotted paths go to `config.yaml`; every `UPPER_SNAKE` name (`OPENROUTER_API_KEY`, `DISCORD_HOME_CHANNEL`, `TELEGRAM_GROUP_ALLOWED_USERS`, `HERMES_TIMEZONE`, …) is an environment variable and goes to `.env` — the same file the platform setup flows and `/sethome` write, and the one every runtime reader resolves against. `config set` never writes an `UPPER_SNAKE` key into `config.yaml`, `--force` included; names on the env writer's denylist (`HERMES_YOLO_MODE`, `PATH`, …) are refused outright; any other `UPPER_SNAKE` name is saved to `.env` as-is (plugins, skills and external tools read it from the process environment). An unknown path under a known section (`gateway.discord.foo`) is refused with a did-you-mean and nothing is written; an unknown lowercase *top-level* key is written with a notice (top-level scalars are bridged into the environment for skills). `--force` writes either of those. |
| `unset <key>` | Remove a config key, reverting it to the built-in default. For `UPPER_SNAKE` names this removes the `.env` entry and also drops a stale top-level `config.yaml` copy left by older `config set` runs (`get` reports such a copy as stale). |
| `path` | Print the config file path. |
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index 80a8759decb..1a25dc3129b 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -47,7 +47,7 @@ hermes config set OPENROUTER_API_KEY sk-or-... # Saves to .env
```
:::tip
-The `hermes config set` command automatically routes values to the right file — every `UPPER_SNAKE` name (`OPENROUTER_API_KEY`, `DISCORD_HOME_CHANNEL`, `TELEGRAM_GROUP_ALLOWED_USERS`, `HERMES_TIMEZONE`, …) is an environment variable and is saved to `.env`, never to `config.yaml`; dotted settings go to `config.yaml`. Any other `UPPER_SNAKE` name is saved to `.env` as-is (it is exported to the process environment for plugins and skills); names on the env writer's denylist (`HERMES_YOLO_MODE`, `PATH`, …) are refused. A misspelled path under a known section (`gateway.discord.foo`) is refused with a did-you-mean before anything is written; pass `--force` to write it anyway. `hermes config get` on such a path prints the value from your file together with a stderr notice that Hermes does not read it, so a leftover key cannot pass for a live setting.
+The `hermes config set` command automatically routes values to the right file — every `UPPER_SNAKE` name (`OPENROUTER_API_KEY`, `DISCORD_HOME_CHANNEL`, `TELEGRAM_GROUP_ALLOWED_USERS`, `HERMES_TIMEZONE`, …) is an environment variable and is saved to `.env`, never to `config.yaml`; dotted settings go to `config.yaml`. Any other `UPPER_SNAKE` name is saved to `.env` as-is (it is exported to the process environment for plugins and skills); names on the env writer's denylist (`HERMES_YOLO_MODE`, `PATH`, …) are refused. A misspelled path under a known section (`gateway.discord.foo`) is refused with a did-you-mean before anything is written; pass `--force` to write it anyway. `hermes config get` on such a path prints the value from your file together with a stderr notice that Hermes may not read it, so a leftover key cannot silently pass for a live setting.
:::
## Configuration Precedence