Skip to content

fix(cli): always write user config to ~/.hermes/config.yaml, never to repo cli-config.yaml (#14714)#15436

Open
Tranquil-Flow wants to merge 3 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/save-config-always-write-user-path
Open

fix(cli): always write user config to ~/.hermes/config.yaml, never to repo cli-config.yaml (#14714)#15436
Tranquil-Flow wants to merge 3 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/save-config-always-write-user-path

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

save_config_value() uses user_config_path if user_config_path.exists() else project_config_path to choose where to write. On first run, when ~/.hermes/config.yaml does not exist yet, this falls back to writing into the repo's cli-config.yaml. The comment at line 1751 says "Ensure parent directory exists (for ~/.hermes/config.yaml on first use)" but the mkdir runs after config_path is already chosen as the project fallback.

This PR makes save_config_value() always target user_config_path for writes. The fallback to project config should only apply to reads (which load_cli_config() already handles).

Related Issue

Fixes #14714

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • cli.py: Changed save_config_value() to always target user_config_path for writes. The existing mkdir(parents=True, exist_ok=True) handles creating ~/.hermes/ if needed, and the existing "Load existing config" block handles the case where the file does not yet exist.

How to Test

Tests: tests/cli/test_cli_save_config_value.py — 3 new tests in TestSaveConfigValueWriteTarget:

  1. Config is created in ~/.hermes/ when it does not exist
  2. Repo cli-config.yaml is never modified
  3. Values round-trip through a freshly created user config

Tested on macOS (Python 3.11).

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/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS (Python 3.11)

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) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

pytest tests/cli/test_cli_save_config_value.py::TestSaveConfigValueWriteTarget -q
3 passed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Apr 25, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Supersedes #14848 — same fix for #14714 (first-run config writes to wrong path).

… repo cli-config.yaml (NousResearch#14714)

When ~/.hermes/config.yaml didn't exist yet (first run),
save_config_value() fell back to writing into the repo's
cli-config.yaml. The fallback logic should only apply to reads
(load_cli_config already handles this). Writes now always target
the user config path, creating ~/.hermes/ and config.yaml as
needed.
@Tranquil-Flow Tranquil-Flow force-pushed the fix/save-config-always-write-user-path branch from b19e0e7 to 0ef33e7 Compare May 25, 2026 11:05
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/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

save_config_value() writes first-run user changes into repo cli-config.yaml

2 participants