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.
This commit is contained in:
teknium1
2026-09-16 12:48:06 -07:00
committed by Teknium
parent 493e0caced
commit 9429f106f7

View File

@@ -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)),