4691eb5433
Review feedback: the previous tests mocked get_hermes_home, get_default_hermes_root and _resolve_active_profile_name, so they checked template rendering but never exercised the relationship that causes the defect — _resolve_active_profile_name returns a named profile only when the active home is already <root>/profiles/<name>, which is precisely why appending that suffix doubled it. Replace them with tests that set a real HERMES_HOME under a tmp root and mock no resolver. They assert the chain first (_resolve_active_profile_name == "coder", get_hermes_home == the profile dir, get_default_hermes_root == the root), then the rendered prompt. Adds the default-profile branch the same way. This also removes the order-dependent failures noted in the PR description. Module-attribute monkeypatching stops taking effect once other files in tests/agent/ have run, which is what made the mocked tests fail in a full-directory run; the un-mocked tests are immune. tests/agent/ now reports 87 failures — identical to the baseline on unmodified main, with none in this file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>