Skip to content

fix(config): use is_truthy_value() for config boolean parsing - #56446

Open
Slobaka wants to merge 1 commit into
NousResearch:mainfrom
Slobaka:fix/config-bool-truthy-v2
Open

Slobaka wants to merge 1 commit into
NousResearch:mainfrom
Slobaka:fix/config-bool-truthy-v2

Conversation

@Slobaka

@Slobaka Slobaka commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Several config boolean reads used bool(cfg.get(key, default)), which treats the string "false" as truthy. Users setting enabled: false or paused: "false" in config.yaml got the opposite behavior.

Fix

Replace all bool(cfg.get(...)) calls with is_truthy_value() from utils.py, which correctly handles string booleans ("false", "0", "no", "off"False).

Files changed

  • agent/agent_init.py — 3 sites
  • agent/curator.py — 4 sites (is_paused, is_enabled, get_prune_builtins, get_consolidate)
  • agent/curator_backup.py — 1 site
  • agent/lsp/manager.py — 1 site
  • hermes_cli/cli_commands_mixin.py — 1 site
  • hermes_cli/kanban_decompose.py — 1 site
  • hermes_cli/webhook.py — 2 sites

Tests

Added tests/hermes_cli/test_config_truthy_parsing.py covering string "false", "0", "no", "off", numeric 0, and actual False for each affected function.

Verification

Rebased against main (9be292f, 2026-07-01). All changes apply cleanly. is_truthy_value() already exists in utils.py and is used in agent_init.py — this PR extends its usage to the remaining call sites that still use bool().

Closes NousResearch#49883

Several config paths used bool() to parse YAML config values, which
treats any non-empty string as True — including 'false', '0', 'off',
and 'no'. Users setting these string values in config.yaml expected
them to disable features, but bool() silently enabled them instead.

Replaced bool() with is_truthy_value() in 7 files (9 config paths):
- agent/agent_init.py: write_json_snapshots, task_completion_guidance,
  parallel_tool_call_guidance, environment_probe
- agent/curator.py: paused, enabled, prune_builtins, consolidate
- agent/curator_backup.py: enabled
- agent/lsp/manager.py: enabled
- hermes_cli/webhook.py: enabled
- hermes_cli/cli_commands_mixin.py: enabled
- hermes_cli/kanban_decompose.py: auto_promote_children
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Jul 1, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for identifying a real coercion bug: current main still uses bool() for the targeted agent-init settings (agent/agent_init.py:1287,1491-1503), and utils.is_truthy_value() has the intended semantics (utils.py:22-30).

Problems

  • The same curator.prune_builtins setting is still parsed with bool() in tools/skill_usage.py:257; changing only agent/curator.py leaves that active path wrong for quoted "false".
  • The /footer change does not fix runtime footer delivery: gateway/runtime_footer.py:73 and :84 still treat quoted "false" as enabled.
  • tests/hermes_cli/test_config_truthy_parsing.py tests only the shared helper, already covered by tests/test_utils_truthy_values.py:6-21; it does not invoke a changed accessor.

Suggested changes

  • Extend the selected sweep to the same-key/runtime readers above.
  • Add production-path regression tests that pass quoted false through the affected config accessors.

Automated hermes-sweeper review.

@@ -2345,7 +2346,7 @@ def _handle_footer_command(self, cmd_original: str) -> None:

cfg = load_config() or {}
footer_cfg = ((cfg.get("display") or {}).get("runtime_footer") or {})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This corrects the /footer command's displayed state, but the delivered gateway footer still parses both global and platform overrides with bool() in gateway/runtime_footer.py:73 and :84. Please update those runtime readers in the same sweep so enabled: "false" actually disables the footer.

when used in config paths, instead of bool() which treats any
non-empty string as True.
"""
import pytest

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file exercises only the utility, whose falsey-string behavior is already covered by tests/test_utils_truthy_values.py. Add regression tests through the changed config accessors so a missed import or an unconverted call site fails coverage.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants