The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): keep the xai migration emitter on the same no-fold width
Hukla2f0cab5141da
diff --git a/hermes_cli/xai_retirement.py b/hermes_cli/xai_retirement.pyindex 5ca3ef9063d..957ad7c382a 100644--- a/hermes_cli/xai_retirement.py+++ b/hermes_cli/xai_retirement.py@@ -138,7 +138,9 @@ def apply_migration(if not issues:return unchanged+ from utils import ROUNDTRIP_YAML_WIDTHyaml = YAML(typ="rt")+ yaml.width = ROUNDTRIP_YAML_WIDTHyaml.preserve_quotes = Truewith config_path.open("r", encoding="utf-8") as fh:doc = yaml.load(fh)diff --git a/tests/hermes_cli/test_xai_retirement.py b/tests/hermes_cli/test_xai_retirement.pyindex 4081f346a39..c1ad77bd8f9 100644--- a/tests/hermes_cli/test_xai_retirement.py+++ b/tests/hermes_cli/test_xai_retirement.py@@ -2,14 +2,36 @@from __future__ import annotations+import yaml+from hermes_cli.xai_retirement import (_RETIRED_MODELS,_looks_like_xai,_normalize,+ apply_migration,find_retired_xai_refs,)+def test_apply_migration_preserves_long_double_quoted_scalar(tmp_path, monkeypatch):+ """Same fold-after-backslash class as #119844: the migration's own emitter must not mutate+ unrelated long quoted values while it rewrites the model key."""+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ value = "A" * 74 + r"D:\CentBrowserPortable " + "B" * 40+ cfg = tmp_path / "config.yaml"+ cfg.write_text(+ 'model:\n provider: xai\n model: grok-3\napprovals:\n smart_policy: "'+ + value.replace("\\", "\\\\") + '"\n',+ encoding="utf-8",+ )++ apply_migration(cfg, [RetirementIssue("model.model", "grok-3", "grok-4")], backup=False)++ loaded = yaml.safe_load(cfg.read_text(encoding="utf-8"))+ assert loaded["model"]["model"] == "grok-4"+ assert loaded["approvals"]["smart_policy"] == value++# ---------------------------------------------------------------------------# Helpers# ---------------------------------------------------------------------------