From 9429f106f75ca21b1da87959bfe1e8472e707899 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 16 Sep 2026 12:48:06 -0700 Subject: [PATCH] docs(cli): say why the runtime snapshot deep-copies reasoning_config explicitly Review flagged the key as emitted twice (by reference via _runtime_fields, then the explicit deepcopy). The override is intentional: _runtime_fields copies by reference and reasoning_config is a mutable dict, so dropping the explicit line would alias the snapshot to the live config. Comment only; no behaviour change. --- hermes_cli/cli_model_switch_mixin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hermes_cli/cli_model_switch_mixin.py b/hermes_cli/cli_model_switch_mixin.py index 3bf94e06f4..d84cdc073b 100644 --- a/hermes_cli/cli_model_switch_mixin.py +++ b/hermes_cli/cli_model_switch_mixin.py @@ -517,6 +517,7 @@ class CLIModelSwitchMixin: def _snapshot_model_runtime(self) -> dict: """Capture current CLI and agent model runtime for one-turn restore.""" agent = getattr(self, "agent", None) + # ``reasoning_config`` is a mutable dict: deepcopy it so a later in-place edit cannot alias the snapshot. return { **_runtime_fields(self), "reasoning_config": copy.deepcopy(getattr(self, "reasoning_config", None)),