hermes - ✅(Solved) Fix [Bug]: HERMES_MANAGED=false is treated as a real managed install [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#12864Fetched 2026-04-20 12:16:36
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×2referenced ×2

Setting HERMES_MANAGED=false makes Hermes behave as if it is package-managed by a manager literally named false. That causes commands guarded by is_managed() (for example update flows) to be blocked even though the operator explicitly tried to disable managed mode.

Root Cause

Setting HERMES_MANAGED=false makes Hermes behave as if it is package-managed by a manager literally named false. That causes commands guarded by is_managed() (for example update flows) to be blocked even though the operator explicitly tried to disable managed mode.

Fix Action

Fix / Workaround

Minimal reproduction

import os
from unittest.mock import patch
from hermes_cli.config import get_managed_system, is_managed

with patch.dict(os.environ, {"HERMES_MANAGED": "false"}, clear=False):
    print(get_managed_system())  # actual: 'false'
    print(is_managed())          # actual: True

PR fix notes

PR #12878: fix: treat falsey HERMES_MANAGED values as unmanaged

Description (problem / solution / changelog)

Summary

Closes #12864.

get_managed_system() treats any non-empty HERMES_MANAGED value as a package manager name unless it matches the small _MANAGED_TRUE_VALUES set ("true", "1", "yes"). Falsey strings like "false", "0", "no", and "off" fall through to the catch-all return raw path, returning the literal string (e.g. "false") as a manager name. This makes is_managed() return True and blocks guarded commands like hermes update.

Root Cause

def get_managed_system():
    raw = os.getenv("HERMES_MANAGED", "").strip()
    if raw:                                    # any non-empty string is truthy
        normalized = raw.lower()
        if normalized in _MANAGED_TRUE_VALUES:  # "false" not in ("true", "1", "yes")
            return "NixOS"
        return _MANAGED_SYSTEM_NAMES.get(normalized, raw)  # → returns "false"

Fix

Added _MANAGED_FALSE_VALUES = ("false", "0", "no", "off") and check it before the truthy and system-name branches. When matched, return None (unmanaged).

3 lines of production code across 1 file.

Tests

  • Parametrized test: 7 falsey string variants ("false", "False", "FALSE", "0", "no", "off", "OFF") all verify get_managed_system() is None, is_managed() is False, and recommended_update_command() == "hermes update".
  • Integration test: verifies the managed message path is unreachable when HERMES_MANAGED=false.

All 13 tests in test_managed_installs.py pass (5 existing + 8 new).

Changed files

  • hermes_cli/config.py (modified, +3/-0)
  • tests/hermes_cli/test_managed_installs.py (modified, +30/-0)

PR #12880: fix(config): treat explicit false values in HERMES_MANAGED as unmanaged

Description (problem / solution / changelog)

Summary

Fixes a bug where HERMES_MANAGED=false (and other common false-like strings) was incorrectly treated as a real managed-system name, causing is_managed() to return True and blocking update/config commands.

Root Cause

get_managed_system() only normalized known true values (true, 1, yes) but passed everything else through as a literal string. This meant false became the "managed system" named false.

Changes

  • Added _MANAGED_FALSE_VALUES = (\"false\", \"0\", \"no\", \"off\") in hermes_cli/config.py
  • Check false values before true values in get_managed_system() — returns None for any explicit false value
  • Added parametrized regression tests covering false, 0, no, off, FALSE, and False

Testing

pytest tests/hermes_cli/test_managed_installs.py -v
# 11 passed (including 6 new regression tests)

Fixes #12864

Changed files

  • hermes_cli/config.py (modified, +3/-0)
  • tests/hermes_cli/test_managed_installs.py (modified, +12/-0)

Code Example

import os
from unittest.mock import patch
from hermes_cli.config import get_managed_system, is_managed

with patch.dict(os.environ, {"HERMES_MANAGED": "false"}, clear=False):
    print(get_managed_system())  # actual: 'false'
    print(is_managed())          # actual: True
RAW_BUFFERClick to expand / collapse

Summary

Setting HERMES_MANAGED=false makes Hermes behave as if it is package-managed by a manager literally named false. That causes commands guarded by is_managed() (for example update flows) to be blocked even though the operator explicitly tried to disable managed mode.

Affected code

  • hermes_cli/config.py:74-81
  • hermes_cli/config.py:89-96
  • coverage gap: tests/hermes_cli/test_managed_installs.py

Why this is a bug

get_managed_system() treats any non-empty HERMES_MANAGED value as a manager name unless it matches a small set of known true values. Falsey strings like false, 0, no, and off are not recognized as opt-out values.

That means:

  • get_managed_system() returns the raw string "false"
  • is_managed() becomes True
  • guarded commands refuse to run

Minimal reproduction

import os
from unittest.mock import patch
from hermes_cli.config import get_managed_system, is_managed

with patch.dict(os.environ, {"HERMES_MANAGED": "false"}, clear=False):
    print(get_managed_system())  # actual: 'false'
    print(is_managed())          # actual: True

Observed in the repo venv:

  • managed_system: 'false'
  • is_managed: True

Expected behavior

  • Falsey env values should disable managed mode, returning None / False.

Actual behavior

  • HERMES_MANAGED=false is treated as a real manager identifier.

Suggested investigation

  • Normalize explicit falsey values the same way other bool-like settings are normalized.
  • Add regression coverage for false, 0, no, and off in addition to the existing managed-install tests.

extent analysis

TL;DR

Setting HERMES_MANAGED to a falsey value like "false" should be treated as disabling managed mode, but currently, it's interpreted as a manager name, so normalizing these values is necessary.

Guidance

  • The issue arises from get_managed_system() not recognizing falsey strings as opt-out values, so updating this function to handle such cases is essential.
  • To verify the fix, run the provided minimal reproduction code with the updated get_managed_system() function to ensure it returns None when HERMES_MANAGED is set to "false".
  • Consider adding regression tests for other falsey values like "0", "no", and "off" to ensure they are handled correctly.
  • Review the is_managed() function to ensure it correctly interprets the result of get_managed_system() when HERMES_MANAGED is set to a falsey value.

Example

def get_managed_system():
    # Example of normalizing falsey values
    managed = os.environ.get("HERMES_MANAGED")
    if managed in ["false", "0", "no", "off", ""]:
        return None
    # Existing logic for known true values and other cases

Notes

The current implementation has a coverage gap in tests/hermes_cli/test_managed_installs.py, which should be addressed to prevent similar issues in the future.

Recommendation

Apply a workaround by normalizing explicit falsey values in the get_managed_system() function, as this directly addresses the root cause of the issue and ensures that managed mode is correctly disabled when HERMES_MANAGED is set to a falsey value.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Falsey env values should disable managed mode, returning None / False.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: HERMES_MANAGED=false is treated as a real managed install [2 pull requests, 1 participants]