Skip to content

fix(config): log warning instead of silently swallowing config.yaml errors#2673

Closed
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/config-yaml-silent-failure
Closed

fix(config): log warning instead of silently swallowing config.yaml errors#2673
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:fix/config-yaml-silent-failure

Conversation

@sprmn24

@sprmn24 sprmn24 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a silent failure in gateway/config.py where the entire config.yaml processing block (lines 411-517) is wrapped in except Exception: pass. Any YAML syntax error, file permission issue, or unexpected data shape is silently swallowed — users see no error and have no idea why their config changes have no effect.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/config.py: Replaced bare except Exception: pass with except Exception as e: logger.warning(...) that logs:
    • That config.yaml processing failed
    • The config file path to check for syntax errors
    • The actual error message
    • That the gateway is falling back to .env / gateway.json values

No new imports needed — logger = logging.getLogger(__name__) was already defined at the top of the file.

How to Test

  1. Introduce a syntax error in ~/.hermes/config.yaml (e.g. add a stray : or unbalanced quotes)
  2. Start the gateway: hermes gateway
  3. Check logs - you should now see a warning with the file path and error details
  4. Run tests: python3 -m pytest tests/ -q

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've tested on my platform: Ubuntu 24.04 (WSL2)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

N/A — logging change, no UI impact.

…rrors

A bare `except Exception: pass` meant any YAML syntax error, bad value,
or unexpected structure in config.yaml was silently ignored and the
gateway fell back to .env / gateway.json without any indication.
Users had no way to know why their config changes had no effect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #2683. Your commit was cherry-picked onto current main with authorship preserved. Thanks for the clean fix, @sprmn24!

@teknium1 teknium1 closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants